Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# 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