Coder Social home page Coder Social logo

i2pmm's Introduction

I2PMM

Intermediate IP Modification Module

design

use netfilter to send message

unsigned int nf_out_hook_proc( void * priv, struct sk_buff * skb, 
		        const struct nf_hook_state * state );

static struct nf_hook_ops nf_local_out = {
	.hook = nf_out_hook_proc,
	.priv = NULL,
	.pf = PF_INET,
	.hooknum = NF_INET_POST_ROUTING,
	.priority = NF_IP_PRI_FIRST ,
};

nf_register_net_hook( &init_net, &nf_local_out );
nf_unregister_net_hook(&init_net,  &nf_local_out );

use packet_type to recv message

static int dev_in_proc( struct sk_buff * skb, struct net_device * dev,
		        struct packet_type * ptype,struct net_device *oridev);
static struct packet_type dev_in = {
	.type = htons(0xf4f0),
	.func = dev_in_proc
};

dev_add_pack( &dev_in );
dev_remove_pack( &dev_in );

Operator

  1. build
make
make clean
  1. install/uninstall module
sudo insmod i2pmm.ko
sudo rmmod  i2pmm.ko
lsmod | grep i2pmm
  1. show info
# show
dmesg
tail -f /var/log/kern.log
# clear
sudo dmesg -c  

note

// include/uapi/linux/netfilter.h
/* Responses from hook functions. */
#define NF_DROP 0
#define NF_ACCEPT 1
#define NF_STOLEN 2
#define NF_QUEUE 3
#define NF_REPEAT 4
#define NF_STOP 5
#define NF_MAX_VERDICT NF_STOP

image-20240102135854665

Usually, use NF_STOLEN

Reference

[ CSDN: Zzxy1999_ ] : https://blog.csdn.net/qq_40955029/article/details/124504711

[ network ] : https://www.kancloud.cn/pshizhsysu/network/2147682

i2pmm's People

Contributors

wa-kakalala avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.