Created
July 26, 2017 15:16
-
-
Save alem0lars/ca034b0644cf2512cbfb8a03b3388111 to your computer and use it in GitHub Desktop.
Remove payload from a pcap (useful to fully anonymize a pcap)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python2 | |
from scapy.all import * | |
import sys | |
INFILE = sys.argv[1] | |
OUTFILE = sys.argv[2] | |
with PcapWriter(OUTFILE) as dest: | |
with PcapReader(INFILE) as infile: | |
for pkt in infile: | |
if TCP in pkt: | |
pkt[TCP].remove_payload() | |
elif UDP in pkt: | |
pkt[UDP].remove_payload() | |
dest.write(pkt) |
jcoffland
commented
Jun 5, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment