├── vcpkg.json
├── tests
├── ui
│ ├── tests.txt
│ ├── emf2022-badge
│ │ └── actions.json
│ ├── split-poll-step
│ │ └── actions.json
│ └── mouse-step
│ │ └── actions.json
├── bad-crcs
│ ├── devices-reference.txt
│ ├── capture.pcap
│ └── reference.txt
├── double-setup
│ ├── devices-reference.txt
│ ├── capture.pcap
│ └── reference.txt
├── split-poll
│ ├── devices-reference.txt
│ ├── capture.pcap
│ └── reference.txt
├── iso-ambiguous
│ ├── devices-reference.txt
│ ├── capture.pcap
│ └── reference.txt
├── hackrf-restart-failure
│ ├── devices-reference.txt
│ └── capture.pcap
├── mouse
│ ├── capture.pcap
│ └── devices-reference.txt
├── hid
│ ├── amp
│ │ ├── descriptor.bin
│ │ └── reference.txt
│ ├── hub
│ │ ├── descriptor.bin
│ │ └── reference.txt
│ ├── ps5
│ │ ├── descriptor.bin
│ │ └── reference.txt
│ ├── kvm-0
│ │ ├── descriptor.bin
│ │ └── reference.txt
│ ├── kvm-1
│ │ ├── descriptor.bin
│ │ └── reference.txt
│ ├── mouse
│ │ ├── descriptor.bin
│ │ └── reference.txt
│ ├── headset
│ │ ├── descriptor.bin
│ │ └── reference.txt
│ ├── tests.txt
│ ├── keyboard-0
│ │ ├── descriptor.bin
│ │ └── reference.txt
│ └── keyboard-1
│ │ ├── descriptor.bin
│ │ └── reference.txt
├── split-enum
│ ├── capture.pcap
│ └── devices-reference.txt
├── split-nyet
│ └── capture.pcap
├── address-reuse
│ └── capture.pcap
├── emf2022-badge
│ └── capture.pcap
├── hackrf-connect
│ ├── capture.pcap
│ └── devices-reference.txt
├── hackrf-dfu-enum
│ ├── capture.pcap
│ └── devices-reference.txt
├── iso-unambiguous
│ └── capture.pcap
├── ksolti-core-enum
│ └── capture.pcap
├── bad-descriptor-length
│ ├── capture.pcap
│ ├── reference.txt
│ └── devices-reference.txt
├── analyzer-test-bad-cable
│ ├── capture.pcap
│ └── devices-reference.txt
├── ls-keepalive-divided-transaction
│ ├── capture.pcapng
│ └── devices-reference.txt
├── ls-keepalive-more-divided-transactions
│ ├── capture.pcapng
│ └── devices-reference.txt
└── tests.txt
├── screenshot.png
├── appimage
├── dist
│ ├── icon.png
│ └── packetry.desktop
├── docker
│ └── patches
│ │ ├── gtk-4.14.4-pin-libsass.patch
│ │ ├── gtk-4.14.4-pin-sysprof.patch
│ │ ├── gtk-4.14.4-pin-fribidi.patch
│ │ ├── gtk-4.14.4-pin-gi-docgen.patch
│ │ ├── gtk-4.14.4-pin-pango.patch
│ │ └── gtk-4.14.4-gcc-lt-9.patch
├── packetry.AppDir
│ └── usr
│ │ └── share
│ │ └── doc
│ │ ├── libgraphene-1.0-0
│ │ └── copyright
│ │ ├── libglib2.0-0
│ │ └── copyright
│ │ └── libgdk-pixbuf-2.0-0
│ │ └── copyright
└── action.yml
├── docs
├── images
│ ├── action-bar.png
│ ├── detail-pane.png
│ ├── device-pane.png
│ ├── power-menu.png
│ ├── status-bar.png
│ ├── packetry-window.png
│ ├── traffic-pane-packets.png
│ ├── traffic-pane-hierarchical.png
│ └── traffic-pane-transactions.png
├── requirements.txt
├── source
│ ├── index.rst
│ ├── what_is_packetry.rst
│ ├── conf.py
│ ├── keyboard_shortcuts_macos.rst
│ ├── keyboard_shortcuts_linux_windows.rst
│ └── user_interface.rst
├── Makefile
└── make.bat
├── src
├── build.rs
├── database
│ ├── mod.rs
│ └── counter.rs
├── ui
│ ├── capture.rs
│ ├── settings.rs
│ ├── row_data.rs
│ ├── item_widget.rs
│ ├── item_connector.rs
│ └── power.rs
├── util
│ ├── rcu.rs
│ ├── id.rs
│ ├── vec_map.rs
│ ├── mod.rs
│ └── dump.rs
├── fuzzer.rs
├── cli.rs
├── version.rs
├── backend
│ └── transfer_queue.rs
├── main.rs
└── event.rs
├── .gitignore
├── .readthedocs.yaml
├── wix
├── manual-licenses
│ ├── LICENSE-derive-into-owned-0.2.0.txt
│ ├── LICENSE-ndk-context-0.1.1.txt
│ ├── LICENSE-convert_case-0.4.0.txt
│ ├── LICENSE-malloc_buf-0.0.6.txt
│ ├── LICENSE-byteorder_slice-3.0.0.txt
│ ├── LICENSE-kernel32-sys-0.2.2.txt
│ ├── LICENSE-winapi-build-0.1.1.txt
│ ├── LICENSE-ws2_32-sys-0.2.1.txt
│ ├── LICENSE-dark-light-1.1.1.txt
│ ├── LICENSE-winapi-i686-pc-windows-gnu-0.4.0.txt
│ ├── LICENSE-winapi-x86_64-pc-windows-gnu-0.4.0.txt
│ ├── LICENSE-merge_derive-0.1.0.txt
│ ├── LICENSE-logwise_proc-0.1.1.txt
│ └── LICENSE-ryu-1.0.18.txt
├── generate_components.py
├── required-dlls.txt
├── vcpkg_licenses.py
└── rust_licenses.py
├── LICENSE
├── README.md
├── CHANGELOG.md
├── Cargo.toml
├── CODE_OF_CONDUCT.md
└── .github
└── workflows
└── appimage.yml
/vcpkg.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": ["gtk", "pkgconf"]
3 | }
4 |
--------------------------------------------------------------------------------
/tests/ui/tests.txt:
--------------------------------------------------------------------------------
1 | emf2022-badge
2 | mouse-step
3 | split-poll-step
4 |
--------------------------------------------------------------------------------
/tests/bad-crcs/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 7: Unknown
2 | No device descriptor
3 |
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/screenshot.png
--------------------------------------------------------------------------------
/tests/double-setup/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 43: Unknown
2 | No device descriptor
3 |
--------------------------------------------------------------------------------
/tests/split-poll/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 14: Unknown
2 | No device descriptor
3 |
--------------------------------------------------------------------------------
/tests/iso-ambiguous/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 27: Unknown
2 | No device descriptor
3 |
--------------------------------------------------------------------------------
/tests/hackrf-restart-failure/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 7: Unknown
2 | No device descriptor
3 |
--------------------------------------------------------------------------------
/appimage/dist/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/appimage/dist/icon.png
--------------------------------------------------------------------------------
/tests/mouse/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/mouse/capture.pcap
--------------------------------------------------------------------------------
/docs/images/action-bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/docs/images/action-bar.png
--------------------------------------------------------------------------------
/docs/images/detail-pane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/docs/images/detail-pane.png
--------------------------------------------------------------------------------
/docs/images/device-pane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/docs/images/device-pane.png
--------------------------------------------------------------------------------
/docs/images/power-menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/docs/images/power-menu.png
--------------------------------------------------------------------------------
/docs/images/status-bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/docs/images/status-bar.png
--------------------------------------------------------------------------------
/tests/bad-crcs/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/bad-crcs/capture.pcap
--------------------------------------------------------------------------------
/tests/hid/amp/descriptor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hid/amp/descriptor.bin
--------------------------------------------------------------------------------
/tests/hid/hub/descriptor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hid/hub/descriptor.bin
--------------------------------------------------------------------------------
/tests/hid/ps5/descriptor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hid/ps5/descriptor.bin
--------------------------------------------------------------------------------
/tests/hid/kvm-0/descriptor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hid/kvm-0/descriptor.bin
--------------------------------------------------------------------------------
/tests/hid/kvm-1/descriptor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hid/kvm-1/descriptor.bin
--------------------------------------------------------------------------------
/tests/hid/mouse/descriptor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hid/mouse/descriptor.bin
--------------------------------------------------------------------------------
/tests/split-enum/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/split-enum/capture.pcap
--------------------------------------------------------------------------------
/tests/split-nyet/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/split-nyet/capture.pcap
--------------------------------------------------------------------------------
/tests/split-poll/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/split-poll/capture.pcap
--------------------------------------------------------------------------------
/docs/images/packetry-window.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/docs/images/packetry-window.png
--------------------------------------------------------------------------------
/tests/address-reuse/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/address-reuse/capture.pcap
--------------------------------------------------------------------------------
/tests/double-setup/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/double-setup/capture.pcap
--------------------------------------------------------------------------------
/tests/emf2022-badge/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/emf2022-badge/capture.pcap
--------------------------------------------------------------------------------
/tests/hackrf-connect/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hackrf-connect/capture.pcap
--------------------------------------------------------------------------------
/tests/hid/headset/descriptor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hid/headset/descriptor.bin
--------------------------------------------------------------------------------
/tests/hid/tests.txt:
--------------------------------------------------------------------------------
1 | amp
2 | headset
3 | hub
4 | keyboard-0
5 | keyboard-1
6 | kvm-0
7 | kvm-1
8 | mouse
9 | ps5
10 |
--------------------------------------------------------------------------------
/tests/iso-ambiguous/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/iso-ambiguous/capture.pcap
--------------------------------------------------------------------------------
/tests/hackrf-dfu-enum/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hackrf-dfu-enum/capture.pcap
--------------------------------------------------------------------------------
/tests/hid/keyboard-0/descriptor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hid/keyboard-0/descriptor.bin
--------------------------------------------------------------------------------
/tests/hid/keyboard-1/descriptor.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hid/keyboard-1/descriptor.bin
--------------------------------------------------------------------------------
/tests/iso-unambiguous/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/iso-unambiguous/capture.pcap
--------------------------------------------------------------------------------
/tests/ksolti-core-enum/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/ksolti-core-enum/capture.pcap
--------------------------------------------------------------------------------
/docs/images/traffic-pane-packets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/docs/images/traffic-pane-packets.png
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | sphinx==7.2.6
2 | sphinx_rtd_theme==2.0.0
3 | readthedocs-sphinx-search==0.3.2
4 | sphinx-inline-tabs==2023.4.21
5 |
--------------------------------------------------------------------------------
/tests/bad-descriptor-length/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/bad-descriptor-length/capture.pcap
--------------------------------------------------------------------------------
/docs/images/traffic-pane-hierarchical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/docs/images/traffic-pane-hierarchical.png
--------------------------------------------------------------------------------
/docs/images/traffic-pane-transactions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/docs/images/traffic-pane-transactions.png
--------------------------------------------------------------------------------
/tests/analyzer-test-bad-cable/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/analyzer-test-bad-cable/capture.pcap
--------------------------------------------------------------------------------
/tests/hackrf-restart-failure/capture.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/hackrf-restart-failure/capture.pcap
--------------------------------------------------------------------------------
/src/build.rs:
--------------------------------------------------------------------------------
1 | //! Code to be executed at build time.
2 |
3 | fn main() {
4 | built::write_built_file().expect("Failed to acquire build-time information");
5 | }
6 |
--------------------------------------------------------------------------------
/tests/ls-keepalive-divided-transaction/capture.pcapng:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/ls-keepalive-divided-transaction/capture.pcapng
--------------------------------------------------------------------------------
/appimage/dist/packetry.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=packetry
3 | Exec=packetry
4 | Icon=icon
5 | Type=Application
6 | Categories=Utility;
7 | X-AppImage-Version=0.1.0
8 |
--------------------------------------------------------------------------------
/tests/ls-keepalive-more-divided-transactions/capture.pcapng:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greatscottgadgets/packetry/HEAD/tests/ls-keepalive-more-divided-transactions/capture.pcapng
--------------------------------------------------------------------------------
/tests/hid/hub/reference.txt:
--------------------------------------------------------------------------------
1 |
2 | ○ Input report (64 bytes):
3 | └── Array of 64 buttons: bytes 0-63 [Vendor Usage 0x01 — Vendor Usage 0x40]
4 |
5 | ○ Output report (64 bytes):
6 | └── Array of 64 buttons: bytes 0-63 [Vendor Usage 0x01 — Vendor Usage 0x40]
7 |
--------------------------------------------------------------------------------
/tests/hid/keyboard-1/reference.txt:
--------------------------------------------------------------------------------
1 |
2 | ○ Input report #3 (3 bytes):
3 | └── Array of 1 button: bytes 1-2 [Pointer — System Display Toggle LCD Autoscale]
4 |
5 | ○ Input report #4 (3 bytes):
6 | └── Array of 1 button: bytes 1-2 [Consumer Control — AC Soft Key Left]
7 |
--------------------------------------------------------------------------------
/tests/tests.txt:
--------------------------------------------------------------------------------
1 | address-reuse
2 | analyzer-test-bad-cable
3 | bad-crcs
4 | bad-descriptor-length
5 | double-setup
6 | emf2022-badge
7 | hackrf-connect
8 | hackrf-dfu-enum
9 | hackrf-restart-failure
10 | iso-ambiguous
11 | iso-unambiguous
12 | ksolti-core-enum
13 | ls-keepalive-more-divided-transactions
14 | ls-keepalive-divided-transaction
15 | mouse
16 | split-enum
17 | split-poll
18 |
--------------------------------------------------------------------------------
/docs/source/index.rst:
--------------------------------------------------------------------------------
1 | ======================
2 | Packetry Documentation
3 | ======================
4 |
5 | .. toctree::
6 | :maxdepth: 2
7 | :caption: Introduction
8 |
9 | what_is_packetry
10 | user_interface
11 | keyboard_shortcuts_linux_windows
12 | keyboard_shortcuts_macos
13 |
14 | .. toctree::
15 | :maxdepth: 2
16 | :caption: Quick Start
17 |
18 | quick_start
19 |
--------------------------------------------------------------------------------
/appimage/docker/patches/gtk-4.14.4-pin-libsass.patch:
--------------------------------------------------------------------------------
1 | diff --git a/subprojects/libsass.wrap b/subprojects/libsass.wrap
2 | index 0e52fb4..3507404 100644
3 | --- a/subprojects/libsass.wrap
4 | +++ b/subprojects/libsass.wrap
5 | @@ -1,5 +1,5 @@
6 | [wrap-git]
7 | directory=libsass
8 | url=https://github.com/lazka/libsass.git
9 | -revision=meson
10 | +revision=aac79dccd3c8f7e8f22125f87a119f3b1ee9d487
11 | depth=1
12 |
--------------------------------------------------------------------------------
/appimage/docker/patches/gtk-4.14.4-pin-sysprof.patch:
--------------------------------------------------------------------------------
1 | diff --git a/subprojects/sysprof.wrap b/subprojects/sysprof.wrap
2 | index 29dcbdc..04daedd 100644
3 | --- a/subprojects/sysprof.wrap
4 | +++ b/subprojects/sysprof.wrap
5 | @@ -1,7 +1,7 @@
6 | [wrap-git]
7 | directory = sysprof
8 | url = https://gitlab.gnome.org/GNOME/sysprof.git
9 | -revision = master
10 | +revision = 47.2
11 | depth = 1
12 |
13 | [provide]
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /docs/build/
2 | /target
3 | /tests/*/dump
4 | /tests/*/output.txt
5 | /tests/*/devices-output.txt
6 | /tests/ui/*/output.txt
7 | /tests/hid/*/output.txt
8 | /vcpkg
9 | /wix/LICENSE-dynamic-libraries.txt
10 | /wix/LICENSE-packetry.txt
11 | /wix/LICENSE-static-libraries.txt
12 | /wix/dll-components.wxi
13 | /wix/dll-references.wxi
14 | /wix/full-licenses
15 | /wix/license-components.wxi
16 | /wix/license-references.wxi
17 | HITL-*.pcap
18 |
--------------------------------------------------------------------------------
/appimage/docker/patches/gtk-4.14.4-pin-fribidi.patch:
--------------------------------------------------------------------------------
1 | diff --git a/subprojects/fribidi.wrap b/subprojects/fribidi.wrap
2 | index 20ba8ed..7ea197e 100644
3 | --- a/subprojects/fribidi.wrap
4 | +++ b/subprojects/fribidi.wrap
5 | @@ -2,7 +2,7 @@
6 | directory = fribidi
7 | url = https://github.com/fribidi/fribidi.git
8 | push-url = git@github.com:fribidi/fribidi.git
9 | -revision = master
10 | +revision = v1.0.16
11 | depth = 1
12 |
13 | [provide]
14 |
--------------------------------------------------------------------------------
/tests/hid/mouse/reference.txt:
--------------------------------------------------------------------------------
1 |
2 | ○ Input report #1 (7 bytes):
3 | ├── Button 1: byte 1 bit 0
4 | ├── Button 2: byte 1 bit 1
5 | ├── Button 3: byte 1 bit 2
6 | ├── Button 4: byte 1 bit 3
7 | ├── Button 5: byte 1 bit 4
8 | ├── Padding: byte 1 bits 5-7
9 | ├── X: byte 2 bit 0 — byte 3 bit 3 (values -2047 to 2047)
10 | ├── Y: byte 3 bit 4 — byte 4 bit 7 (values -2047 to 2047)
11 | ├── Wheel: byte 5 (values -127 to 127)
12 | └── AC Pan: byte 6 (values -127 to 127)
13 |
--------------------------------------------------------------------------------
/appimage/docker/patches/gtk-4.14.4-pin-gi-docgen.patch:
--------------------------------------------------------------------------------
1 | diff --git a/subprojects/gi-docgen.wrap b/subprojects/gi-docgen.wrap
2 | index 85c85da..2d71071 100644
3 | --- a/subprojects/gi-docgen.wrap
4 | +++ b/subprojects/gi-docgen.wrap
5 | @@ -2,7 +2,7 @@
6 | directory = gi-docgen
7 | url = https://gitlab.gnome.org/GNOME/gi-docgen.git
8 | push-url = ssh://git@ssh.gitlab.gnome.org:GNOME/gi-docgen.git
9 | -revision = main
10 | +revision = 2025.3
11 | depth = 1
12 |
13 | [provide]
14 |
--------------------------------------------------------------------------------
/tests/hid/kvm-1/reference.txt:
--------------------------------------------------------------------------------
1 |
2 | ○ Input report #1 (5 bytes):
3 | ├── Button 1: byte 1 bit 0
4 | ├── Button 2: byte 1 bit 1
5 | ├── Button 3: byte 1 bit 2
6 | ├── Button 4: byte 1 bit 3
7 | ├── Button 5: byte 1 bit 4
8 | ├── Padding: byte 1 bits 5-7
9 | ├── X: byte 2 (values -127 to 127)
10 | ├── Y: byte 3 (values -127 to 127)
11 | └── Wheel: byte 4 (values -127 to 127)
12 |
13 | ○ Input report #2 (2 bytes):
14 | ├── System Power Down: byte 1 bit 0
15 | ├── System Sleep: byte 1 bit 1
16 | ├── System Wake Up: byte 1 bit 2
17 | └── Padding: byte 1 bits 3-7
18 |
--------------------------------------------------------------------------------
/.readthedocs.yaml:
--------------------------------------------------------------------------------
1 | # .readthedocs.yaml
2 | # Read the Docs configuration file
3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4 |
5 | # Required
6 | version: 2
7 |
8 | # Set the OS, Python version and other tools
9 | build:
10 | os: ubuntu-22.04
11 | tools:
12 | python: "3.12"
13 |
14 | # Build documentation in the "docs/" directory with Sphinx
15 | sphinx:
16 | configuration: docs/source/conf.py
17 |
18 | # Build PDF for docs
19 | formats:
20 | - pdf
21 |
22 | python:
23 | install:
24 | - requirements: docs/requirements.txt
25 |
--------------------------------------------------------------------------------
/tests/double-setup/reference.txt:
--------------------------------------------------------------------------------
1 | ○─ Polling 1 times for unidentified transfer on endpoint 43.4 OUT
2 | ├─── SETUP transaction on 43.4
3 | │ └── SETUP packet on 43.4, CRC 1F
4 | ○─┼─ 1 invalid groups
5 | └─┼─── 1 malformed packet
6 | │ └── Malformed 0-byte packet
7 | ○─ Polling 1 times for unidentified transfer on endpoint 43.4 OUT
8 | └─── SETUP transaction on 43.4
9 | └── SETUP packet on 43.4, CRC 1F
10 | ○─ Polling 1 times for unidentified transfer on endpoint 43.4 OUT
11 | └─── SETUP transaction on 43.4
12 | └── SETUP packet on 43.4, CRC 1F
13 |
--------------------------------------------------------------------------------
/src/database/mod.rs:
--------------------------------------------------------------------------------
1 | //! Storage primitives for the capture database.
2 |
3 | mod counter;
4 | mod stream;
5 | mod data_stream;
6 | mod index_stream;
7 | mod compact_index;
8 |
9 | pub use counter::{Counter, CounterSet, Snapshot};
10 |
11 | pub use data_stream::{
12 | DataReader,
13 | DataWriter,
14 | DataSnapshot,
15 | DataReaderOps,
16 | data_stream,
17 | data_stream_with_block_size,
18 | };
19 |
20 | pub use compact_index::{
21 | CompactReader,
22 | CompactWriter,
23 | CompactSnapshot,
24 | CompactReaderOps,
25 | compact_index,
26 | };
27 |
--------------------------------------------------------------------------------
/docs/source/what_is_packetry.rst:
--------------------------------------------------------------------------------
1 | =================
2 | What is Packetry?
3 | =================
4 |
5 | Packetry is a fast, intuitive USB 2.0 protocol analysis application for use with `Cynthion `__ or for exploring previously captured USB traffic. Designed from the ground up to handle the challenges of USB analysis, Packetry enables live capture and visual representation of physical layer packet data for High Speed (480 Mbps), Full Speed (12 Mbps), and Low Speed (1.5 Mbps) USB.
6 |
7 | .. image:: ../images/packetry-window.png
8 | :alt: Packetry main window
9 |
--------------------------------------------------------------------------------
/tests/ui/emf2022-badge/actions.json:
--------------------------------------------------------------------------------
1 | {"Open":"tests/emf2022-badge/capture.pcap"}
2 | {"Update":3710}
3 | {"Update":4406}
4 | {"SetExpanded":["traffic-hierarchical",10,true]}
5 | {"SetExpanded":["traffic-hierarchical",12,true]}
6 | {"SetExpanded":["traffic-hierarchical",33,true]}
7 | {"SetExpanded":["traffic-hierarchical",39,true]}
8 | {"SetExpanded":["traffic-hierarchical",44,true]}
9 | {"SetExpanded":["traffic-hierarchical",46,true]}
10 | {"SetExpanded":["traffic-hierarchical",33,false]}
11 | {"SetExpanded":["traffic-hierarchical",10,false]}
12 | {"SetExpanded":["traffic-hierarchical",29,false]}
13 |
--------------------------------------------------------------------------------
/tests/bad-crcs/reference.txt:
--------------------------------------------------------------------------------
1 | ○─ Polling 1 times for unidentified transfer on endpoint 7.1 IN
2 | ├─── IN transaction on 7.1, NAK
3 | │ ├── IN packet on 7.1, CRC 1B
4 | │ └── NAK packet
5 | ○─┼─ 1 invalid groups
6 | └─┼─── 1 malformed packet
7 | │ └── Malformed packet (possibly IN, but bad CRC) of 3 bytes: [69, B7, DB]
8 | ○─┼─ 1 invalid groups
9 | └─┼─── 1 malformed packet
10 | │ └── Malformed packet (possibly IN, but bad CRC) of 3 bytes: [69, B7, DB]
11 | ○─┼─ 1 invalid groups
12 | └─┼─── 1 malformed packet
13 | │ └── Malformed packet (possibly SOF, but bad CRC) of 3 bytes: [A5, BB, CE]
14 |
--------------------------------------------------------------------------------
/src/ui/capture.rs:
--------------------------------------------------------------------------------
1 | //! Unified access to different forms of capture.
2 |
3 | use crate::capture::{CaptureReader, CaptureSnapshot};
4 |
5 | #[derive(Clone)]
6 | pub enum CaptureState {
7 | Ongoing(CaptureSnapshot),
8 | Complete
9 | }
10 |
11 | #[derive(Clone)]
12 | pub struct Capture {
13 | pub reader: CaptureReader,
14 | pub state: CaptureState,
15 | }
16 |
17 | impl Capture {
18 | pub fn set_snapshot(&mut self, snapshot: CaptureSnapshot) {
19 | self.state = CaptureState::Ongoing(snapshot);
20 | }
21 |
22 | pub fn set_completed(&mut self) {
23 | self.state = CaptureState::Complete;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/appimage/docker/patches/gtk-4.14.4-pin-pango.patch:
--------------------------------------------------------------------------------
1 | diff --git a/subprojects/pango.wrap b/subprojects/pango.wrap
2 | index 7156644..fa6715b 100644
3 | --- a/subprojects/pango.wrap
4 | +++ b/subprojects/pango.wrap
5 | @@ -2,8 +2,8 @@
6 | directory = pango
7 | url = https://gitlab.gnome.org/GNOME/pango.git
8 | push-url = ssh://git@ssh.gitlab.gnome.org:GNOME/pango.git
9 | -# needs to be main, because we build the nightly docs from the subproject
10 | -revision = main
11 | +# needs to be 1.54.0 because later versions require versions of glib and fontconfig that are not supplied by gtk-4.14.4
12 | +revision = 1.54.0
13 | depth = 1
14 |
15 | [provide]
16 |
--------------------------------------------------------------------------------
/tests/hid/headset/reference.txt:
--------------------------------------------------------------------------------
1 |
2 | ○ Input report (4 bytes):
3 | ├── Volume Increment: byte 0 bit 0
4 | ├── Volume Decrement: byte 0 bit 1
5 | ├── Mute: byte 0 bit 2
6 | ├── Consumer usage 0x00: byte 0 bit 3
7 | ├── Hook Switch: byte 0 bit 4
8 | ├── Consumer usage 0x00: byte 0 bit 5
9 | ├── Consumer usage 0x00: byte 0 bit 6
10 | ├── Consumer usage 0x00: byte 0 bit 7
11 | ├── Consumer usage 0x00: byte 1
12 | ├── Consumer usage 0x00: byte 2
13 | └── Consumer usage 0x00: byte 3
14 |
15 | ○ Output report (4 bytes):
16 | ├── Consumer usage 0x00: byte 0
17 | ├── Consumer usage 0x00: byte 1
18 | ├── Consumer usage 0x00: byte 2
19 | └── Consumer usage 0x00: byte 3
20 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SOURCEDIR = source
8 | BUILDDIR = build
9 |
10 | # Put it first so that "make" without argument is like "make help".
11 | help:
12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13 |
14 | .PHONY: help Makefile
15 |
16 | # Catch-all target: route all unknown targets to Sphinx using the new
17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18 | %: Makefile
19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--------------------------------------------------------------------------------
/tests/hid/kvm-0/reference.txt:
--------------------------------------------------------------------------------
1 |
2 | ○ Input report (8 bytes):
3 | ├── Keyboard LeftControl: byte 0 bit 0
4 | ├── Keyboard LeftShift: byte 0 bit 1
5 | ├── Keyboard LeftAlt: byte 0 bit 2
6 | ├── Keyboard Left GUI: byte 0 bit 3
7 | ├── Keyboard RightControl: byte 0 bit 4
8 | ├── Keyboard RightShift: byte 0 bit 5
9 | ├── Keyboard RightAlt: byte 0 bit 6
10 | ├── Keyboard Right GUI: byte 0 bit 7
11 | ├── Padding: byte 1
12 | └── Array of 6 buttons: bytes 2-7 [Keyboard/Keypad usage 0x00 — Keyboard LANG2]
13 |
14 | ○ Output report (1 byte):
15 | ├── Num Lock: byte 0 bit 0
16 | ├── Caps Lock: byte 0 bit 1
17 | ├── Scroll Lock: byte 0 bit 2
18 | ├── Compose: byte 0 bit 3
19 | ├── Kana: byte 0 bit 4
20 | └── Padding: byte 0 bits 5-7
21 |
--------------------------------------------------------------------------------
/tests/hid/keyboard-0/reference.txt:
--------------------------------------------------------------------------------
1 |
2 | ○ Input report (8 bytes):
3 | ├── Keyboard LeftControl: byte 0 bit 0
4 | ├── Keyboard LeftShift: byte 0 bit 1
5 | ├── Keyboard LeftAlt: byte 0 bit 2
6 | ├── Keyboard Left GUI: byte 0 bit 3
7 | ├── Keyboard RightControl: byte 0 bit 4
8 | ├── Keyboard RightShift: byte 0 bit 5
9 | ├── Keyboard RightAlt: byte 0 bit 6
10 | ├── Keyboard Right GUI: byte 0 bit 7
11 | ├── Padding: byte 1
12 | └── Array of 6 buttons: bytes 2-7 [Keyboard/Keypad usage 0x00 — Keyboard/Keypad usage 0xFF]
13 |
14 | ○ Output report (1 byte):
15 | ├── Num Lock: byte 0 bit 0
16 | ├── Caps Lock: byte 0 bit 1
17 | ├── Scroll Lock: byte 0 bit 2
18 | ├── Compose: byte 0 bit 3
19 | ├── Kana: byte 0 bit 4
20 | └── Padding: byte 0 bits 5-7
21 |
--------------------------------------------------------------------------------
/appimage/docker/patches/gtk-4.14.4-gcc-lt-9.patch:
--------------------------------------------------------------------------------
1 | diff --git a/subprojects/glib/gio/tests/meson.build b/subprojects/glib/gio/tests/meson.build
2 | index b4a6492..509f6e1 100644
3 | --- a/subprojects/glib/gio/tests/meson.build
4 | +++ b/subprojects/glib/gio/tests/meson.build
5 | @@ -928,7 +928,7 @@ if not meson.is_cross_build()
6 | test_resources_binary = custom_target('test_resources.o',
7 | input : test_gresource_binary,
8 | output : 'test_resources.o',
9 | - command : cc.cmd_array() + ['-Wl,-z,noexecstack', '-r', '-Wl,-b,binary',
10 | + command : cc.cmd_array() + ['-Wl,-z,noexecstack', '-r', '-Wl,-b,binary', '-nostdlib',
11 | '@INPUT@', '-o','@OUTPUT@'])
12 |
13 | # Rename symbol to match the one in the C file
14 |
--------------------------------------------------------------------------------
/src/ui/settings.rs:
--------------------------------------------------------------------------------
1 | use std::path::PathBuf;
2 |
3 | use preferences::{AppInfo, Preferences};
4 | use serde::{Serialize, Deserialize};
5 |
6 | const APP_INFO: AppInfo = AppInfo {
7 | name: "Packetry",
8 | author: "Great Scott Gadgets"
9 | };
10 |
11 | #[derive(Default, Serialize, Deserialize)]
12 | pub struct Settings {
13 | pub last_used_directory: Option,
14 | }
15 |
16 | impl Settings {
17 | pub fn load() -> Settings {
18 | match ::load(&APP_INFO, "settings") {
19 | Ok(settings) => settings,
20 | Err(_) => Settings {
21 | last_used_directory: std::env::current_dir().ok()
22 | }
23 | }
24 | }
25 |
26 | pub fn save(&mut self) {
27 | let _ = ::save(self, &APP_INFO, "settings");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=source
11 | set BUILDDIR=build
12 |
13 | if "%1" == "" goto help
14 |
15 | %SPHINXBUILD% >NUL 2>NUL
16 | if errorlevel 9009 (
17 | echo.
18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19 | echo.installed, then set the SPHINXBUILD environment variable to point
20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
21 | echo.may add the Sphinx directory to PATH.
22 | echo.
23 | echo.If you don't have Sphinx installed, grab it from
24 | echo.http://sphinx-doc.org/
25 | exit /b 1
26 | )
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/docs/source/conf.py:
--------------------------------------------------------------------------------
1 | import sphinx_rtd_theme
2 |
3 | extensions = [
4 | 'sphinx_rtd_theme'
5 | ]
6 |
7 | # -- Project information -----------------------------------------------------
8 |
9 | project = 'Packetry'
10 | copyright = '2023-2024, Great Scott Gadgets'
11 | author = 'Great Scott Gadgets'
12 |
13 | version = ''
14 | release = ''
15 |
16 |
17 | # -- General configuration ---------------------------------------------------
18 |
19 | extensions = [
20 | 'sphinx.ext.autodoc',
21 | 'sphinx_inline_tabs',
22 | ]
23 |
24 | templates_path = ['_templates']
25 | exclude_patterns = ['_build']
26 | source_suffix = '.rst'
27 | master_doc = 'index'
28 | language = 'en'
29 | exclude_patterns = []
30 | pygments_style = None
31 |
32 |
33 | # -- Options for HTML output -------------------------------------------------
34 | # run pip install sphinx_rtd_theme if you get sphinx_rtd_theme errors
35 | html_theme = "sphinx_rtd_theme"
36 | html_css_files = ['status.css']
37 |
--------------------------------------------------------------------------------
/docs/source/keyboard_shortcuts_macos.rst:
--------------------------------------------------------------------------------
1 | ==========================
2 | Keyboard Shortcuts - macOS
3 | ==========================
4 |
5 | General
6 | -------
7 |
8 | +-----------+-------------------------------------------+
9 | | Keypress | Command |
10 | +===========+===========================================+
11 | | ``⌘ + O`` | Open capture file |
12 | +-----------+-------------------------------------------+
13 | | ``⌘ + E`` | Interrupt loading of a large capture file |
14 | +-----------+-------------------------------------------+
15 | | ``⌘ + S`` | Save current capture to file |
16 | +-----------+-------------------------------------------+
17 |
18 | Live Capture
19 | ------------
20 |
21 | +-----------+--------------------------+
22 | | Keypress | Command |
23 | +===========+==========================+
24 | | ``⌘ + B`` | Begin live capture |
25 | +-----------+--------------------------+
26 | | ``⌘ + E`` | End live capture |
27 | +-----------+--------------------------+
28 |
--------------------------------------------------------------------------------
/src/util/rcu.rs:
--------------------------------------------------------------------------------
1 | //! Implementation of the read-copy-update (RCU) pattern.
2 |
3 | use std::sync::Arc;
4 | use arc_swap::ArcSwapAny;
5 |
6 | /// Trait to implement the read-copy-update pattern for a single writer.
7 | pub trait SingleWriterRcu {
8 | /// Copy the value, apply a function to it, and replace the current value.
9 | fn update(&self, f: F);
10 |
11 | /// Copy the value, apply a function to it, and replace the the current
12 | /// value if the function returns true.
13 | fn maybe_update bool>(&self, f: F);
14 | }
15 |
16 | impl SingleWriterRcu for ArcSwapAny>
17 | where T: Clone
18 | {
19 | fn update(&self, f: F) {
20 | let mut copy = self.load().as_ref().clone();
21 | f(&mut copy);
22 | self.swap(Arc::new(copy));
23 | }
24 |
25 | fn maybe_update bool>(&self, f: F) {
26 | let mut copy = self.load().as_ref().clone();
27 | if f(&mut copy) {
28 | self.swap(Arc::new(copy));
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/tests/ui/split-poll-step/actions.json:
--------------------------------------------------------------------------------
1 | {"Open":"tests/split-poll/capture.pcap"}
2 | {"Update":1}
3 | {"Update":2}
4 | {"SetExpanded":["devices",0,true]}
5 | {"SetExpanded":["traffic-hierarchical",0,true]}
6 | {"Update":3}
7 | {"Update":4}
8 | {"SetExpanded":["traffic-hierarchical",2,true]}
9 | {"Update":5}
10 | {"Update":6}
11 | {"Update":7}
12 | {"Update":8}
13 | {"Update":9}
14 | {"Update":10}
15 | {"Update":11}
16 | {"Update":12}
17 | {"Update":13}
18 | {"Update":14}
19 | {"Update":15}
20 | {"Update":16}
21 | {"Update":17}
22 | {"Update":18}
23 | {"Update":19}
24 | {"Update":20}
25 | {"Update":21}
26 | {"Update":22}
27 | {"Update":23}
28 | {"Update":24}
29 | {"Update":25}
30 | {"Update":26}
31 | {"Update":27}
32 | {"Update":28}
33 | {"Update":29}
34 | {"Update":30}
35 | {"Update":31}
36 | {"Update":32}
37 | {"Update":33}
38 | {"Update":34}
39 | {"Update":35}
40 | {"Update":36}
41 | {"Update":37}
42 | {"Update":38}
43 | {"Update":39}
44 | {"Update":40}
45 | {"SetExpanded":["traffic-hierarchical",0,false]}
46 | {"SetExpanded":["traffic-hierarchical",1,false]}
47 | {"SetExpanded":["devices",0,false]}
48 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-derive-into-owned-0.2.0.txt:
--------------------------------------------------------------------------------
1 | Copyright 2022 Joonas Koivunen and contributors
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-ndk-context-0.1.1.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/docs/source/keyboard_shortcuts_linux_windows.rst:
--------------------------------------------------------------------------------
1 | ====================================
2 | Keyboard Shortcuts - Linux & Windows
3 | ====================================
4 |
5 | General
6 | -------
7 |
8 | +----------------+-------------------------------------------+
9 | | Keypress | Command |
10 | +================+===========================================+
11 | | ``Ctrl + O`` | Open capture file |
12 | +----------------+-------------------------------------------+
13 | | ``Ctrl + E`` | Interrupt loading of a large capture file |
14 | +----------------+-------------------------------------------+
15 | | ``Ctrl + S`` | Save current capture to file |
16 | +----------------+-------------------------------------------+
17 |
18 | Live Capture
19 | ------------
20 |
21 | +---------------+--------------------------+
22 | | Keypress | Command |
23 | +===============+==========================+
24 | | ``Ctrl + B`` | Begin live capture |
25 | +---------------+--------------------------+
26 | | ``Ctrl + E`` | End live capture |
27 | +---------------+--------------------------+
28 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-convert_case-0.4.0.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 David Purdum
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-malloc_buf-0.0.6.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Steven Sheldon
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-byteorder_slice-3.0.0.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019-2022 courvoif
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-kernel32-sys-0.2.2.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Peter Atashian
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-winapi-build-0.1.1.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Peter Atashian
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-ws2_32-sys-0.2.1.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Peter Atashian
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-dark-light-1.1.1.txt:
--------------------------------------------------------------------------------
1 | Copyright 2021-2024 Corey Farwell
2 | Copyright 2021-2024 Eduardo Flores
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the “Software”), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | of the Software, and to permit persons to whom the Software is furnished to do
9 | so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | SOFTWARE.
21 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-winapi-i686-pc-windows-gnu-0.4.0.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Peter Atashian
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-winapi-x86_64-pc-windows-gnu-0.4.0.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Peter Atashian
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-merge_derive-0.1.0.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019 Robin Krahl
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 | of the Software, and to permit persons to whom the Software is furnished to do
10 | so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-logwise_proc-0.1.1.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024-2025 Drew Crawford; https://sealedabstract.com/code/logwise
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/tests/hackrf-dfu-enum/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 11: LPC
2 | Device descriptor
3 | Length: 18 bytes
4 | Type: 0x01
5 | USB Version: 2.00
6 | Class: 0x00: (Defined at Interface level)
7 | Subclass: 0x00
8 | Protocol: 0x00
9 | Max EP0 packet size: 64 bytes
10 | Vendor ID: 0x1FC9: NXP Semiconductors
11 | Product ID: 0x000C: LPC4330FET180 [ARM Cortex M4 + M0] (device firmware upgrade mode)
12 | Version: 1.00
13 | Manufacturer string: #1 'NXP'
14 | Product string: #2 'LPC'
15 | Serial string: #3 'ABCD'
16 | Configuration 1
17 | Configuration descriptor
18 | Length: 9 bytes
19 | Type: 0x02
20 | Total length: 27 bytes
21 | Number of interfaces: 1
22 | Configuration number: 1
23 | Configuration string: (none)
24 | Attributes: 0xC0
25 | Max power: 100mA
26 | Interface 0: Application Specific Interface
27 | Interface descriptor
28 | Length: 9 bytes
29 | Type: 0x04
30 | Interface number: 0
31 | Alternate setting: 0
32 | Number of endpoints: 0
33 | Class: 0xFE: Application Specific Interface
34 | Subclass: 0x01: Device Firmware Update
35 | Protocol: 0x01
36 | Interface string: #4 'DFU'
37 | Class descriptor 0x21, 9 bytes
38 |
--------------------------------------------------------------------------------
/wix/manual-licenses/LICENSE-ryu-1.0.18.txt:
--------------------------------------------------------------------------------
1 | Boost Software License - Version 1.0 - August 17th, 2003
2 |
3 | Permission is hereby granted, free of charge, to any person or organization
4 | obtaining a copy of the software and accompanying documentation covered by
5 | this license (the "Software") to use, reproduce, display, distribute,
6 | execute, and transmit the Software, and to prepare derivative works of the
7 | Software, and to permit third-parties to whom the Software is furnished to
8 | do so, all subject to the following:
9 |
10 | The copyright notices in the Software and this entire statement, including
11 | the above license grant, this restriction and the following disclaimer,
12 | must be included in all copies of the Software, in whole or in part, and
13 | all derivative works of the Software, unless such copies or derivative
14 | works are solely in the form of machine-executable object code generated by
15 | a source language processor.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 | DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/src/fuzzer.rs:
--------------------------------------------------------------------------------
1 | //! Fuzz the USB packet decoder.
2 |
3 | #![allow(dead_code)]
4 | #![no_main]
5 |
6 | #[macro_use]
7 | extern crate bitfield;
8 |
9 | use std::sync::Arc;
10 | use std::fs::File;
11 |
12 | use anyhow::Error;
13 | use libfuzzer_sys::{arbitrary::{Arbitrary, Unstructured}, fuzz_target};
14 |
15 | pub mod built { include!(concat!(env!("OUT_DIR"), "/built.rs")); }
16 | mod capture;
17 | mod database;
18 | mod decoder;
19 | mod event;
20 | mod file;
21 | mod usb;
22 | mod util;
23 | mod version;
24 |
25 | use capture::{CaptureMetadata, create_capture};
26 | use decoder::Decoder;
27 | use file::{GenericSaver, PcapSaver};
28 |
29 | fuzz_target!(|data: &[u8]| {
30 | let mut input = Unstructured::new(data);
31 | let packets = Vec::<(Vec::, u32)>::arbitrary(&mut input).unwrap();
32 | let mut timestamp = u32::arbitrary(&mut input).unwrap() as u64;
33 | let (writer, _reader) = create_capture().unwrap();
34 | let mut decoder = Decoder::new(writer).unwrap();
35 | let metadata = Arc::new(CaptureMetadata::default());
36 | let file = File::create("fuzz.pcap").unwrap();
37 | let mut saver = PcapSaver::new(file, metadata).unwrap();
38 | let handle_packets = || {
39 | for (packet, time_delta) in packets {
40 | timestamp += time_delta as u64;
41 | saver.add_packet(&packet, timestamp)?;
42 | decoder.handle_raw_packet(&packet, timestamp)?;
43 | }
44 | Ok(())
45 | };
46 | let result: Result<(), Error> = handle_packets();
47 | saver.close().unwrap();
48 | result.unwrap();
49 | });
50 |
51 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2022-2024, Great Scott Gadgets
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/appimage/packetry.AppDir/usr/share/doc/libgraphene-1.0-0/copyright:
--------------------------------------------------------------------------------
1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2 | Upstream-Name: graphene
3 | Source: https://github.com/ebassi/graphene/releases
4 | Files-Excluded:
5 | subprojects/mutest/docs/markdeep.min.js
6 | subprojects/mutest/docs/markdeep.js
7 |
8 | Files: *
9 | Copyright: 2014-2019 Emmanuele Bassi
10 | License: Expat
11 |
12 | Files: debian/*
13 | Copyright:
14 | 2017-2019 Jeremy Bicha
15 | 2017 Laurent Bigonville
16 | 2019 Simon McVittie
17 | License: Expat
18 |
19 | License: Expat
20 | Permission is hereby granted, free of charge, to any person obtaining
21 | a copy of this software and associated documentation files (the
22 | "Software"), to deal in the Software without restriction, including
23 | without limitation the rights to use, copy, modify, merge, publish,
24 | distribute, sublicense, and/or sell copies of the Software, and to
25 | permit persons to whom the Software is furnished to do so, subject to
26 | the following conditions:
27 | .
28 | The above copyright notice and this permission notice shall be included
29 | in all copies or substantial portions of the Software.
30 | .
31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
35 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
36 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
37 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 |
--------------------------------------------------------------------------------
/tests/analyzer-test-bad-cable/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 1: USB Analyzer Test Device
2 | Device descriptor
3 | Length: 18 bytes
4 | Type: 0x01
5 | USB Version: 2.00
6 | Class: 0x00: (Defined at Interface level)
7 | Subclass: 0x00
8 | Protocol: 0x00
9 | Max EP0 packet size: 64 bytes
10 | Vendor ID: 0x1209: Generic
11 | Product ID: 0x000A: pid.codes Test PID
12 | Version: 0.01
13 | Manufacturer string: #1 'Cynthion Project'
14 | Product string: #2 'USB Analyzer Test Device'
15 | Serial string: (none)
16 | Configuration 1
17 | Configuration descriptor
18 | Length: 9 bytes
19 | Type: 0x02
20 | Total length: 25 bytes
21 | Number of interfaces: 1
22 | Configuration number: 1
23 | Configuration string: (none)
24 | Attributes: 0x80
25 | Max power: 500mA
26 | Interface 0: Vendor Specific Class
27 | Interface descriptor
28 | Length: 9 bytes
29 | Type: 0x04
30 | Interface number: 0
31 | Alternate setting: 0
32 | Number of endpoints: 1
33 | Class: 0xFF: Vendor Specific Class
34 | Subclass: 0xFF: Vendor Specific Subclass
35 | Protocol: 0xFF: Vendor Specific Protocol
36 | Interface string: (none)
37 | Endpoint 1 IN (interrupt)
38 | Endpoint descriptor
39 | Length: 7 bytes
40 | Type: 0x05
41 | Endpoint address: 0x81
42 | Attributes: 0x03
43 | Max packet size: 512 bytes
44 | Interval: 0x05
45 |
--------------------------------------------------------------------------------
/tests/ls-keepalive-divided-transaction/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 25: USB Analyzer Test Device
2 | Device descriptor
3 | Length: 18 bytes
4 | Type: 0x01
5 | USB Version: 2.00
6 | Class: 0x00: (Defined at Interface level)
7 | Subclass: 0x00
8 | Protocol: 0x00
9 | Max EP0 packet size: 8 bytes
10 | Vendor ID: 0x1209: Generic
11 | Product ID: 0x000A: pid.codes Test PID
12 | Version: 0.01
13 | Manufacturer string: #1 'Cynthion Project'
14 | Product string: #2 'USB Analyzer Test Device'
15 | Serial string: (none)
16 | Configuration 1
17 | Configuration descriptor
18 | Length: 9 bytes
19 | Type: 0x02
20 | Total length: 25 bytes
21 | Number of interfaces: 1
22 | Configuration number: 1
23 | Configuration string: (none)
24 | Attributes: 0x80
25 | Max power: 500mA
26 | Interface 0: Vendor Specific Class
27 | Interface descriptor
28 | Length: 9 bytes
29 | Type: 0x04
30 | Interface number: 0
31 | Alternate setting: 0
32 | Number of endpoints: 1
33 | Class: 0xFF: Vendor Specific Class
34 | Subclass: 0xFF: Vendor Specific Subclass
35 | Protocol: 0xFF: Vendor Specific Protocol
36 | Interface string: (none)
37 | Endpoint 3 IN (interrupt)
38 | Endpoint descriptor
39 | Length: 7 bytes
40 | Type: 0x05
41 | Endpoint address: 0x83
42 | Attributes: 0x03
43 | Max packet size: 8 bytes
44 | Interval: 0x05
45 |
--------------------------------------------------------------------------------
/src/cli.rs:
--------------------------------------------------------------------------------
1 | //! CLI wrapper program.
2 | //!
3 | //! Necessary on Windows, where the GUI binary cannot have console output.
4 |
5 | use std::process::{Command, ExitCode};
6 |
7 | #[cfg(unix)]
8 | use std::os::unix::process::ExitStatusExt;
9 |
10 | #[cfg(windows)]
11 | const MAIN_BINARY: &str = "packetry.exe";
12 | #[cfg(not(windows))]
13 | const MAIN_BINARY: &str = "packetry";
14 |
15 | fn main() -> ExitCode {
16 | // Find the main Packetry executable.
17 | let packetry_binary_path = std::env::current_exe()
18 | .expect("Failed to find path to current executable")
19 | .parent()
20 | .expect("Failed to find parent directory of current executable")
21 | .join(MAIN_BINARY);
22 |
23 | // Prepare to call it, passing through all arguments we were passed.
24 | let mut command = Command::new(packetry_binary_path);
25 | command.args(std::env::args().skip(1));
26 |
27 | // If on Windows, tell the child that it needs to attach to our console.
28 | #[cfg(windows)]
29 | command.env("PACKETRY_ATTACH_CONSOLE", "1");
30 |
31 | // Spawn the main binary as a child process, and wait for its exit status.
32 | let exit_status = command
33 | .status()
34 | .expect("Failed to start main packetry binary");
35 |
36 | // Try to exit with the same code the child did.
37 | match exit_status.code() {
38 | Some(code) => ExitCode::from(code as u8),
39 | None => {
40 | #[cfg(unix)]
41 | if let Some(signal) = exit_status.signal() {
42 | panic!("Packetry was terminated by signal {signal}");
43 | }
44 | panic!("Packetry was terminated without an exit code");
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/tests/mouse/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 4: USB Optical Mouse
2 | Device descriptor
3 | Length: 18 bytes
4 | Type: 0x01
5 | USB Version: 2.00
6 | Class: 0x00: (Defined at Interface level)
7 | Subclass: 0x00
8 | Protocol: 0x00
9 | Max EP0 packet size: 8 bytes
10 | Vendor ID: 0x1BCF: Sunplus Innovation Technology Inc.
11 | Product ID: 0x0005: Optical Mouse
12 | Version: 0.14
13 | Manufacturer string: (none)
14 | Product string: #2 'USB Optical Mouse'
15 | Serial string: (none)
16 | Configuration 1
17 | Configuration descriptor
18 | Length: 9 bytes
19 | Type: 0x02
20 | Total length: 34 bytes
21 | Number of interfaces: 1
22 | Configuration number: 1
23 | Configuration string: (none)
24 | Attributes: 0xA0
25 | Max power: 98mA
26 | Interface 0: Human Interface Device
27 | Interface descriptor
28 | Length: 9 bytes
29 | Type: 0x04
30 | Interface number: 0
31 | Alternate setting: 0
32 | Number of endpoints: 1
33 | Class: 0x03: Human Interface Device
34 | Subclass: 0x01: Boot Interface Subclass
35 | Protocol: 0x02: Mouse
36 | Interface string: (none)
37 | HID descriptor
38 | Length: 9 bytes
39 | Type: 0x21
40 | HID Version: 1.10
41 | Country code: 0x00: Not supported
42 | Available descriptors
43 | HID report descriptor, 75 bytes
44 | Endpoint 1 IN (interrupt)
45 | Endpoint descriptor
46 | Length: 7 bytes
47 | Type: 0x05
48 | Endpoint address: 0x81
49 | Attributes: 0x03
50 | Max packet size: 7 bytes
51 | Interval: 0x0A
52 |
--------------------------------------------------------------------------------
/src/version.rs:
--------------------------------------------------------------------------------
1 | //! Version information.
2 |
3 | use std::fmt::Write;
4 |
5 | use crate::built::*;
6 |
7 | pub fn version() -> String {
8 | const MOD: &str = match GIT_DIRTY {
9 | Some(true) => "-modified",
10 | Some(false) | None => ""
11 | };
12 |
13 | match GIT_VERSION {
14 | None => PKG_VERSION.to_string(),
15 | Some(description) => format!("{PKG_VERSION} (git {description}{MOD})")
16 | }
17 | }
18 |
19 | pub fn version_info(with_dependencies: bool) -> String {
20 | let gtk_version = format!("{}.{}.{}",
21 | gtk::major_version(),
22 | gtk::minor_version(),
23 | gtk::micro_version());
24 |
25 | const COMMIT: &str = match GIT_COMMIT_HASH {
26 | Some(commit) => commit,
27 | None => "unknown"
28 | };
29 |
30 | const MODIFIED: &str = match GIT_DIRTY {
31 | Some(true) => " (modified)",
32 | Some(false) | None => ""
33 | };
34 |
35 | #[allow(clippy::const_is_empty)]
36 | const FEATURE_LIST: &str = if FEATURES.is_empty() {
37 | "(none)"
38 | } else {
39 | FEATURES_LOWERCASE_STR
40 | };
41 |
42 | const DEBUG_STR: &str = if DEBUG {"yes"} else {"no"};
43 |
44 | let output = format!("\
45 | Runtime information:
46 | GTK version: {gtk_version}
47 |
48 | Packetry build information:
49 | Git commit: {COMMIT}{MODIFIED}
50 | Cargo package version: {PKG_VERSION}
51 | Enabled features: {FEATURE_LIST}
52 |
53 | Rust compiler:
54 | Version: {RUSTC_VERSION}
55 | Target: {TARGET} ({CFG_ENDIAN}-endian, {CFG_POINTER_WIDTH}-bit)
56 | Optimization level: {OPT_LEVEL}
57 | Debug build: {DEBUG_STR}");
58 |
59 | if with_dependencies {
60 | DEPENDENCIES
61 | .iter()
62 | .fold(
63 | format!("{output}\n\nBuilt with dependencies:"),
64 | |mut string, (pkg, ver)| {
65 | write!(string, "\n {pkg} {ver}").unwrap();
66 | string
67 | }
68 | )
69 | } else {
70 | output
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/wix/generate_components.py:
--------------------------------------------------------------------------------
1 | from contextlib import redirect_stdout
2 | import os
3 |
4 | dll_components = open('wix/dll-components.wxi', 'w')
5 | dll_references = open('wix/dll-references.wxi', 'w')
6 | license_components = open('wix/license-components.wxi', 'w')
7 | license_references = open('wix/license-references.wxi', 'w')
8 |
9 | output_files = [
10 | dll_components,
11 | dll_references,
12 | license_components,
13 | license_references
14 | ]
15 |
16 | def component_name(filename):
17 | return filename.replace('-', '_').replace('+', '_')
18 |
19 | for file in output_files:
20 | print("", file=file)
21 |
22 | bin_dir = '$(env.VCPKG_INSTALLED_DIR)/x64-windows/bin'
23 |
24 | for line in open('wix/required-dlls.txt', 'r'):
25 | filename, guid = line.rstrip().split(' ')
26 | component = component_name(filename)
27 | with redirect_stdout(dll_components):
28 | print(f" ")
29 | print(f" ")
33 | print(f" ")
34 | with redirect_stdout(dll_references):
35 | print(f" ")
36 |
37 | for filename in os.listdir('wix/full-licenses'):
38 | component = component_name(filename)
39 | with redirect_stdout(license_components):
40 | print(f" ")
41 | print(f" ")
45 | print(f" ")
46 | with redirect_stdout(license_references):
47 | print(f" ")
48 |
49 | for file in output_files:
50 | print("", file=file)
51 |
--------------------------------------------------------------------------------
/tests/hackrf-connect/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 29: HackRF One
2 | Device descriptor
3 | Length: 18 bytes
4 | Type: 0x01
5 | USB Version: 2.00
6 | Class: 0x00: (Defined at Interface level)
7 | Subclass: 0x00
8 | Protocol: 0x00
9 | Max EP0 packet size: 64 bytes
10 | Vendor ID: 0x1D50: OpenMoko, Inc.
11 | Product ID: 0x6089: Great Scott Gadgets HackRF One SDR
12 | Version: 1.06
13 | Manufacturer string: #1 'Great Scott Gadgets'
14 | Product string: #2 'HackRF One'
15 | Serial string: #4 '0000000000000000325866e6215c4023'
16 | Configuration 1
17 | Configuration descriptor
18 | Length: 9 bytes
19 | Type: 0x02
20 | Total length: 32 bytes
21 | Number of interfaces: 1
22 | Configuration number: 1
23 | Configuration string: #3 'Transceiver'
24 | Attributes: 0x80
25 | Max power: 500mA
26 | Interface 0: Vendor Specific Class
27 | Interface descriptor
28 | Length: 9 bytes
29 | Type: 0x04
30 | Interface number: 0
31 | Alternate setting: 0
32 | Number of endpoints: 2
33 | Class: 0xFF: Vendor Specific Class
34 | Subclass: 0xFF: Vendor Specific Subclass
35 | Protocol: 0xFF: Vendor Specific Protocol
36 | Interface string: (none)
37 | Endpoint 1 IN (bulk)
38 | Endpoint descriptor
39 | Length: 7 bytes
40 | Type: 0x05
41 | Endpoint address: 0x81
42 | Attributes: 0x02
43 | Max packet size: 512 bytes
44 | Interval: 0x00
45 | Endpoint 2 OUT (bulk)
46 | Endpoint descriptor
47 | Length: 7 bytes
48 | Type: 0x05
49 | Endpoint address: 0x02
50 | Attributes: 0x02
51 | Max packet size: 512 bytes
52 | Interval: 0x00
53 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Packetry
2 |
3 | A fast, intuitive USB 2.0 protocol analysis application for use with [Cynthion](https://greatscottgadgets.com/cynthion/).
4 |
5 | 
6 |
7 | ## Documentation
8 |
9 | Read the latest [Packetry Documentation](https://packetry.readthedocs.io/).
10 |
11 | ## Development
12 |
13 | Packetry is written in [Rust](https://rust-lang.org/), with its GUI using [GTK 4](https://gtk.org) via the [gtk-rs](https://gtk-rs.org/) bindings.
14 |
15 | To build it, you need a working Rust development environment. The minimum supported Rust version is 1.85.1.
16 |
17 | You must also have the GTK 4 headers installed and discoverable via `pkg-config`, as this is required for Rust to build the gtk-rs crates.
18 |
19 | ### Building and running
20 |
21 | To build, run `cargo build` after installing the necessary prerequisites (see below). Run with `cargo run`.
22 |
23 | If you pass a capture filename as an argument, Packetry will attempt to load it. The current supported file format is a `.pcap` file with the `LINKTYPE_USB_2_0` link layer header type.
24 |
25 | Note: Do not build with `--all-features`. All the optional features currently in the package are for debug/test purposes only, and will prevent or degrade normal use of the application if enabled. See `Cargo.toml` for details.
26 |
27 | ### Installing prerequisites
28 |
29 | #### Linux
30 |
31 | Install the Rust build tools, other essential build tools, and GTK 4 headers.
32 |
33 | On Debian based systems it may be sufficient to use the command:
34 |
35 | `apt install rustc cargo build-essential libgtk-4-dev`
36 |
37 | For Fedora systems:
38 |
39 | `yum install rust cargo make gcc gcc-c++ gtk4-devel pango-devel`
40 |
41 | For other distributions, a similar set of packages should be required.
42 |
43 | Note that Packetry requires a minimum Rust version of 1.85.1. If your distribution's packages are older than this, use [rustup](https://rustup.rs/) to get the latest Rust toolchain and manage your Rust installation.
44 |
45 | #### macOS
46 |
47 | Install Rust with [rustup](https://rustup.rs/), and install [Homebrew](https://brew.sh/).
48 |
49 | Install GTK 4 with `brew install gtk4`.
50 |
51 | #### Windows
52 |
53 | Follow the installation instructions from [GUI development with Rust and GTK 4](https://gtk-rs.org/gtk4-rs/stable/latest/book/installation_windows.html).
54 |
55 | You can use either the MSVC or GNU toolchains.
56 |
--------------------------------------------------------------------------------
/wix/required-dlls.txt:
--------------------------------------------------------------------------------
1 | atk-1.0-0.dll 5edbbda4-db12-4e43-8f0c-218ebab94d93
2 | brotlicommon.dll 0be65eb3-8928-4817-925a-5550e666683b
3 | brotlidec.dll a1aa709a-a611-47bf-91d4-2f655270bec5
4 | brotlienc.dll ef53d54e-d61b-4e7f-8a2b-c8347bd0884e
5 | bz2.dll 4a8a184b-11a9-4493-a709-7d0ec8614f14
6 | cairo-2.dll d8ce6c10-20fc-4128-a9ac-6ef047cb96e2
7 | cairo-gobject-2.dll 9992fb8f-f693-4dcd-a387-1f86b4b41aac
8 | cairo-script-interpreter-2.dll 75cc1bb6-d916-4f82-aea3-1179f5eb7ba5
9 | charset-1.dll 56827d0e-68e1-4e4b-8278-659184d9e570
10 | epoxy-0.dll 9aeef0ec-6c93-480d-a44c-ced8dfabfb2f
11 | ffi-8.dll 7c63276a-0848-4f46-96fa-8df568a2bb61
12 | fontconfig-1.dll aa8ad7de-59cc-435c-97cb-e328bbff8460
13 | freetype.dll 74abc4a2-df13-48bb-8696-96f92a2c0be0
14 | fribidi-0.dll e462dcd8-2226-4f73-9f7e-d2b3b58eba49
15 | gdk_pixbuf-2.0-0.dll c24a4c43-def6-4c24-8cb8-54ece1b6bb9c
16 | getopt.dll f7d09e7c-fccc-4558-b478-5f8a3e88e4e4
17 | gio-2.0-0.dll a91cae44-99b8-4d47-9682-7985abc3bbe1
18 | glib-2.0-0.dll 9c81fa23-c96b-4802-aab0-3401300d7bc3
19 | gmodule-2.0-0.dll 6bf333ce-3f3a-49ba-b035-fc952b63725b
20 | gobject-2.0-0.dll 7bc6b550-918a-4d1b-91d9-358f02a242ba
21 | graphene-1.0-0.dll 2874cda9-9885-4495-9763-38a51a37b9d8
22 | gthread-2.0-0.dll 4c314fb1-7224-48e2-af39-81984fa6c19e
23 | gtk-4-1.dll 6fe10843-e106-4883-bf29-a6a94cd2b1cd
24 | harfbuzz.dll a12abb2a-7edf-40d6-adb2-39cd5a9d8ef8
25 | harfbuzz-gobject.dll 202cb447-b82f-47c0-9356-c353b675fd3d
26 | harfbuzz-subset.dll 58296888-07a8-4258-9054-5fa089e3c855
27 | iconv-2.dll 18abffeb-462a-4186-8b8a-0149c8b9f062
28 | intl-8.dll 628852d1-0ccd-40cc-84f4-ae6fee75db16
29 | jpeg62.dll 086f589c-d8af-474d-9564-8d65ef6f4401
30 | libexpat.dll b7c975d0-6e53-49b4-b7ed-c75daad6616e
31 | liblzma.dll abd4caa2-4acd-4ec1-85a1-8d621c672529
32 | libpng16.dll b489d04b-74d9-4001-b185-0573968a6da2
33 | pango-1.0-0.dll 9e6b8c45-d189-4b8a-aaa9-1f83c92421c2
34 | pangocairo-1.0-0.dll fde9897b-09a2-4201-94f7-2284dcc7246f
35 | pangoft2-1.0-0.dll d1b0f76f-747a-4e81-9c98-24c91d7c7e21
36 | pangowin32-1.0-0.dll 1e350ffc-f0e7-4739-aeb4-2c0f93616259
37 | pcre2-16.dll 34b8d08a-979f-41be-a894-0ac7ec47e670
38 | pcre2-32.dll 86190ec9-596b-412b-b005-d24256086457
39 | pcre2-8.dll 32f1711c-a8f7-4f09-890e-eb3a69347b7d
40 | pcre2-posix.dll c153933b-e57e-432a-9a29-ff8a4889615e
41 | pixman-1-0.dll 1c88f629-1474-4dd5-9b23-7b6dcfb4143c
42 | pthreadVC3.dll 88992acc-c1bd-4d6c-8155-ce1e07cd66af
43 | pthreadVCE3.dll efeab01d-ac1e-42be-8cb1-75b0a419503f
44 | pthreadVSE3.dll 09cc7e5d-ebc3-42bb-9bd9-26a9bdac449e
45 | sass-1.dll e67bbd5b-edf9-4f2b-a04a-241e628ba95f
46 | tiff.dll f181c65d-b7fc-41ab-9fcf-49b3a5996ba3
47 | turbojpeg.dll 8cfa1139-79e4-4e80-9c76-fbe5d404d9c5
48 | zlib1.dll e10ca69b-ce5e-4368-bc78-5109ba0e6b75
49 |
--------------------------------------------------------------------------------
/wix/vcpkg_licenses.py:
--------------------------------------------------------------------------------
1 | import subprocess
2 | import shutil
3 | import json
4 | import re
5 | import os
6 |
7 | dest_dir = 'wix/full-licenses'
8 |
9 | vcpkg_result = subprocess.run(
10 | ['./vcpkg/vcpkg', 'depend-info', 'gtk', '--triplet=x64-windows'],
11 | capture_output=True)
12 |
13 | vcpkg_result.check_returncode()
14 |
15 | packages = set()
16 |
17 | # Find all packages we depend on.
18 | for line in vcpkg_result.stderr.decode().rstrip().split('\n'):
19 | header, remainder = line.split(': ')
20 | package = header.split('[')[0]
21 | packages.add(package)
22 | dependencies = remainder.split(', ')
23 | packages |= set(dependencies)
24 |
25 | # Discard empty package names.
26 | packages.discard('')
27 |
28 | # Discard vcpkg build tools.
29 | packages = set(p for p in packages if not p.startswith('vcpkg-'))
30 |
31 | # gperf is needed to build fontconfig, but is not linked to.
32 | packages.discard('gperf')
33 |
34 | # gettext is needed to build many dependencies, but is not linked to.
35 | packages.discard('gettext')
36 |
37 | # getopt and pthread are virtual packages.
38 | packages.discard('getopt')
39 | packages.discard('pthread')
40 |
41 | # sassc is used to build GTK, but is not linked to.
42 | packages.discard('sassc')
43 |
44 | versions = {}
45 |
46 | # These packages are missing license information in vcpkg.
47 | licenses = {
48 | 'libiconv': 'LGPL-2.1-or-later',
49 | 'egl-registry': 'Apache-2.0 OR MIT',
50 | 'liblzma': 'BSD-0-Clause',
51 | 'libsass': 'MIT',
52 | }
53 |
54 | # These packages are missing homepage information in vcpkg.
55 | homepages = {
56 | 'fribidi': 'https://github.com/fribidi/fribidi',
57 | }
58 |
59 | for package in packages:
60 | metadata = json.load(open(f'vcpkg/ports/{package}/vcpkg.json'))
61 | version = metadata.get('version-semver',
62 | metadata.get('version',
63 | metadata.get('version-date')))
64 | if version is None:
65 | raise ValueError(f"Couldn't find a version for package {package}")
66 | versions[package] = version
67 | if metadata.get('homepage') is not None:
68 | homepages[package] = metadata['homepage']
69 | if metadata.get('license') is not None:
70 | licenses[package] = metadata['license']
71 |
72 | try:
73 | os.mkdir(dest_dir)
74 | except FileExistsError:
75 | pass
76 |
77 | print("The following libraries are dynamically linked into Packetry:")
78 |
79 | for package in sorted(packages):
80 | license_src = f'vcpkg/installed/x64-windows/share/{package}/copyright'
81 | license_dest = os.path.join(dest_dir, f'LICENSE-{package}.txt')
82 | shutil.copyfile(license_src, license_dest)
83 | print()
84 | print(f"{package} version {versions[package]}")
85 | print(f"Homepage: {homepages[package]}")
86 | print(f"License type: {licenses[package]}")
87 | print(f"License text: {license_dest}")
88 |
--------------------------------------------------------------------------------
/tests/split-enum/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 12: Unknown
2 | No device descriptor
3 | Device 14: USB Device
4 | Device descriptor
5 | Length: 18 bytes
6 | Type: 0x01
7 | USB Version: 2.00
8 | Class: 0x00: (Defined at Interface level)
9 | Subclass: 0x00
10 | Protocol: 0x00
11 | Max EP0 packet size: 8 bytes
12 | Vendor ID: 0x0C45: Microdia
13 | Product ID: 0x7403: Foot Switch
14 | Version: 0.01
15 | Manufacturer string: #1 (not seen)
16 | Product string: #2 'USB Device'
17 | Serial string: (none)
18 | Configuration 1
19 | Configuration descriptor
20 | Length: 9 bytes
21 | Type: 0x02
22 | Total length: 59 bytes
23 | Number of interfaces: 2
24 | Configuration number: 1
25 | Configuration string: (none)
26 | Attributes: 0xA0
27 | Max power: 100mA
28 | Interface 0: Human Interface Device
29 | Interface descriptor
30 | Length: 9 bytes
31 | Type: 0x04
32 | Interface number: 0
33 | Alternate setting: 0
34 | Number of endpoints: 1
35 | Class: 0x03: Human Interface Device
36 | Subclass: 0x01: Boot Interface Subclass
37 | Protocol: 0x01: Keyboard
38 | Interface string: (none)
39 | HID descriptor
40 | Length: 9 bytes
41 | Type: 0x21
42 | HID Version: 1.00
43 | Country code: 0x00: Not supported
44 | Available descriptors
45 | HID report descriptor, 77 bytes
46 | Endpoint 1 IN (interrupt)
47 | Endpoint descriptor
48 | Length: 7 bytes
49 | Type: 0x05
50 | Endpoint address: 0x81
51 | Attributes: 0x03
52 | Max packet size: 8 bytes
53 | Interval: 0x0A
54 | Interface 1: Human Interface Device
55 | Interface descriptor
56 | Length: 9 bytes
57 | Type: 0x04
58 | Interface number: 1
59 | Alternate setting: 0
60 | Number of endpoints: 1
61 | Class: 0x03: Human Interface Device
62 | Subclass: 0x01: Boot Interface Subclass
63 | Protocol: 0x02: Mouse
64 | Interface string: (none)
65 | HID descriptor
66 | Length: 9 bytes
67 | Type: 0x21
68 | HID Version: 1.00
69 | Country code: 0x00: Not supported
70 | Available descriptors
71 | HID report descriptor, 91 bytes
72 | Endpoint 2 IN (interrupt)
73 | Endpoint descriptor
74 | Length: 7 bytes
75 | Type: 0x05
76 | Endpoint address: 0x82
77 | Attributes: 0x03
78 | Max packet size: 5 bytes
79 | Interval: 0x0A
80 |
--------------------------------------------------------------------------------
/tests/ls-keepalive-more-divided-transactions/devices-reference.txt:
--------------------------------------------------------------------------------
1 | Device 58: QuickFire Rapid keyboard
2 | Device descriptor
3 | Length: 18 bytes
4 | Type: 0x01
5 | USB Version: 1.10
6 | Class: 0x00: (Defined at Interface level)
7 | Subclass: 0x00
8 | Protocol: 0x00
9 | Max EP0 packet size: 8 bytes
10 | Vendor ID: 0x2516: Cooler Master Co., Ltd.
11 | Product ID: 0x0004: Storm QuickFire Rapid Mechanical Keyboard
12 | Version: 0.01
13 | Manufacturer string: #1 'CM Storm'
14 | Product string: #2 'QuickFire Rapid keyboard'
15 | Serial string: (none)
16 | Configuration 1
17 | Configuration descriptor
18 | Length: 9 bytes
19 | Type: 0x02
20 | Total length: 59 bytes
21 | Number of interfaces: 2
22 | Configuration number: 1
23 | Configuration string: (none)
24 | Attributes: 0xA0
25 | Max power: 100mA
26 | Interface 0: Human Interface Device
27 | Interface descriptor
28 | Length: 9 bytes
29 | Type: 0x04
30 | Interface number: 0
31 | Alternate setting: 0
32 | Number of endpoints: 1
33 | Class: 0x03: Human Interface Device
34 | Subclass: 0x01: Boot Interface Subclass
35 | Protocol: 0x01: Keyboard
36 | Interface string: (none)
37 | HID descriptor
38 | Length: 9 bytes
39 | Type: 0x21
40 | HID Version: 1.10
41 | Country code: 0x00: Not supported
42 | Available descriptors
43 | HID report descriptor, 62 bytes
44 | Endpoint 1 IN (interrupt)
45 | Endpoint descriptor
46 | Length: 7 bytes
47 | Type: 0x05
48 | Endpoint address: 0x81
49 | Attributes: 0x03
50 | Max packet size: 8 bytes
51 | Interval: 0x01
52 | Interface 1: Human Interface Device
53 | Interface descriptor
54 | Length: 9 bytes
55 | Type: 0x04
56 | Interface number: 1
57 | Alternate setting: 0
58 | Number of endpoints: 1
59 | Class: 0x03: Human Interface Device
60 | Subclass: 0x01: Boot Interface Subclass
61 | Protocol: 0x02: Mouse
62 | Interface string: (none)
63 | HID descriptor
64 | Length: 9 bytes
65 | Type: 0x21
66 | HID Version: 1.10
67 | Country code: 0x00: Not supported
68 | Available descriptors
69 | HID report descriptor, 166 bytes
70 | Endpoint 2 IN (interrupt)
71 | Endpoint descriptor
72 | Length: 7 bytes
73 | Type: 0x05
74 | Endpoint address: 0x82
75 | Attributes: 0x03
76 | Max packet size: 8 bytes
77 | Interval: 0x01
78 |
--------------------------------------------------------------------------------
/tests/split-poll/reference.txt:
--------------------------------------------------------------------------------
1 | ○── Polling 4 times for interrupt transfer on endpoint 14.1 IN
2 | ├──── Starting IN transaction on 14.1
3 | │ ├── SPLIT packet starting low speed interrupt transaction on hub 12 port 2
4 | │ └── IN packet on 14.1, CRC 0A
5 | ├──── Completing IN transaction on 14.1, NAK
6 | │ ├── SPLIT packet completing low speed interrupt transaction on hub 12 port 2
7 | │ ├── IN packet on 14.1, CRC 0A
8 | │ └── NAK packet
9 | ├──── Starting IN transaction on 14.1
10 | │ ├── SPLIT packet starting low speed interrupt transaction on hub 12 port 2
11 | │ └── IN packet on 14.1, CRC 0A
12 | ├──── Completing IN transaction on 14.1, NAK
13 | │ ├── SPLIT packet completing low speed interrupt transaction on hub 12 port 2
14 | │ ├── IN packet on 14.1, CRC 0A
15 | │ └── NAK packet
16 | ├──── Starting IN transaction on 14.1
17 | │ ├── SPLIT packet starting low speed interrupt transaction on hub 12 port 2
18 | │ └── IN packet on 14.1, CRC 0A
19 | ├──── Completing IN transaction on 14.1, NAK
20 | │ ├── SPLIT packet completing low speed interrupt transaction on hub 12 port 2
21 | │ ├── IN packet on 14.1, CRC 0A
22 | │ └── NAK packet
23 | ├──── Starting IN transaction on 14.1
24 | │ ├── SPLIT packet starting low speed interrupt transaction on hub 12 port 2
25 | │ └── IN packet on 14.1, CRC 0A
26 | ├──── Completing IN transaction on 14.1, NAK
27 | │ ├── SPLIT packet completing low speed interrupt transaction on hub 12 port 2
28 | │ ├── IN packet on 14.1, CRC 0A
29 | │ └── NAK packet
30 | │○─ Polling 4 times for interrupt transfer on endpoint 14.2 IN
31 | │├─── Starting IN transaction on 14.2
32 | ││ ├── SPLIT packet starting low speed interrupt transaction on hub 12 port 2
33 | ││ └── IN packet on 14.2, CRC 19
34 | │├─── Completing IN transaction on 14.2, NAK
35 | ││ ├── SPLIT packet completing low speed interrupt transaction on hub 12 port 2
36 | ││ ├── IN packet on 14.2, CRC 19
37 | ││ └── NAK packet
38 | │├─── Starting IN transaction on 14.2
39 | ││ ├── SPLIT packet starting low speed interrupt transaction on hub 12 port 2
40 | ││ └── IN packet on 14.2, CRC 19
41 | │├─── Completing IN transaction on 14.2, NAK
42 | ││ ├── SPLIT packet completing low speed interrupt transaction on hub 12 port 2
43 | ││ ├── IN packet on 14.2, CRC 19
44 | ││ └── NAK packet
45 | │├─── Starting IN transaction on 14.2
46 | ││ ├── SPLIT packet starting low speed interrupt transaction on hub 12 port 2
47 | ││ └── IN packet on 14.2, CRC 19
48 | │├─── Completing IN transaction on 14.2, NAK
49 | ││ ├── SPLIT packet completing low speed interrupt transaction on hub 12 port 2
50 | ││ ├── IN packet on 14.2, CRC 19
51 | ││ └── NAK packet
52 | │├─── Starting IN transaction on 14.2
53 | ││ ├── SPLIT packet starting low speed interrupt transaction on hub 12 port 2
54 | ││ └── IN packet on 14.2, CRC 19
55 | │└─── Completing IN transaction on 14.2, NAK
56 | │ ├── SPLIT packet completing low speed interrupt transaction on hub 12 port 2
57 | │ ├── IN packet on 14.2, CRC 19
58 | │ └── NAK packet
59 |
--------------------------------------------------------------------------------
/src/util/id.rs:
--------------------------------------------------------------------------------
1 | //! The Id type and its traits.
2 | //!
3 | //! Used to enforce type safety of indices used in the capture database.
4 |
5 | use std::fmt::{Debug, Display};
6 | use std::marker::PhantomData;
7 | use std::mem::size_of;
8 | use std::ops::{Add, AddAssign, Sub, SubAssign};
9 | use std::ops::Range;
10 |
11 | #[derive(Copy, Clone)]
12 | pub struct Id {
13 | _marker: PhantomData,
14 | pub value: u64
15 | }
16 |
17 | impl Eq for Id {}
18 |
19 | impl Ord for Id {
20 | fn cmp(&self, other: &Self) -> std::cmp::Ordering {
21 | self.value.cmp(&other.value)
22 | }
23 | }
24 |
25 | impl PartialOrd for Id {
26 | fn partial_cmp(&self, other: &Self) -> Option {
27 | Some(self.cmp(other))
28 | }
29 | }
30 |
31 | impl Display for Id {
32 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>)
33 | -> Result<(), std::fmt::Error>
34 | {
35 | write!(f, "{}", self.value)
36 | }
37 | }
38 |
39 | impl Debug for Id {
40 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>)
41 | -> Result<(), std::fmt::Error>
42 | {
43 | write!(f, "{}", self.value)
44 | }
45 | }
46 |
47 | impl PartialEq> for Id {
48 | fn eq(&self, other: &Id) -> bool {
49 | self.value.eq(&other.value)
50 | }
51 | }
52 |
53 | impl Add for Id {
54 | type Output = Self;
55 |
56 | fn add(self, other: u64) -> Self {
57 | Id::::from(self.value + other)
58 | }
59 | }
60 |
61 | impl AddAssign for Id {
62 | fn add_assign(&mut self, other: u64) {
63 | self.value += other
64 | }
65 | }
66 |
67 | impl Sub for Id {
68 | type Output = Self;
69 |
70 | fn sub(self, other: u64) -> Self {
71 | Id::::from(self.value - other)
72 | }
73 | }
74 |
75 | impl SubAssign for Id {
76 | fn sub_assign(&mut self, other: u64) {
77 | self.value -= other
78 | }
79 | }
80 |
81 | impl Sub> for Id {
82 | type Output = u64;
83 |
84 | fn sub(self, other: Id) -> u64 {
85 | self.value - other.value
86 | }
87 | }
88 |
89 | impl From for Id {
90 | fn from(i: u64) -> Self {
91 | Id:: {
92 | _marker: PhantomData,
93 | value: i
94 | }
95 | }
96 | }
97 |
98 | impl From> for u64 {
99 | fn from(id: Id) -> Self {
100 | id.value
101 | }
102 | }
103 |
104 | impl Id {
105 | pub const fn constant(i: u64) -> Self {
106 | Id:: {
107 | _marker: PhantomData,
108 | value: i
109 | }
110 | }
111 |
112 | pub fn from_offset(offset: u64) -> Id {
113 | Id {
114 | _marker: PhantomData,
115 | value: offset / size_of::() as u64,
116 | }
117 | }
118 |
119 | pub fn offset(&self) -> u64 {
120 | self.value * size_of::() as u64
121 | }
122 |
123 | pub fn offset_range(&self) -> Range {
124 | let size = size_of::() as u64;
125 | let start = self.value * size;
126 | let end = start + size;
127 | start..end
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/tests/hid/amp/reference.txt:
--------------------------------------------------------------------------------
1 |
2 | ○ Input report #3 (2 bytes):
3 | ├── Volume Increment: byte 1 bit 0
4 | ├── Volume Decrement: byte 1 bit 1
5 | ├── Play/Pause: byte 1 bit 2
6 | ├── Voice Command: byte 1 bit 3
7 | ├── Scan Previous Track: byte 1 bit 4
8 | ├── Scan Next Track: byte 1 bit 5
9 | └── Padding: byte 1 bits 6-7
10 |
11 | ○ Input report #5 (17 bytes):
12 | ├── Consumer usage 0x00: byte 1 (values 0 to 1)
13 | ├── Consumer usage 0x00: byte 2 (values 0 to 1)
14 | ├── Consumer usage 0x00: byte 3 (values 0 to 1)
15 | ├── Consumer usage 0x00: byte 4 (values 0 to 1)
16 | ├── Consumer usage 0x00: byte 5 (values 0 to 1)
17 | ├── Consumer usage 0x00: byte 6 (values 0 to 1)
18 | ├── Consumer usage 0x00: byte 7 (values 0 to 1)
19 | ├── Consumer usage 0x00: byte 8 (values 0 to 1)
20 | ├── Consumer usage 0x00: byte 9 (values 0 to 1)
21 | ├── Consumer usage 0x00: byte 10 (values 0 to 1)
22 | ├── Consumer usage 0x00: byte 11 (values 0 to 1)
23 | ├── Consumer usage 0x00: byte 12 (values 0 to 1)
24 | ├── Consumer usage 0x00: byte 13 (values 0 to 1)
25 | ├── Consumer usage 0x00: byte 14 (values 0 to 1)
26 | ├── Consumer usage 0x00: byte 15 (values 0 to 1)
27 | └── Consumer usage 0x00: byte 16 (values 0 to 1)
28 |
29 | ○ Output report #4 (39 bytes):
30 | ├── Consumer usage 0x00: byte 1 (values 0 to 1)
31 | ├── Consumer usage 0x00: byte 2 (values 0 to 1)
32 | ├── Consumer usage 0x00: byte 3 (values 0 to 1)
33 | ├── Consumer usage 0x00: byte 4 (values 0 to 1)
34 | ├── Consumer usage 0x00: byte 5 (values 0 to 1)
35 | ├── Consumer usage 0x00: byte 6 (values 0 to 1)
36 | ├── Consumer usage 0x00: byte 7 (values 0 to 1)
37 | ├── Consumer usage 0x00: byte 8 (values 0 to 1)
38 | ├── Consumer usage 0x00: byte 9 (values 0 to 1)
39 | ├── Consumer usage 0x00: byte 10 (values 0 to 1)
40 | ├── Consumer usage 0x00: byte 11 (values 0 to 1)
41 | ├── Consumer usage 0x00: byte 12 (values 0 to 1)
42 | ├── Consumer usage 0x00: byte 13 (values 0 to 1)
43 | ├── Consumer usage 0x00: byte 14 (values 0 to 1)
44 | ├── Consumer usage 0x00: byte 15 (values 0 to 1)
45 | ├── Consumer usage 0x00: byte 16 (values 0 to 1)
46 | ├── Consumer usage 0x00: byte 17 (values 0 to 1)
47 | ├── Consumer usage 0x00: byte 18 (values 0 to 1)
48 | ├── Consumer usage 0x00: byte 19 (values 0 to 1)
49 | ├── Consumer usage 0x00: byte 20 (values 0 to 1)
50 | ├── Consumer usage 0x00: byte 21 (values 0 to 1)
51 | ├── Consumer usage 0x00: byte 22 (values 0 to 1)
52 | ├── Consumer usage 0x00: byte 23 (values 0 to 1)
53 | ├── Consumer usage 0x00: byte 24 (values 0 to 1)
54 | ├── Consumer usage 0x00: byte 25 (values 0 to 1)
55 | ├── Consumer usage 0x00: byte 26 (values 0 to 1)
56 | ├── Consumer usage 0x00: byte 27 (values 0 to 1)
57 | ├── Consumer usage 0x00: byte 28 (values 0 to 1)
58 | ├── Consumer usage 0x00: byte 29 (values 0 to 1)
59 | ├── Consumer usage 0x00: byte 30 (values 0 to 1)
60 | ├── Consumer usage 0x00: byte 31 (values 0 to 1)
61 | ├── Consumer usage 0x00: byte 32 (values 0 to 1)
62 | ├── Consumer usage 0x00: byte 33 (values 0 to 1)
63 | ├── Consumer usage 0x00: byte 34 (values 0 to 1)
64 | ├── Consumer usage 0x00: byte 35 (values 0 to 1)
65 | ├── Consumer usage 0x00: byte 36 (values 0 to 1)
66 | ├── Consumer usage 0x00: byte 37 (values 0 to 1)
67 | └── Consumer usage 0x00: byte 38 (values 0 to 1)
68 |
--------------------------------------------------------------------------------
/src/ui/row_data.rs:
--------------------------------------------------------------------------------
1 | //! GObject subclasses for row data in each UI view.
2 |
3 | use gtk::glib;
4 | use gtk::subclass::prelude::*;
5 |
6 | #[cfg(any(test, feature="record-ui-test"))]
7 | use gtk::prelude::Cast;
8 |
9 | use crate::item::{TrafficItem, DeviceItem};
10 | use crate::ui::tree_list_model::ItemNodeRc;
11 |
12 | /// Trait implemented by each of our row data types.
13 | pub trait GenericRowData- where Item: Clone {
14 | /// Create a row for the given node.
15 | fn new(node: Result, String>) -> Self where Self: Sized;
16 |
17 | /// Fetch the node for this row.
18 | fn node(&self) -> Result, String>;
19 | }
20 |
21 | /// Trait for converting an arbitrary GObject to one of our row data types.
22 | pub trait ToGenericRowData
- {
23 | #[cfg(any(test, feature="record-ui-test"))]
24 | fn to_generic_row_data(self) -> Box>;
25 | }
26 |
27 | /// Define the outer type exposed to our Rust code.
28 | macro_rules! row_data {
29 | ($row_data: ident, $item: ident) => {
30 | glib::wrapper! {
31 | pub struct $row_data(ObjectSubclass);
32 | }
33 |
34 | impl GenericRowData<$item> for $row_data {
35 | fn new(node: Result, String>) -> $row_data{
36 | let row: $row_data = glib::Object::new::<$row_data>();
37 | row.imp().node.replace(Some(node));
38 | row
39 | }
40 |
41 | fn node(&self) -> Result, String> {
42 | self.imp().node.borrow().as_ref().unwrap().clone()
43 | }
44 | }
45 |
46 | impl ToGenericRowData<$item> for glib::Object {
47 | #[cfg(any(test, feature="record-ui-test"))]
48 | fn to_generic_row_data(self) -> Box> {
49 | Box::new(self.downcast::<$row_data>().unwrap())
50 | }
51 | }
52 | }
53 | }
54 |
55 | // Repeat the above boilerplate for each row type.
56 | row_data!(TrafficRowData, TrafficItem);
57 | row_data!(DeviceRowData, DeviceItem);
58 |
59 | /// The internal implementation module.
60 | mod imp {
61 | use gtk::glib::{self, subclass::prelude::*};
62 | use std::cell::RefCell;
63 |
64 | use crate::item::{TrafficItem, DeviceItem};
65 | use crate::ui::tree_list_model::ItemNodeRc;
66 |
67 | /// Define the inner type to be used in the GObject type system.
68 | macro_rules! row_data {
69 | ($row_data: ident, $item: ident) => {
70 | #[derive(Default)]
71 | pub struct $row_data {
72 | pub(super) node: RefCell