I am trying to do a stealth SYN scan using scapy. I read in the scapy usage documantation about sr function. It should give a response for a packet I am sending.
For example, I've tried to run the follwoing command:
>>> ans,unans = sr(IP(dst="192.168.1.1")/TCP(dport=[22,80,443],flags="S"))
I.e, I wanted to send a SYN packet over TCP/IP to 192.168.1.1.
I would have expected to get the following answer, almost immediately:
>>> Begin emission:
.......*.**.......Finished to send 3 packets.
**.*.*..*..................
Received 362 packets, got 3 answers, remaining 0 packets
But instead, I let it run over 2 minutes and sr did not finish. Furthermore, after forcing it to stop(CTRL+C), I got the following answer:
Begin emission:
.Finished to send 3 packets.
......................................^C
Received 2040 packets, got 0 answers, remaining 3 packets
I tried also many more examples and they all ended up like this.
Does anyone know why this is happening? How can I solve it? Do I have a problem in my network configurations?
Also, I'd like to add that I've tried it on two different ubuntu VM on two different computers but on the same home network.
Thanks.
You need to add timeout option otherwise sr() runs forever
ans,unans = sr(IP(dst="192.168.1.1")/TCP(dport=[22,80,443],flags="S", timeout =1))
timeout: how much time to wait after the last packet has been sent. By default, sr will wait forever and the user will have to interrupt (CtrlC) it when he expects no more answers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With