#packet-parser #parser #packet #wifi

radiotap

A parser for the Radiotap capture format. See http://www.radiotap.org.

4 stable releases

Uses old Rust 2015

2.0.0-beta.1 Sep 1, 2020
1.3.0 Sep 21, 2018
1.2.0 Jun 26, 2018
1.1.0 Jun 26, 2018
1.0.0 May 24, 2018

#1628 in Parser implementations

Download history 148/week @ 2024-06-09 157/week @ 2024-06-16 186/week @ 2024-06-23 111/week @ 2024-06-30 143/week @ 2024-07-07 121/week @ 2024-07-14 155/week @ 2024-07-21 135/week @ 2024-07-28 182/week @ 2024-08-04 237/week @ 2024-08-11 183/week @ 2024-08-18 172/week @ 2024-08-25 172/week @ 2024-09-01 262/week @ 2024-09-08 166/week @ 2024-09-15 253/week @ 2024-09-22

863 downloads per month
Used in nearby

Apache-2.0/MIT

55KB
1K SLoC

radiotap

crates.io docs.rs

A parser for the Radiotap capture format.

Getting started

Add to your project with

cargo add radiotap

or directly editing your Cargo.toml

[dependencies]
radiotap = "1.0.0"

See the documentation here.

Example usage

See examples/ for more.

The Radiotap::from_bytes(&capture) constructor will parse all present fields into a Radiotap struct:

let capture = [
    0, 0, 56, 0, 107, 8, 52, 0, 185, 31, 155, 154, 0, 0, 0, 0, 20, 0, 124, 21, 64, 1, 213,
    166, 1, 0, 0, 0, 64, 1, 1, 0, 124, 21, 100, 34, 249, 1, 0, 0, 0, 0, 0, 0, 255, 1, 80,
    4, 115, 0, 0, 0, 1, 63, 0, 0
];

let radiotap = Radiotap::from_bytes(&capture).unwrap();
println!("{:?}", radiotap.vht);

If you just want to parse a few specific fields from the Radiotap capture you can create an iterator using RadiotapIterator::from_bytes(&capture):

let capture = [
    0, 0, 56, 0, 107, 8, 52, 0, 185, 31, 155, 154, 0, 0, 0, 0, 20, 0, 124, 21, 64, 1, 213,
    166, 1, 0, 0, 0, 64, 1, 1, 0, 124, 21, 100, 34, 249, 1, 0, 0, 0, 0, 0, 0, 255, 1, 80,
    4, 115, 0, 0, 0, 1, 63, 0, 0
];

for element in RadiotapIterator::from_bytes(&capture).unwrap() {
    match element {
        Ok((field::Kind::VHT, data)) => {
            let vht: field::VHT = field::from_bytes(data).unwrap();
            println!("{:?}", vht);
        },
        _ => {}
    }
}

License

This project is dual licensed under the Apache 2.0 License and the MIT License. See the LICENSE-APACHE and LICENSE-MIT files.

Dependencies

~270–370KB