Last active
April 23, 2021 08:18
-
-
Save ph1ee/e1e365cde2a3ea99967723215fac22ea to your computer and use it in GitHub Desktop.
Remove the exported PDU layer and replace the IPv6 source/destination addresses from a pcap file
This file contains 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 python3 | |
import sys | |
from scapy.utils import rdpcap, wrpcap | |
from scapy.all import IPv6, UDP | |
def main(): | |
packets = [] | |
for exported_pdu in rdpcap(sys.argv[1]): | |
pkt = IPv6(exported_pdu.load[52:]) | |
pkt.time = exported_pdu.time | |
pkt[IPv6].src = sys.argv[3] | |
pkt[IPv6].dst = sys.argv[4] | |
del pkt[IPv6][UDP].chksum | |
packets.append(pkt) | |
wrpcap(sys.argv[2], packets) | |
sys.exit(0) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment