Just send tcp_syn with python socket raw. I follow the code here, but when I run the code I got below error:
Traceback (most recent call last):
File "findPort.py", line 122, in <module>
s.sendto(packet, (dest_ip , 27015 )) # put this in a loop if you want to flood the target
socket.error: [Errno 22] Invalid argument
However, when I delete setsockopt:
#s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
the code run smoothly. Unfortunately, as you can image, the wireshark sniff two tcp header data. one is the kernel add the other is myself add.
So the question is :
thanks so much in advance~~~~~~
Let me answer my own question. The main reason why python can not send raw socket because Mac/Windows not support customize TCP/UDP header. If you want to write your own TCP/UDP header and send it to net, you need to use LINUX operation system.