SecurityRonin/forensic-vfs-engine

GitHub: SecurityRonin/forensic-vfs-engine

一款 Rust 编写的取证虚拟文件系统引擎,通过单次调用自动检测并挂载各种磁盘镜像格式的只读文件系统。

Stars: 0 | Forks: 0

# forensic-vfs-engine [![Crates.io](https://img.shields.io/crates/v/forensic-vfs-engine.svg)](https://crates.io/crates/forensic-vfs-engine) [![Docs.rs](https://img.shields.io/docsrs/forensic-vfs-engine)](https://docs.rs/forensic-vfs-engine) [![Rust 1.88+](https://img.shields.io/badge/rust-1.88%2B-orange.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.svg)](https://github.com/sponsors/h4x0r) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/SecurityRonin/forensic-vfs-engine/actions/workflows/ci.yml) [![Coverage](https://img.shields.io/badge/coverage-100%25%20lines-brightgreen.svg)](https://github.com/SecurityRonin/forensic-vfs-engine/actions/workflows/ci.yml) [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) [![Security audit](https://img.shields.io/badge/security-cargo--deny%20%2B%20vet-brightgreen.svg)](deny.toml) **只需一个 `Vfs::open(path)` —— 将其指向任何磁盘镜像,即可获取一个已挂载的、只读的文件系统。** `forensic-vfs-engine` 是 [`forensic-vfs`](https://crates.io/crates/forensic-vfs) 之上的注册表 + 解析器: 它嗅检证据的 container → volume-system → filesystem 栈,并将其识别到的第一个文件系统挂载为 `dyn FileSystem`。 它是一个负责编排(ORCHESTRATION)的 crate,将每个 SecurityRonin 阵列读取器(fleet reader)接入到 单一的检测并挂载调用中,因此您再也不需要手动编写镜像格式的适配阶梯了。 ## 核心摘要 ``` use forensic_vfs_engine::{walk, Vfs}; use std::path::Path; // Detect the stack (EWF → MBR → NTFS, DMG → HFS+, raw ext4, …) and mount it. let evidence = Vfs::new().open(Path::new("disk.E01"))?; let Some(fs) = evidence.fs else { // A source nothing recognizes — a clean unknown, never a silent error. return Ok(()); }; // The locator records the exact open-recipe: e.g. "…/container:ewf/vol:mbr/fs:ntfs". println!("{}", evidence.root.to_uri()); for entry in walk(fs.as_ref())? { if let Some(name) = entry.path.last() { println!("{}", String::from_utf8_lossy(name)); } } # Ok::<(), forensic_vfs::VfsError>(()) ``` ``` [dependencies] forensic-vfs-engine = "0.1" ``` ## 开箱即用 —— 内置编译所有阵列读取器 零配置构建会注册整个阵列;在取证工作站上无需再进行 `--features` 的繁琐配置。 | 层级 | 读取器 | |---|---| | **Container** | EWF/E01 ✅ · VHD ✅ · VHDX ✅ · VMDK ✅ · QCOW2 ✅ · DMG ✅ · AFF4 ✅ | | **Volume system** | MBR ✅ · GPT ✅ · APM ✅ | | **Filesystem** | NTFS ✅ · ext2/3/4 ✅ · XFS ✅ · ISO 9660 ✅ · APFS ✅ · HFS+/HFSX ✅ · exFAT ✅ · FAT12/16/32 ✅ | 嵌套关系会自动解析 —— `EWF → GPT → NTFS`、`DMG → APM → HFS+`、 `AFF4(Zip) → ext4` —— 直到达到有限的递归深度为止(作为解压炸弹防护)。 ## 快照 —— `[H]` 状态历史切入点 ``` # use forensic_vfs_engine::Vfs; # use std::path::Path; let cohort = Vfs::new().snapshots(Path::new("mac.dmg"))?; // Vec, time-ordered for view in &cohort { let mounted = Vfs::new().open_snapshot(Path::new("mac.dmg"), view.xid())?; let _ = mounted; } # Ok::<(), forensic_vfs::VfsError>(()) ``` 没有 APFS 文件系统的证据会产生一个**空**队列 —— 这是真正的“此处无快照”状态,而不是报错。 ## 信任但验证 - **输入模糊测试** —— `fuzz_resolve` 驱动 `Vfs::open_source` 处理任意 字节;其不变式原则是 *解析由攻击者可控的磁盘字节绝对不能引发 panic*。每个底层读取器都带有其自身的逐结构 fuzz 目标。 - **通过 lint 保证无 panic** —— 在生产代码中执行 `unsafe_code = forbid`、`clippy::unwrap_used` / `expect_used = deny`,并基于经过边界检查的读取器。 - **基于真实工件验证** —— 每个端到端测试都会解析真实的、经过预言机验证的测试固件(TSK / `hdiutil` / `qemu-img` / `pyewf`),并确认 已知的基准文件浮现。参见 [`docs/validation.md`](docs/validation.md)。 ## 解析原理 ``` flowchart LR P["Vfs::open(path)"] --> B["open base source (EWF by path, else raw file)"] B --> S["sniff head + tail (one bounded read)"] S --> C{"container?"} C -- yes --> B S --> V{"volume system?"} V -- yes --> B S --> F{"filesystem?"} F -- yes --> M["mount dyn FileSystem + record PathSpec locator"] F -- no --> N["Evidence { fs: None } (clean unknown)"] ``` [隐私政策](https://securityronin.github.io/forensic-vfs-engine/privacy/) · [服务条款](https://securityronin.github.io/forensic-vfs-engine/terms/) · © 2026 Security Ronin Ltd
标签:Rust, 可视化界面, 数字取证, 文件系统, 磁盘镜像, 网络流量审计, 自动化脚本, 虚拟文件系统, 通知系统