{"id":49889310,"url":"https://github.com/santhsecurity/ebpfsieve","last_synced_at":"2026-05-15T20:09:17.424Z","repository":{"id":350118997,"uuid":"1205403710","full_name":"santhsecurity/ebpfsieve","owner":"santhsecurity","description":"Byte-frequency prefilter with optional eBPF offload","archived":false,"fork":false,"pushed_at":"2026-04-09T00:08:06.000Z","size":18801,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-09T01:23:29.500Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/santhsecurity.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-08T23:52:01.000Z","updated_at":"2026-04-09T00:08:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/santhsecurity/ebpfsieve","commit_stats":null,"previous_names":["santhsecurity/ebpfsieve"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/santhsecurity/ebpfsieve","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Febpfsieve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Febpfsieve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Febpfsieve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Febpfsieve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/santhsecurity","download_url":"https://codeload.github.com/santhsecurity/ebpfsieve/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Febpfsieve/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33078192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:05:40.333Z","status":"ssl_error","status_checked_at":"2026-05-15T20:05:38.672Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-05-15T20:09:16.507Z","updated_at":"2026-05-15T20:09:17.383Z","avatar_url":"https://github.com/santhsecurity.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ebpfsieve\n\nByte-frequency prefilter for read-heavy scanning pipelines, with optional eBPF offload.\n\n## What it does\n\n`ebpfsieve` slides a fixed-size window over byte streams and reports candidate windows where all required byte-count thresholds are met. The idea is to cheaply reject data before handing it to a more expensive verifier.\n\n- **Userspace filtering** — pure Rust, no dependencies on kernel features.\n- **Lazy iteration** — `matching_windows_iter` yields matches one at a time without allocating a `Vec`.\n- **Chunked readers** — attach the filter to any `Read` impl and get per-chunk candidate ranges with automatic carry-over across chunk boundaries.\n- **Optional eBPF** — on Linux with the right features enabled, compile and load classic BPF socket filters or `aya`-based `fentry/vfs_read` probes.\n\n## Quick start\n\n```rust\nuse ebpfsieve::{ByteFrequencyFilter, ByteThreshold};\n\nlet filter = ByteFrequencyFilter::new([\n    ByteThreshold::new(b'a', 3),\n])?\n.with_window_size(5)?;\n\nlet matches = filter.matching_windows(b\"xyzaaaxyz\");\nassert_eq!(matches[0].offset, 1); // \"yzaaa\"\n```\n\n## Filtering model\n\nA `ByteFrequencyFilter` is built from one or more `ByteThreshold` values. A window matches when **every** threshold is satisfied. Counts are maintained in a `u16` histogram with saturating arithmetic, so very long windows are safe from overflow.\n\n## Reading files in chunks\n\n```rust\nuse ebpfsieve::{ByteFrequencyFilter, ByteThreshold};\nuse std::fs::File;\n\nlet filter = ByteFrequencyFilter::new([ByteThreshold::new(b'x', 2)])?\n    .with_window_size(64)?\n    .with_chunk_size(4096)?;\n\nlet mut file = File::open(\"data.bin\")?;\nlet matches = filter.scan_file(\u0026mut file, Some(1_000_000))?;\n```\n\n## Lazy iteration\n\nFor internet-scale scanning, avoid collecting all matches into a `Vec`:\n\n```rust\nlet filter = ByteFrequencyFilter::new([ByteThreshold::new(b'a', 1)])?;\nlet mut iter = filter.matching_windows_iter(b\"banana\");\nif let Some(first) = iter.next() {\n    println!(\"first match at offset {}\", first.offset);\n}\n```\n\n## Optional features\n\n- **`serde`** — load filter rules from TOML with `from_toml_str` / `from_toml_file`.\n- **`socket-bpf`** — compile and load classic `BPF_PROG_TYPE_SOCKET_FILTER` programs via `ebpfkit` (Linux only).\n- **`kernel-bpf`** — load `aya`-based `fentry/vfs_read` probes (Linux ≥ 5.8, BTF, root required).\n\n## Errors\n\nAll fallible operations return `ebpfsieve::Result\u003cT\u003e`. Errors carry actionable messages, for example:\n\n```text\ninvalid filter configuration: window_size cannot be zero. Fix: provide a window_size of at least 1\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanthsecurity%2Febpfsieve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanthsecurity%2Febpfsieve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanthsecurity%2Febpfsieve/lists"}