https://github.com/otsmr/pnet_show
Derive a `show` function for pnet_packet's to display the struct similar to scapy.
https://github.com/otsmr/pnet_show
Last synced: 11 months ago
JSON representation
Derive a `show` function for pnet_packet's to display the struct similar to scapy.
- Host: GitHub
- URL: https://github.com/otsmr/pnet_show
- Owner: otsmr
- Created: 2025-08-11T20:32:30.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-11T20:37:56.000Z (11 months ago)
- Last Synced: 2025-08-11T22:16:10.773Z (11 months ago)
- Language: Rust
- Homepage: https://crates.io/crates/pnet_show
- Size: 1.95 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pnet_show
`pnet_show` is a `proc-macro` crate, that derives a `.show()` function for [pnet_packet](https://docs.rs/pnet_packet/latest/pnet_packet/)'s to display the struct similar to scapy.
First define your struct and add the derive `Show`.
```rs
#[packet]
#[derive(Show)]
pub struct Tether {
version: u8,
unknown0: u8,
tether_type: u8,
unknown1: u8,
length: u16be,
unknown2: u16be,
unknown3: u32be,
crc32: u32be,
options: u16be,
function_id: u16be,
#[payload]
payload: Vec,
}
```
Calling now `.show()` will then return a string displaying the struct including the values as follow:
```plain
##[ Tether ]##
version: 1
unknown0: 0
tether_type: 5
unknown1: 0
length: 8
unknown2: 0
unknown3: 12
cr032: 1035144919
options: 257
function_id: 1601
```