How to send a SYN packet and not sending the ACK response?

廉价感情. 提交于 2020-06-09 05:25:08

问题


import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("HOST", PORT))

This code surely send a SYN packet to HOST, but does it complete the three-way handshake? Does it send the ACK packet to HOST?

If not, how can I make socket not sending the ACK packet?

That's because I'm trying to study the syn flood flaws and how this attack works. So SYN packets are sent but no ACK packets response are sent.


回答1:


The .connect() call is asking the kernel to setup a usable socket with the standard 3-way handshake:

  1. SYN →
  2. ← SYN+ACK
  3. ACK →

To send packets, without creating a usable socket, call hping3 instead:

$ sudo hping3 -i u1 -S -p 80 192.168.1.1


来源:https://stackoverflow.com/questions/61295256/how-to-send-a-syn-packet-and-not-sending-the-ack-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!