For my purposes, I record packets sent from radios stations that tell me their GPS position. The provider sometimes packages up 4 radio station reports into 1 packet. Basically, all the reports are exactly the same in terms of data, except for one or two fields where its ID# and position are different. All 4 reports are assembled and sent in one packet. I can easily decode and see the 4 distinct reports in that one packet while in the Wireshark GUI. When I dump this to CSV format using
I get one line of beautiful data showing all the values for each field for the first/last report. But if I say to give me ALL, it gives me each field from every report bunched together in a comma-separated format, all on one line as per the If I can get the first report or last report to print correctly using the I hope someone can follow along with what I am saying. I certainly appreciate any help. I'm assuming from how the documentation specifically states about printing multiple items at once for a single field that there is no workaround? UPDATE: I uploaded a sample to cloudshark.org. My packet of concern is the first packet for port 59951 and is 412 bytes long. There are actually 8 separate reports in this packet from 8 different radio stations. Wireshark might/will think it's a PROFINET-TIME protocol, which it's not. I have my own dissector for this for it's not this protocol. I can see all 8 reports fine in the GUI. My
As I stated earlier, if I strip out the first report or last report of a packet, they come out great in I can list what the expected output is versus the actual output, if needed. Here's the packet in Wireshark with my decoder clearly showing there are 8 reports within the packet. When I dump through asked 23 May '12, 09:11 Mike_P edited 23 May '12, 12:32 helloworld showing 5 of 12 show 7 more comments |
3 Answers:
O.K. now I understand what you are looking for: With "-E occurrence=a" the output looks like this:
while you would like to have it in this format (with reduced number of lines)
Unfortunately, this is not possible with the current version of wireshark, as the field print function just adds several instances separated by the "aggregator" character. So, to solve your problem, you would have to script something with perl (or a similar scripting language). Here's a Perl solution:
Code:
Output Sample:
Regards answered 23 May ‘12, 12:09 Kurt Knochner ♦ edited 25 May ‘12, 03:31 I tried using this Perl code, but it gives me it one value per line unlike your sample output above. I’m not at all familiar with Perl, so I have no idea what I should tweak to fix it. I’m grateful you even included any sample code and I realize there was no guarantee it would work. Any ideas? (31 May ‘12, 10:08) Mike_P
Can you please upload the input for the perl script somewhere (One Click Hoster)? FURTHERMORE: I recommend to use the Lua script posted by helloworld. It does not need additional software on the computer and it’s much easier to understand. However, you need to extend it with all your fields, as the posted script is just a example (a working one)! (31 May ‘12, 10:26) Kurt Knochner ♦ |
You can use Wireshark's Lua API to print info similar to test.lua:
Usage:
This command assumes answered 23 May ‘12, 13:52 helloworld edited 24 May ‘12, 04:01 the lua code works pretty well. However, tshark will print it’s default output after the listener output for every frame. Can I suppress the default output? One option would be to print a field (-T fields) that is not available in the capture file. Are there better ways? (24 May ‘12, 01:25) Kurt Knochner ♦ Yes, the (24 May ‘12, 04:02) helloworld sometimes, the obvious things are hard to find :-) (24 May ‘12, 04:27) Kurt Knochner ♦ …and easy to forget ;) (24 May ‘12, 04:47) helloworld |
Nope, there is no workaround for this (apart from changing the code). But you can always use 'tshark -V' to get the whole tree. Or (even more bloated) 'tshark -T pdml' to get the XML output, which will be easier to parse. answered 23 May '12, 12:10 SYN-bit ♦♦ Thank you gentlemen!! I was thinking this was going to be the answer as the documentation states this is how its designed to work. I was just hoping I was missing some secret switch to get around it. :) I thank you for looking into this situation and promptly getting me a definitive answer. (23 May '12, 12:12) Mike_P |
What is the field you are extracting with tshark? Can you please post the whole tshark command?
BTW: can you post a small sample (3-4 packets) on cloudshark.org?
Based on the screenhot, you do have a dissector for ADS-B (Automatic Dependent Surveillance Broadcast). However, that code is not part of the official release, at least I cannot find it. Did you write that dissector yourself?
Yes. I wrote it. Outside of my industry, I can't imagine anyone would be have any interest in dissecting these packets.
O.K., but without that dissector, nobody would be able to do any tests with your data ;-)) Can you provide that dissector?
No problem. Its done in x86 or x64 Windows. How do I get the dll to you?
upload it to http://depositfiles.com/ and post the download link here. HINT: save the delete link as well. You will be able to delete the file later with that link.
http://depositfiles.com/files/orgsmiyl5
I'll check it and I'll be back (I allways wanted to say that ;-))
Already, I thank you for your patience and efforts!!!
unlike your screenshot, there is only one ADS-B report in the sample capture.
Do you mean 1 report in all 5 packets? Or you only see 1 report in the first packet? As you can see in my screen shot for the 1st packet, I expanded the Automatic Dependent Surveillance-Broadcast Protocol tree and inside are 8 reports. That's how its normally suppose to display. You don't see this when you run it with the dissector?
I had to DISABLE the PN-RT protocol under Analyze > Protocols on my local Wireshark to get my dissector to display correctly.
O.K. that solved the problem. Hold on I'm looking at the data right now.