Skip to content

Instantly share code, notes, and snippets.

@coffeetocode
Created August 7, 2014 19:28
Show Gist options
  • Save coffeetocode/f2b36b1eb79bf1b2d1d2 to your computer and use it in GitHub Desktop.
Save coffeetocode/f2b36b1eb79bf1b2d1d2 to your computer and use it in GitHub Desktop.
# Uses Nicolas Maitre's MPTCP-capable scapy impl, so that should be
# on the python path, or run this from a directory containing that "scapy" dir
from scapy.all import *
packets = rdpcap("pcaps/neohapsis_mptcp_challenge.pcap")
payload_packets = [p for p in packets if TCP in p
and p[IP].src in ("192.168.1.26", "192.168.1.33")
and TCPOption_MP in p
and p[TCPOption_MP].mptcp.subtype == 2
and Raw in p]
f = open("out.jpg", "w")
for p in sorted(payload_packets, key=lambda p: p[TCPOption_MP].mptcp.dsn):
f.write(p.load)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment