Hi all, I want to export raw hexadecimal values and timestamp of all my selected packets. Unfortunately exporting as "C arrays" does not shows the timestamp and also includes quite annoying ASCII representation. Moreover the exported file is not in a format like "one packet per line". All this makes my life quite difficult trying to tokenize strings with sed and tr... Is there any other option? In the UDP payload of my packets are contained fields of a simple protocol that I defined for research proposes and I need to analyze those fields together with the time stamp. I was considering to create a dissector but, since my lack of experience, it turns to be quite complicated and time consuming for my purpose. To give an example of the output that I'd like to get: This is what I'd like to have:
This is what I currently get exporting in "C Arrays"
Btw, the previous Wireshark version (1.6.11) has a slightly better "C Array" output because it does not show the ASCII part... Is "hexdump" used there? Thanks a million Davide Any help/comment is much appreciated Thanks and regards Davide This question is marked "community wiki". asked 15 Nov '12, 06:42 Davide edited 15 Nov '12, 07:13 |
3 Answers:
Is there any other option? This is the closest thing I know that exists today that might help you:
Using your example, the output will be something like follows:
Note: You probably want to qualify the output by specifying a read filter to only match those packets containing your particular protocol, e.g., answered 15 Nov '12, 11:07 cmaynard ♦♦ edited 15 Nov '12, 11:12 |
Not a direct answer but there are several options for creating a dissector, some are easier (but possibly less flexible) than others:
Personally I've only done 'C' dissectors so I have no idea if the other options are "easier" in some undefinable way. answered 15 Nov '12, 07:30 grahamb ♦ thank you very much. I'll try WSGD (15 Nov '12, 12:12) Davide |
If you just want the HEX dump of the whole packet (or parts of it), tshark/wireshark is probably not the right tool for you, as you don't need any of its packet dissecting capabilities. Please try my perl script instead. Save it as
You can choose to print the whole packet, the IP part or just the UDP payload, by setting the variables print_packet or print_ip or print_udp. The script may not be perfect, but I'm sure you can modify it to your needs ;-)
Sample output:
Regards answered 15 Nov ‘12, 12:56 Kurt Knochner ♦ edited 15 Nov ‘12, 13:00 Many thanks for your script. Unfortunately I couldn’t make it working on my Mac (so far many libs are missing)… I’ll keep it in my todolist anyway. Thanks again (16 Nov ‘12, 07:57) Davide Installing the libs is pretty simple. Run these commands:
After the shell started, type:
Watch for any errors during the installation of the Perl modules. Good luck. (16 Nov '12, 08:19) Kurt Knochner ♦ |
Many thanks, your suggestion is very close to the solution. Unfortunately, wireshark interprets most of my packets as RX protocol (bad luck) and the output -e data is empty.
Only few of them are interpreted as raw UDP Is there a way to tell tshark to interpret every packet as raw UDP?
One more thing: I would prefere to extract the whole raw packet and not just the UDP payload (-e data) otherwise I have to include many other fields as IPv6.src dst port ...
Just a raw hex packet with time stamp would be perfec!
Thanks a million
You could try disabling the IPv[4|6] dissectors in Wireshark first, and then run the
tshark
command. Since those protocols will be disabled, the data "dissector" will include those bytes as part of the output as well. (Wireshark: Analyze -> Enabled Protocols -> deselect the protocols of interest.)Note that the
-R "udp.port eq <your port>"
read filter won't work anymore because the UDP dissector will no longer be called, so you may want to pre-filter the capture file, saving only your packets to a separate capture file and then work with that file.This works like a charm. I disabled all protocol dissectors and used tshark to print timestamp and raw data as you suggested.
Thanks a million!