SecurityRonin/forensic-hashdb

GitHub: SecurityRonin/forensic-hashdb

一个 Rust 数字取证哈希查询库,整合已知良好文件、已知恶意软件、脆弱驱动和自定义 IOC 四类哈希数据库,支持通过单次查找完成文件分诊。

Stars: 0 | Forks: 0

# forensic-hashdb [![Crates.io](https://img.shields.io/crates/v/forensic-hashdb.svg)](https://crates.io/crates/forensic-hashdb) [![docs.rs](https://img.shields.io/docsrs/forensic-hashdb)](https://docs.rs/forensic-hashdb) [![Rust 1.75+](https://img.shields.io/badge/rust-1.75%2B-blue.svg)](https://www.rust-lang.org) [![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) [![Sponsor](https://img.shields.io/badge/sponsor-h4x0r-ea4aaa?logo=github-sponsors)](https://github.com/sponsors/h4x0r) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/SecurityRonin/forensic-hashdb/actions/workflows/ci.yml) [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)](https://github.com/SecurityRonin/forensic-hashdb/actions/workflows/ci.yml) [![Security audit](https://img.shields.io/badge/security-audit-brightgreen.svg)](https://github.com/SecurityRonin/forensic-hashdb/actions/workflows/ci.yml) **只需一次查找即可通过哈希值将任何文件分桶——是已知良好且可安全忽略的、已知的恶意软件,还是已知的易受攻击驱动程序——无论这些字节来自内存转储还是磁盘映像。** 哈希匹配与来源无关。`forensic-hashdb` 是整个机群中用于回答“我以前见过这个哈希吗?”的统一场所——四个数据库位于 `&[u8; 32]`(或十六进制)键之后,专为分诊优化:排除噪音,标记威胁。 ## 四大数据库 ``` use forensic_hashdb::known_good::KnownGoodDb; use forensic_hashdb::lol_drivers; // Exclude the noise: NSRL/CIRCL known-legitimate files (zero false positives). let nsrl = KnownGoodDb::open("nsrl.bin".as_ref())?; if nsrl.is_known_good(&sha256) { return; // an OS/app file — skip it, don't clutter the timeline } // Flag a BYOVD driver by hash (embedded, no file to ship). if lol_drivers::is_vulnerable_driver(&sha256) { // known-vulnerable Windows driver (loldrivers.io) } # Ok::<(), forensic_hashdb::known_good::KnownGoodError>(()) ``` | 数据库 | 回答 | 底层实现 | |---|---|---| | `known_good` | “能排除的合法 OS/应用文件?” — NSRL / CIRCL | mmap,排序的 32 字节记录,二分查找(可扩展至完整 NSRL) | | `known_bad` | “已知的恶意软件?” — 来源可追踪(MalwareBazaar、VirusShare 等) | `HashMap`,命中时返回完整的 `BadFileInfo` | | `lol_drivers` | “已知易受攻击的驱动程序 (BYOVD)?” — loldrivers.io | 编译时内嵌,附带 CVE 标签 | | `feed` | “在*我的* IOC 列表中?” — 分析师提供的 MD5/SHA1/SHA256,从文本/CSV 加载 | 内存中,按算法区分 | ## 分析师 feed 在运行时加载任意哈希列表——每行一个哈希,支持 `#` 注释,取第一个 CSV 字段,算法根据长度自动检测: ``` use forensic_hashdb::feed::HashFeed; let mut feed = HashFeed::new("threatfox"); feed.load_bad_from_file("iocs.csv".as_ref())?; if let Some(m) = feed.lookup_bad(&hex_hash) { // m.algorithm, m.source — provenance for the report } # Ok::<(), forensic_hashdb::feed::FeedError>(()) ``` ## 信任但验证 - `known_good` 上**零误报** — 精确的二分查找,无概率结构,可安全用于取证排除。 - **无 panic。** `unsafe_code = deny`(一处有限的 `mmap` 调用,已证明合理);生产环境中无 `unwrap`/`expect`;有限读取。 - **经过模糊测试** — 二进制数据库读取器和 feed 加载器可接受任意字节而不会引发 panic。 - **100% 行覆盖率。** 整个机群的内存分诊路径和磁盘/扫描路径都在使用它——这是一个统一的哈希查找能力,而不是两个独立的。 [隐私政策](https://securityronin.github.io/forensic-hashdb/privacy/) · [服务条款](https://securityronin.github.io/forensic-hashdb/terms/) · © 2026 Security Ronin Ltd
标签:DAST, DNS 反向解析, Rust, Web报告查看器, 可视化界面, 威胁情报, 开发者工具, 恶意软件分析, 数字取证, 文件哈希, 网络流量审计, 自动化脚本, 通知系统