Unwanted RST TCP packet with Scapy

后端 未结 3 1352
没有蜡笔的小新
没有蜡笔的小新 2020-12-01 14:19

In order to understand how TCP works, I tried to forge my own TCP SYN/SYN-ACK/ACK (based on the tutorial: http://www.thice.nl/creating-ack-get-packets-with-scapy/ ).

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 14:27

    I don't have a non-iptables answer, but one can fix the reset issue. Instead of trying to filter the outgoing reset in the filter table, filter all of the incoming packets from the target in the raw table instead. This prevents the return packets from the target from even being processed by the kernel, though scapy still sees them. I used the following syntax:

    iptables -t raw -A PREROUTING -p tcp --dport  -j DROP
    

    This solution does force me to use the same source port for my traffic; feel free to use your own iptables-fu to identify your target's return packets.

提交回复
热议问题