Hi , As we already have a 3gpp decoder by wireshark to decode 3gpp messages, I need to call this decoder in my python script to decode a hex dump provided to the program as an input and write the decoded result in a text file. Is there any API for this decoder to use or any other way to do this? asked 20 Apr '16, 05:43 shayaan_xd |
One Answer:
I would say your best bet is to create a pcap file from the hex data and then use tshark to convert the pcap file into a text file containing dissections of the packets. If you have the hex records offline, there is text2pcap which does the first step (hex -> pcap) for you on the command line, or you can do the same using Wireshark (the GUI version). If you need to receive and process the hex records live as they come in (which does not seem likely as the required final product is a text file), you'd need to feed text2pcap from a pipe and send its output to tshark using another pipe, and I'm not sure whether this is actually possible. So you might have to replace text2pcap by your Python script doing the same. When capturing from a named pipe, tshark needs the data in pcap format, so you'd have to generate the pcap file header once and then convert the received hex dumps into binary packet data with timestamps. It is not a big deal as the pcap file structure is not complex and it is well documented. answered 20 Apr '16, 07:55 sindy |
Thanks sindy, Can you simplify it more ? I have 100's of hex and i need information of 2 Information elements out of them from each hex.
In concept:
Aside from that answer you might also consider 'pyshark' instead of the tshark system calls (a python plugin for use of these tools within python).