如何解码来自 scapy Dot11 数据包的数据
我正在编写一个捕获 Dot11 数据包用于网络安全测试的程序,在这些捕获的数据包中,我获得如下数据:
I am writing a program that captures Dot11 Packets for network security testing, in these captured packets I get data as in the following for example:
<RadioTap version=0 pad=0 len=36 present=TSFT+Flags+Rate+Channel+dBm_AntSignal+b14+b29+Ext notdecoded=' \x08\x00\x00\x00\x00\x00\x00\xd5~\xbb*\x00\x00\x00\x00\x10\x02\x99\t\xa0\x00\xbd\x00\x00\x00\xbd\x00' |<Dot11 subtype=11L type=Management proto=0L FCfield=retry ID=14849 addr1=48:ee:0c:f4:b7:ea addr2=00:26:82:8e:9a:d4 addr3=48:ee:0c:f4:b7:ea SC=46176 addr4=None |<Dot11Auth algo=open seqnum=1 status=success |<Dot11Elt ID=220 len=46 info='7\x94' |>>>>
我想更好地理解以下内容:
I would like to better understand the part that reads:
\x08\x00\x00\x00\x00\x00\x00\xd5~\xbb*\x00\x00\x00\x00\x10\x02\x99\t\xa0\x00\xbd\x00\x00\x00\xbd\x00
我在许多不同的捕获中获取这些类型的数据包,我希望能够解码"它们以读取数据.有没有办法做到这一点,也许是代码示例?
I get these types of packets in many different captures, I want to be able to 'decode' them to read the data. Is there a way to do this, perhaps a code sample?
我用 scapy 解码 802.11 帧.
I decode 802.11 frames by scapy.
首先,通过终端或 WireShark 捕获 802.11 帧并保存为 pcap 文件.
然后,使用 scapy 解析 pcap 文件:
First, capture 802.11 frames whether by terminal or by WireShark and save as a pcap file.
And then, use scapy to parse the pcap file:
sniff(offline="/tmp/capture_chan11.pcap", prn=parse)
这里的解析"是自定义函数,处理pcap文件中的每一帧,我的是:
"parse" here is a customized function that processes each frame in the pcap file, mine is:
def parse(frame):
if frame.haslayer(Dot11):
print("ToDS:", frame.FCfield & 0b1 != 0)
print("MF:", frame.FCfield & 0b10 != 0)
print("WEP:", frame.FCfield & 0b01000000 != 0)
print("src MAC:", frame.addr2)
print("dest MAC:", frame.addr1)
print("BSSID:", frame.addr3)
print("Duration ID:", frame.ID)
print("Sequence Control:", frame.SC)
print(feature(frame))
print("\n")
查看有关 Dot11 帧属性的更多信息:SCAPY PYTHON - 获取 802.11 DS 状态
See more about Dot11 frame attributions: SCAPY PYTHON - Get 802.11 DS Status