Archive for February 19th, 2007

Radiotap parser for Python

Here’s a little bit of code I wrote recently to parse Radiotap headers in Python. It’s pretty simple, you get two methods, get_length(buf) and parse(buf).

get_length(buf) takes a string holding a radiotap header and returns the recorded length of the radiotap header. Use this method to determine where the next protocol header starts in your buffer.

parse(buf) takes the same string and returns a dictionary mapping the RTAP_* constants defined in the radiotap module to the values recorded in the radiotap header. This dictionary will only contain the keys that are present in the radiotap header, so you can use things like has_key(radiotap.RTAP_ANTENNA) to see if the radiotap header contained antenna information.

Just note that all values are passed back as they are read, so they will all be little-endian, as this is what Radiotap is encoded in.

radiotap parser for python.

1 comment February 19th, 2007


Calendar

February 2007
M T W T F S S
« Jan   Mar »
 1234
567891011
12131415161718
19202122232425
262728  

Posts by Month

Posts by Category