How to create HTTP GET request Scapy?

后端 未结 3 697
-上瘾入骨i
-上瘾入骨i 2020-12-11 21:14

I need to create HTTP GET request and save the data response. I tried to use this:

    syn = IP(dst=URL) / TCP(dport=80, flags=\'S\')
    syn_ack = sr1(syn)         


        
3条回答
  •  不知归路
    2020-12-11 21:43

    You are sending a RST segment in response to the SYN-ACK because your kernel has no knowledge of the SYN you sent via Scapy (see here). This could be solved with an iptable rule:

    iptables -A OUTPUT -p tcp --tcp-flags RST RST -s -j DROP

    Because you are ending the connection with that RST segment, when you send your HTTP request, the endpoint answers with a RST too because connection is not established and so you are using show() on a RST segment with no data, that is why you do not see anything.

提交回复
热议问题