A small TCP wrapper around Scapy
Send TCP payloads with custom parameters.
- Payload, as an ASCII string or bytestring with escaped characters
- Size and number of segments sent via the
--mss
option - Source and destination ports
- Initial segment number (ISN) via the
--isn
option - Connection ending : either with FIN segment
--endswith-fin
or with RST segment--endswith-rst
- Delay between the segments via
--sleep
option
Send an Hello world to a local HTTP server:
./tcpayload.py -p "Hello world" 127.0.0.1 127.0.0.1 80
Send a payload in a very customized way:
./tcpayload.py -p "my_payload" --endswith-rst --isn 1234 --sleeptime 5 --mss 5 192.168.0.1 192.168.0.2 6666
Scapy needs to open a raw socket, either you grant privileges to the script to do so with capabilities (see here) or you execute it as root.
The kernel stack does not keep Scapy's opened connections and so send these unwanted packets (see here), you can add an iptables rules to avoid these.