Skip to content

Instantly share code, notes, and snippets.

@david415
Created September 30, 2013 04:58
Show Gist options
  • Save david415/6759525 to your computer and use it in GitHub Desktop.
Save david415/6759525 to your computer and use it in GitHub Desktop.
hiding messages in tcp header using scapy; retrieving messages from iptables LOG...
#!/usr/bin/env python
import binascii
from scapy.all import TCP, IP
ip = IP(dst="192.155.82.5")
tcp = TCP(dport = 6200,
flags = 'S',
seq = 32456,
ack = 32456,
window = 32456,
options = [('MSS',binascii.unhexlify("DEADBEEFCAFEF1F1F0F2FFFFFFFFFF0F0F0F0F0F0F0FFFFFFFFFFFFFFFFFFFFF"))])
send(ip/tcp)
"""
Sep 30 04:44:33 localhost kernel: REJECT IN=eth0 OUT= MAC=... SRC=x.x.x.x DST=y.y.y.y LEN=76 TOS=0x00 PREC=0x00 TTL=51 ID=1 PROTO=TCP SPT=20 DPT=6200 SEQ=32456 ACK=32456 WINDOW=32456 RES=0x00 SYN URGP=0 OPT (0222DEADBEEFCAFEF1F1F0F2FFFFFFFFFF0F0F0F0F0F0F0FFFFFFFFFFFFFFFFFFFFF0000)
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment