{"id":13775284,"url":"https://github.com/courvoif/pcap-file","last_synced_at":"2025-06-13T22:09:25.845Z","repository":{"id":38421255,"uuid":"95354304","full_name":"courvoif/pcap-file","owner":"courvoif","description":"Crate to read and write pcap and pcapng files in RUST.","archived":false,"fork":false,"pushed_at":"2025-06-13T16:46:19.000Z","size":269,"stargazers_count":44,"open_issues_count":3,"forks_count":21,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-13T17:42:29.192Z","etag":null,"topics":["pcap","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/courvoif.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-06-25T10:59:03.000Z","updated_at":"2025-06-08T20:25:49.000Z","dependencies_parsed_at":"2024-08-03T17:09:57.888Z","dependency_job_id":"4978744c-f0b3-4a15-8b9a-92596cce3f1d","html_url":"https://github.com/courvoif/pcap-file","commit_stats":{"total_commits":113,"total_committers":10,"mean_commits":11.3,"dds":0.5752212389380531,"last_synced_commit":"b84ebe50893619d3c39d1105589962d23598b9a1"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/courvoif/pcap-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courvoif%2Fpcap-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courvoif%2Fpcap-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courvoif%2Fpcap-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courvoif%2Fpcap-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/courvoif","download_url":"https://codeload.github.com/courvoif/pcap-file/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/courvoif%2Fpcap-file/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259694898,"owners_count":22897493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pcap","rust"],"created_at":"2024-08-03T17:01:36.323Z","updated_at":"2025-06-13T22:09:25.802Z","avatar_url":"https://github.com/courvoif.png","language":"Rust","funding_links":[],"categories":["\u003ca id=\"f13469c9891173804423be4403b2c4ff\"\u003e\u003c/a\u003epcap"],"sub_categories":["\u003ca id=\"eb49514924c3f4bf2acf6f3a4436af13\"\u003e\u003c/a\u003e未分类"],"readme":"# pcap-file\n\nProvides parsers, readers and writers for Pcap and PcapNg files.\n\nFor Pcap files see the pcap module.\n\nFor PcapNg files see the pcapng module.\n\n[![Crates.io](https://img.shields.io/crates/v/pcap-file.svg)](https://crates.io/crates/pcap-file)\n[![rustdoc](https://img.shields.io/badge/Doc-pcap--file-green.svg)](https://docs.rs/pcap-file/)\n[![Crates.io](https://img.shields.io/crates/l/pcap-file.svg)](https://github.com/courvoif/pcap-file/blob/master/LICENSE)\n\n## Documentation\n\n\u003chttps://docs.rs/pcap-file\u003e\n\n## Installation\n\nThis crate is on [crates.io](https://crates.io/crates/pcap-file).\nAdd it to your `Cargo.toml`:\n\n```toml\n[dependencies]\npcap-file = \"3.0.0-rc1\"\n```\n\n## Examples\n\n### PcapReader\n\n```rust,no_run\nuse std::fs::File;\nuse pcap_file::pcap::PcapReader;\n\nlet file_in = File::open(\"test.pcap\").expect(\"Error opening file\");\nlet mut pcap_reader = PcapReader::new(file_in).unwrap();\n\n// Read test.pcap\nwhile let Some(pkt) = pcap_reader.next_packet() {\n    //Check if there is no error\n    let pkt = pkt.unwrap();\n\n    //Do something\n }\n```\n\n### PcapNgReader\n\n```rust,no_run\nuse std::fs::File;\nuse pcap_file::pcapng::PcapNgReader;\n\nlet file_in = File::open(\"test.pcapng\").expect(\"Error opening file\");\nlet mut pcapng_reader = PcapNgReader::new(file_in).unwrap();\n\n// Read test.pcapng\nwhile let Some(block) = pcapng_reader.next_block() {\n    // Check if there is no error\n    let block = block.unwrap();\n\n    //  Do something\n}\n```\n\n## Fuzzing\n\nCurrently 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:\n\n```bash\n$ cargo install cargo-fuzz\n```\n\nAnd then, in the root of the repository, you can run the harnesses as:\n\n```bash\n$ cargo fuzz run pcap_reader\n$ cargo fuzz run pcap_ng_reader\n$ cargo fuzz run pcap_parser\n$ cargo fuzz run pcap_ng_parser\n```\n\nKeep 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](https://llvm.org/docs/LibFuzzer.html).\nTo get better crash reports add to you rust flags: `-Zsanitizer=address`.\nE.g.\n\n```bash\nRUSTFLAGS=\"-Zsanitizer=address\" cargo fuzz run pcap_reader\n```\n\n## License\n\nLicensed under MIT.\n\n## Disclaimer\n\nTo test the library I used the excellent PcapNg testing suite provided by [hadrielk](https://github.com/hadrielk/pcapng-test-generator).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcourvoif%2Fpcap-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcourvoif%2Fpcap-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcourvoif%2Fpcap-file/lists"}