问题描述
我正在尝试使用 scapy 使用 ZigBee 协议,但无法正确识别捕获的流量。我创建了以下脚本:
import sys
from scapy.sendrecv import sniff
def pkt_hnd(pkt):
print(pkt.summary())
sniff(offline=sys.stdin.buffer,prn=pkt_hnd,store=0)
我正在向它提供来自 https://github.com/homewsn/whsniff 的数据。但是数据包在 scapy 中似乎被错误地分类为 SixLoWPAN / LoWPANFragmentationFirst / Raw
:
Dot15d4FCS / 802.15.4 Data ( None:0x0 -> 0x2c2b:0xffff ) / SixLoWPAN / LoWPANFragmentationFirst / Raw
为了比较,这是wireshark解析它的方式:
我能否以某种方式告诉 scapy 它应该假设这些数据包中的 ZigBee 流量?
解决方法
目前的解决方案:
import sys
from scapy.sendrecv import sniff
from scapy.config import conf
conf.dot15d4_protocol = "zigbee"
def pkt_hnd(pkt):
print(pkt.summary())
sniff(offline=sys.stdin.buffer,prn=pkt_hnd,store=0)