⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 awl_pool.c

📁 数据转发,可以根据需要动态改变 阅读您的文件包然后写出其具体功能
💻 C
字号:
#include <stdio.h>#include <stdlib.h>#include <error.h>#include <unistd.h>#include <netinet/in.h>#include <netinet/ip.h>#include <netinet/tcp.h>#include <arpa/inet.h>#include <awl_pool.h>#include <awl_rand.h>#include <awl_checksum.h>#include <awl_sig.h>extern int quit_id;int pool_init(char *head[],struct sockaddr_in *to){	int i = 0;	struct iphdr *iph;	struct tcphdr *tcph;	int iph_len = sizeof(struct iphdr),tcph_len = sizeof(struct tcphdr);	int buf_len = iph_len+tcph_len;			while(i<POOL_MAX){		head[i] = (char *)malloc(buf_len);		if(head[i] == NULL){			return(0);		}		iph = (struct iphdr *)head[i];		tcph = (struct tcphdr *)(head[i]+iph_len);				iph->ihl=5;    	iph->version=4;    	iph->tos=0;    	iph->tot_len=htons(iph_len+tcph_len);    	iph->id=htons(get_rand16());    	iph->frag_off=0;    	iph->ttl=get_rand8();    	iph->protocol=IPPROTO_TCP;    	iph->check=0;    	iph->saddr=get_rand32();    	iph->daddr=(to->sin_addr).s_addr;			tcph->source = get_rand16();		tcph->dest	= to->sin_port;		tcph->seq = htonl(get_rand32());		tcph->ack_seq = 0;		tcph->res1 = 0;		tcph->doff = sizeof(struct tcphdr)/4;		tcph->fin = 0;		tcph->syn = 1;		tcph->rst = 0;		tcph->psh = 0;		tcph->ack = 0;		tcph->urg = 0;		tcph->res2 = 0;		tcph->window = htons(get_rand16());		tcph->check = 0;		tcph->urg_ptr = 0;		tcph->check = tcp_checksum(	iph->saddr,									iph->daddr,									(unsigned short *)tcph,									tcph_len);		i++;	}		return(1);}int pool_clean(char *head[]){	int i=0;	while(i<POOL_MAX){		free(head[i]);		i++;	}		return(1);}int pool_show(char *head[]){	int i = 0;	struct iphdr *iph;	struct in_addr in;	while(i<POOL_MAX){		iph =(struct iphdr*)head[i];		in.s_addr = iph->saddr;		printf("\nNo.%d,",i);		printf("src address:%s",inet_ntoa(in));								i++;	}		return(1);}int pool_renew(char *head[]){	int i = 0;	struct iphdr *iph;	struct tcphdr *tcph;	int iph_len = sizeof(struct iphdr),tcph_len = sizeof(struct tcphdr);			while(i<POOL_MAX){		iph = (struct iphdr *)head[i];		tcph = (struct tcphdr *)(head[i]+iph_len);				iph->id=htons(get_rand16());    	iph->ttl=get_rand8();    	iph->check=0;    	iph->saddr=get_rand32();    			tcph->source = get_rand16();		tcph->seq = htonl(get_rand32());		tcph->window = htons(get_rand16());		tcph->check = 0;				tcph->check = tcp_checksum(	iph->saddr,									iph->daddr,									(unsigned short *)tcph,									tcph_len);		if(quit_id == 1){			printf("pool_renew success\n");			goto over;		}				i++;		if(i >= POOL_MAX){			i = 0;		}				sleep(60);	}	over:		return(1);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -