scapy sniffing ZigBee traffic, does not detect ZigBee layers

636 Views Asked by At

I'm trying to play with ZigBee protocol using scapy, but captured traffic is not properly recognized. I have created following script:

import sys
from scapy.sendrecv import sniff

def pkt_hnd(pkt):
    print(pkt.summary())

sniff(offline=sys.stdin.buffer, prn=pkt_hnd, store=0)

I'm feeding it with data from https://github.com/homewsn/whsniff. But packets seem incorrectly classified in scapy as SixLoWPAN / LoWPANFragmentationFirst / Raw:

Dot15d4FCS / 802.15.4 Data ( None:0x0 -> 0x2c2b:0xffff ) / SixLoWPAN / LoWPANFragmentationFirst / Raw

For comparison this is how it gets parsed by wireshark:

enter image description here

Can I tell scapy somehow that it should assume ZigBee traffic in these packets?

1

There are 1 best solutions below

0
On

I found an answer: https://github.com/secdev/scapy/blob/cfe00d5c952e9048a40150390e0025b5ceff7228/scapy/layers/zigbee.py#L1175

Current solution:

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)