neodyland/forsmost

GitHub: neodyland/forsmost

用 Rust 实现的 Foremost 风格文件雕刻工具,可从磁盘镜像或数据流中按文件签名恢复已删除文件并生成审计报告。

Stars: 0 | Forks: 0

# forsmost [![Crates.io](https://img.shields.io/crates/v/forsmost.svg)](https://crates.io/crates/forsmost) [![文档](https://docs.rs/forsmost/badge.svg)](https://docs.rs/forsmost) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/cd832674f0095349.svg)](https://github.com/neodyland/forsmost/actions/workflows/ci.yml) [![许可证: MIT OR Apache-2.0](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg)](#license) `forsmost` 是 Foremost 风格文件雕刻(file carving)的 Rust 实现。它扫描输入流或磁盘镜像以查找已配置的文件签名,将恢复出的文件写入按类型分类的输出目录中,并生成一份 `audit.txt` 报告。 该 crate 没有直接捆绑(vendor)或要求使用原始的 Foremost 源码树。可选的兼容性测试可以与外部 Foremost 可执行文件进行比较,前提是开发者提供了该可执行文件。 ## 安装说明 ``` cargo install forsmost ``` ## 使用方法 从输入镜像中恢复 JPEG 文件: ``` forsmost -t jpg -o output image.dd ``` 恢复多种内置类型: ``` forsmost -t jpg,pdf,zip image.dd ``` 使用自定义签名配置文件: ``` forsmost -c foremost.conf -o output image.dd ``` 从标准输入读取: ``` cat image.dd | forsmost -t png -o output ``` 常用选项: ``` -t Built-in file selectors, comma-separated -c Configuration file, default is foremost.conf -o Output directory, default is output -i Input file, default is stdin -q Quick mode, check only block boundaries -Q Quiet mode -a Write a header dump when validation cannot determine a file end -w Write only audit entries, not recovered files -T Append a timestamp to the output directory name ``` ## 内置选择器 内置选择器包括常见的图像、归档、办公文档、可执行文件、媒体和注册表格式: ``` avi, bmp, cpp, doc, docx, elf, exe, gif, gz, html, jpg, mov, mp4, mpg, ole, pdf, png, ppt, pptx, rar, reg, rif, sxc, sxi, sxw, wav, wmv, wpd, xls, xlsx, zip ``` 使用 `all` 可启用默认的 Foremost 风格选择器集合。 ## 功能特性 默认特性: ``` default = ["gzip"] ``` 特性标志: ``` gzip Enables gzip stream validation and recovery through flate2. ``` 禁用 gzip 支持和 `flate2` 依赖: ``` cargo install forsmost --no-default-features ``` ## 相较于 Foremost 1.5.7 的修复 该 Rust 实现在对比测试涵盖的常见用例中保持了与 Foremost 兼容的输出,但它也修复了几个已确认的 Foremost 1.5.7 恢复 Bug。目前经验证的修复数量为 8 项: - 自顶向下的 BMP 图像现在能被正确恢复,而不是被拒绝。 - 第一个片段为 APP2 的 JPEG 文件(例如 ICC 配置文件在前的 JPEG),现在能被正确恢复,而不是被仅限 JFIF 的路径拒绝。 - RIFF AVI/WAV 输出正确使用了 RIFF 块大小,并保留了 Foremost 截断的最后 8 个字节。 - Access CFB/OLE 流写入时使用了真实的 `.mdb` 后缀,修正了 Foremost 中 `.mbd` 的拼写错误。 - 4096 字节扇区的 CFB/OLE 文件现在能被正确恢复。 - 即使 `[Content_Types].xml` 出现在特定文档的本地条目之后,Office 2007 ZIP 文件也会被分类为 `docx`、`pptx` 或 `xlsx`。 - 注册表配置单元的恢复已被正确分发调用;Foremost 1.5.7 虽定义了提取器,但并未对 `reg` 进行调用。 - 在 Windows 上,恢复出的二进制文件将以逐字节方式写入。原生 Foremost 以文本模式打开恢复的文件,这可能会将 LF 字节转换为 CRLF,从而破坏图像。 此数量涵盖了由测试或 Windows 二进制输出检查验证过的 Bug。测试套件包含了额外的边缘情况覆盖,但除非它们被确认为 Foremost 1.5.7 的回归问题,否则不计入此数量。 ## 开发说明 ``` cargo fmt -- --check cargo clippy --all-targets -- -D warnings cargo test cargo test --no-default-features cargo package --list cargo publish --dry-run ``` 被忽略的 `compare_foremost` 测试需要通过 `FOREMOST_BIN` 或 `FOREMOST_WSL_BIN` 来指向原始的 Foremost 可执行文件。 ## 许可证 根据以下任一许可证授权: - Apache License, Version 2.0 - MIT license 您可任选其一。
标签:CLI, Crates.io, Foremost替代品, GhostArchive, HTTP工具, JPEG恢复, PDF恢复, Rust, TUI/CLI工具, WiFi技术, ZIP恢复, 二进制分析, 云安全运维, 可视化界面, 库, 应急响应, 开源, 数字取证, 数据恢复, 数据提取, 数据隐写, 文件签名恢复, 文件雕刻, 碎片恢复, 磁盘取证, 磁盘镜像扫描, 网络信息收集, 网络流量审计, 自动化脚本, 通知系统