#packet-parser #parser #wifi #packet

radiotap

Radiotap 捕获格式的解析器。请参阅 http://www.radiotap.org。

4 个稳定版本

使用旧的 Rust 2015

2.0.0-beta.1 2020年9月1日
1.3.0 2018年9月21日
1.2.0 2018年6月26日
1.1.0 2018年6月26日
1.0.0 2018年5月24日

#1707解析器实现

Download history 142/week @ 2024-03-13 144/week @ 2024-03-20 187/week @ 2024-03-27 164/week @ 2024-04-03 108/week @ 2024-04-10 142/week @ 2024-04-17 140/week @ 2024-04-24 149/week @ 2024-05-01 252/week @ 2024-05-08 184/week @ 2024-05-15 278/week @ 2024-05-22 209/week @ 2024-05-29 208/week @ 2024-06-05 148/week @ 2024-06-12 138/week @ 2024-06-19 171/week @ 2024-06-26

683 每月下载量
用于 nearby

Apache-2.0/MIT

55KB
1K SLoC

radiotap

crates.io docs.rs

Radiotap 捕获格式的解析器。

入门指南

使用以下命令将库添加到您的项目中

cargo add radiotap

或直接编辑您的 Cargo.toml

[dependencies]
radiotap = "1.0.0"

有关文档,请参阅 此处

示例用法

有关更多示例,请参阅 examples/

Radiotap::from_bytes(&capture) 构造函数将解析所有现有字段到 Radiotap 结构体中。

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);

如果您只想解析 Radiotap 捕获中的几个特定字段,可以使用 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);
        },
        _ => {}
    }
}

许可证

该项目在 Apache 2.0 许可证和 MIT 许可证下双重许可。请参阅 LICENSE-APACHELICENSE-MIT 文件。

依赖关系

~280–375KB