Created
October 24, 2022 09:42
-
-
Save emanuelduss/38420a7c6cc2b6fe57971805941c5b77 to your computer and use it in GitHub Desktop.
Extract UDP Data from 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 python3 | |
| from scapy.all import * | |
| inputfile = 'input.pcapng' | |
| outputfile = 'output.raw' | |
| serveraddr = '10.5.23.42' | |
| sourceport = 2323 | |
| file = open(outputfile, "wb") | |
| for packet in PcapReader(inputfile): | |
| if UDP in packet and packet.payload.src == serveraddr and packet.payload.payload.sport == sourceport: | |
| file.write(packet.payload.payload.payload.load) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment