Skip to content

Instantly share code, notes, and snippets.

@MarkBaggett
MarkBaggett / scapy_helper.py
Last active Aug 24, 2021
Python - SCAPY - Full Packet Session Reassembly
View scapy_helper.py
#From here https://pen-testing.sans.org/blog/2017/10/13/scapy-full-duplex-stream-reassembly
def full_duplex(p):
sess = "Other"
if 'Ether' in p:
if 'IP' in p:
if 'TCP' in p:
sess = str(sorted(["TCP", p[IP].src, p[TCP].sport, p[IP].dst, p[TCP].dport],key=str))
elif 'UDP' in p:
sess = str(sorted(["UDP", p[IP].src, p[UDP].sport, p[IP].dst, p[UDP].dport] ,key=str))