pcap-file-tokio
Fork of the awesome pcap-file crate, modified to support tokio.
Provides parsers, readers and writers for Pcap and PcapNg files.
For Pcap files see the pcap module.
For PcapNg files see the pcapng module.
Documentation
https://docs.rs/pcap-file-tokio
Installation
This crate is on crates.io.
Add it to your Cargo.toml
:
[]
= "2.0.0-rc1"
Examples
PcapReader
use File;
use PcapReader;
async
PcapNgReader
use File;
use PcapNgReader;
async
Fuzzing
Currently there are 4 crude harnesses to check that the parser won't panic in any situation. To start fuzzing you must install cargo-fuzz
with the command:
And then, in the root of the repository, you can run the harnesses as:
Keep in mind that libfuzzer by default uses only one core, so you can either run all the harnesses in different terminals, or you can pass the -jobs
and -workers
attributes. More info can be found in its documentation here.
To get better crash reports add to you rust flags: -Zsanitizer=address
.
E.g.
RUSTFLAGS="-Zsanitizer=address"
License
Licensed under MIT.
Disclaimer
To test the library I used the excellent PcapNg testing suite provided by hadrielk.