Getting started
IEEE 802.15.4 wireless protocol is widely used by some well-known protocols such as ZigBee, RF4CE or 6LoWPAN.
WHAD provides a basic connector, whad.dot15d4.connector.Dot15d4
, to
handle IEEE 802.15.4 communications.
Sniffing packets
The whad.dot15d4.connector.sniffer.Sniffer
connector provides sniffing
capability for IEEE 802.15.4 packets. All we have to do is simply set the
channel and sniff packets:
from whad.device import WhadDevice
from whad.dot15d4 import Sniffer
# Create a compatible device instance
device = WhadDevice.create("uart0")
# Use a sniffer connector
sniffer = Sniffer(device)
# Set channel
sniffer.channel = 11
# Listen for packets
for packet in sniffer.sniff():
packet.show()
Sending packets
Sending IEEE 802.15.4 packets is as easy as it sounds, simply use the
whad.dot15d4.connector.Dot15d4.send()
as follows:
from whad.device import WhadDevice
from whad.dot15d4 import Sniffer
# Create a compatible device instance
device = WhadDevice.create("uart0")
# Use a default Dot15d4 connector
connector = Dot15d4(device)
# Send 802.15.4 packet
connector.send(b"Hello World !")