Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zigpy packet capture interface #54

Merged
merged 10 commits into from
Jan 23, 2025

Conversation

puddly
Copy link
Contributor

@puddly puddly commented Jan 22, 2025

Implementation of zigpy/bellows#664 + zigpy/zigpy#1537.

The main improvement over bellows dump is that we use the LINKTYPE_IEEE802_15_4_TAP link type, which includes RSSI, LQI, and channel metadata:

image

Sample usage:

zigpy radio \
    --baudrate 57600 \
    ezsp /dev/cu.GoControl_zigbee* \
    packet-capture \
    --channels 11,15,20,25 \
    --channel-hop-period 1.0 \
    --channel-hop-randomly \
    -o - | wireshark -k -S -i -

The channel hopping options can be ignored if a single channel is provided.

To facilitate whole-spectrum sniffing (if you have enough adapters 😄), I've added an --interleave command and a second command to combine them:

(
    zigpy radio ezsp /dev/cu.SLAB_USBtoUART   packet-capture -c 11 --interleave -o -  &
    zigpy radio ezsp /dev/cu.SLAB_USBtoUART8  packet-capture -c 15 --interleave -o -  &
    zigpy radio ezsp /dev/cu.SLAB_USBtoUART10 packet-capture -c 20 --interleave -o -  &
    zigpy radio ezsp /dev/cu.SLAB_USBtoUART13 packet-capture -c 25 --interleave -o -  &
    zigpy radio ezsp /dev/cu.SLAB_USBtoUART14 packet-capture -c 12,13,14,26 --interleave --channel-hop-period 1 -o -  &
    zigpy radio ezsp /dev/cu.SLAB_USBtoUART17 packet-capture -c 16,17,18,19 --interleave --channel-hop-period 1 -o -  &
    zigpy radio ezsp /dev/cu.SLAB_USBtoUART18 packet-capture -c 21,22,23,24 --interleave --channel-hop-period 1 -o -  &
    wait
) | zigpy pcap interleave-combine -o - | wireshark -k -S -i -

This allows you to scan all of the ZLL channels at once and show the results in Wireshark:

image

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 5.61798% with 84 lines in your changes missing coverage. Please review.

Project coverage is 2.75%. Comparing base (ab58a1b) to head (87def10).
Report is 2 commits behind head on dev.

Files with missing lines Patch % Lines
zigpy_cli/radio.py 0.00% 42 Missing ⚠️
zigpy_cli/helpers.py 0.00% 20 Missing ⚠️
zigpy_cli/pcap.py 0.00% 16 Missing ⚠️
zigpy_cli/common.py 45.45% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             dev     #54      +/-   ##
========================================
+ Coverage   2.23%   2.75%   +0.52%     
========================================
  Files          8       9       +1     
  Lines        492     580      +88     
========================================
+ Hits          11      16       +5     
- Misses       481     564      +83     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@puddly puddly marked this pull request as ready for review January 23, 2025 00:46
@puddly puddly merged commit 2f7eec1 into zigpy:dev Jan 23, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant