kbandla / dpkt

fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols
Other
1.09k stars 270 forks source link

Extracting tagged parameters (e.g., HT capabilities) using dpkt #475

Open ghost opened 4 years ago

ghost commented 4 years ago

I would like to extract tagged parameters (e.g., HT capabilities) using dpkt.

image

I'm trying to make a python code for reading and saving the red one.

import dpkt
import socket

r = b"\x00\x00\x18\x00.@\x00\xa0 \x08\x00\x00\x00\x0b\x85\t\xa0\x00\xa5\x00\x00\x00\xa5\x00\x80\x00\x00\x00\xff\xff\xff\xff\xff\xff\x80\xe8o\xd9\x06\xa0\x80\xe8o\xd9\x06\xa0\xe0\xd0\x8e\xe1*\x02\x11\x05\x00\x00d\x001\x04\x00\nWUNIST_AAA\x01\x08\x8b\x96\x0c\x12\x18$0H\x03\x01\x06\x05\x04\x00\x01\x00\x00\x07\x06KR \x01\r\x14*\x01\x002\x02`l\x0b\x05\x00\x00\x93\x8d[-\x1a\xad\t\x03\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x000\x14\x01\x00\x00\x0f\xac\x04\x01\x00\x00\x0f\xac\x04\x01\x00\x00\x0f\xac\x01(\x00=\x16\x06\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x08\x00\x10\x00\x00\x00\x00\x00\x00\xdd\x18\x00P\xf2\x02\x01\x01\x8c\x00\x03\xa4\x00\x00'\xa4\x00\x00BC^\x00b2/\x00\x85\x1e\x00\x00\x8f\x00\x0f\x00\xff\x03@\x00110-10F-12\x00\x00\x00\x00\x00\x00\x00\x00\x00-"

packet = dpkt.radiotap.Radiotap(r)
packet_signal = -(256 - packet.ant_sig.db)  # dBm
frame = packet.data

I have found many functions in dpkt, but there is no functions related to the contents of the tagged parameters (e.g., HT capabilities, extended capabilities, etc.,). For example, packet_signal = -(256 - packet.ant_sig.db) would be used for extracting RSSI.

Is it possible to abstract them using dpkt?