필자가 제공 한 모든 IP 및 포트 번호에서 syn 패킷을 던지는 작은 도구를 코딩했습니다. Wireshark가 나타 났을 때 전송 된 패킷은 오류없이 나타납니다. 전형적인 TCP SYN 패킷처럼 보입니다.syn 이후에 ack 검색
어떤 이유인지, ACK는 서버에 의해 보내지지 않습니다. 그래서 두 가지 문제가 있습니다. 하나, ACK 응답 없음. 둘째, 나는 내 프로그램 (bind()?)을 통해 ack 응답을받는 방법을 모른다.
필자가 온라인에서 찾은 syn flooder에서 일부 코드를 수정했는데, 이는 스크립트 작성자 코드가 쉽게 따라 할 수있는 것처럼 보였지만, 뭔가 빠졌을 수 있으며 서버의 ACK 거부. 합법적 인 IP 주소에서 syn 요청이 전송되도록 코드가 수정되었습니다. 다음 코드는 내 ip + tcp 헤더를 보여줍니다 :
iph->ihl = 5;
iph->version = 4;
iph->tos = 0;
iph->tot_len = sizeof (struct ip) + sizeof (struct tcphdr);
iph->id = htonl (54321); //Id of this packet
iph->frag_off = 0;
iph->ttl = 255;
iph->protocol = 6;
iph->check = 0; //Set to 0 before calculating checksum
iph->saddr = 0; //Source ip filled in by kernel
iph->daddr = sin.sin_addr.s_addr;
//TCP Header
tcph->source = htons (9999);
tcph->dest = htons (atoi(argv[2]));
tcph->seq = random();
// tcph->ack_seq = 0;
tcph->doff = 5; /* first and only tcp segment */
tcph->syn = 1;
tcph->window = htonl (65555); /* maximum allowed window size */
tcph->check = 0;/* if you set a checksum to zero, your kernel's IP stack
should fill in the correct checksum during transmission */
tcph->urg_ptr = 0;
//Now the IP checksum
iph->check = csum ((unsigned short *) datagram, iph->tot_len >> 1);
그래서, 나는 그것을 반송하지 않습니다. 내가 뭘 놓치고 있니?
보인다. 나는 양쪽 끝점에서 스니퍼로 확인하는 것이 좋습니다. – jweyrich