Hi All, In brief, what I have:
What I want to do:
Essentially it is the same conversion performed by Wiresharks "Follow UDP Stream", but the data volume is too high to use that feature. I noticed a couple of other threads dealing with this or similar issues: https://ask.wireshark.org/questions/38998/automating-extraction-of-udp-payload-from-pcap-file/ https://ask.wireshark.org/questions/15374/dump-raw-packet-data-field-only/ but I feel I am missing something, it seems the data has to go to ASCII first? Rather than straight to binary. With such large volumes of data, I was hoping there might be a perl or python trick out there to help batch this job. I'm not that familiar with PERL, but I have started looking into the Net::Pcap libraries. I have no use for the additional packet info/stats collected by dumpcap, so in hindsight I probably would have been better off coding up a simple bit of software to receive and record the UDP data of interest directly, but it's a bit late for that now. Any further tips greatly appreciated. asked 03 Nov '15, 05:49 kevenofnine edited 03 Nov '15, 06:15 Jasper ♦♦ |
One Answer:
Please take a look at my perl code in a similar question. Maybe you can use it as a starting point.
Instead of printing the hex representation of the UDP payload, you could write it to a binary file. ++UPDATE++ So, the code could look like this (works on my systems). BTW: Net::Pcap will be able to read the pcap format by default. It will be able to alo read pcap-ng, if the version of libpacap on your system does support it, otherwise you will get an error message ("FATAL: cannot open 47183.pcapng -> ERROR: bad dump file format")
My script writes only the payload of one direction to the file (it looks for destination port), as it won’t make much sense to mix data of both directions, packet by packet, into the binary output file. If you need something different, please adjust the script to your needs. Regards answered 03 Nov ‘15, 07:13 Kurt Knochner ♦ edited 03 Nov ‘15, 12:03 |