如何解码来自 scapy Dot11 数据包的数据 [英] How to decode data from scapy Dot11 Packet

查看:177
本文介绍了如何解码来自 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

这篇关于如何解码来自 scapy Dot11 数据包的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆