引擎版本: V13 | 最后更新: 2026-07-02 | 实测环境: Windows 11, RTX 5090 24G, 20核CPU
7884 结构归纳引擎是一个 二进制格式分析工具。你给它几个同类型的文件(比如几个 BMP 图片),它能自动分析出这些文件的结构,并帮你做以下事情:
| 场景 | 具体用途 |
|---|---|
| 逆向未知格式 | 拿到一个不知道结构的二进制文件,让引擎帮你分析出字段、偏移、类型 |
| 生成结构描述 | 自动生成 Python 校验脚本、010 Editor 模板、YARA 规则等 |
| 批量变异测试 | 基于分析结果,自动生成大量变异样本用于模糊测试 |
| 格式校验 | 使用生成的 Python 脚本验证文件是否合法 |
一句话总结:给样本 → 出结构 → 测变异。
| 角色 | 能用它做什么 |
|---|---|
| 安全研究员 | 逆向分析未知二进制格式,生成 Fuzzing 样本 |
| 逆向工程师 | 快速理解文件结构,获得 010 Editor 模板 |
| 漏洞挖掘工程师 | 使用 Gen 模式批量生成变异样本 |
| 工具 | 你的工作 | 7884 能帮你 |
|---|---|---|
| 010 Editor | 手动分析二进制 | 自动生成 .bt 模板 |
| Kaitai Struct | 声明式格式定义 | 自动生成 .ksy 文件 |
| YARA | 恶意样本匹配 | 自动生成 .yar 规则 |
| AFL++ | 覆盖引导模糊测试 | 自动生成 .dict 字典 |
| 项目 | 最低要求 | 推荐 |
|---|---|---|
| 操作系统 | Windows 10 x64 | Windows 11 x64 |
| 内存 | 4 GB | 8 GB+ |
| CPU | 4 核 | 8 核+ |
| GPU(可选) | — | NVIDIA GPU,支持 CUDA |
| Python(可选) | Python 3.8+ | 运行配套脚本用 |
| 文件 | 说明 |
|---|---|
7884_brain.exe | 引擎主程序,包含全部功能 |
IFFA.exe | 辅助分析模块(由主程序自动调用) |
IFFA.exe 使用时有以下限制(从 V13 实测发现):
C:\My Samples\ 不行)${WORKSPACE}/
├── 7884_brain.exe # 引擎主程序
├── IFFA.exe # 辅助模块
├── test_samples/ # 存放样本
│ └── bmp/
│ ├── sample_100x100.bmp
│ ├── sample_200x150.bmp
│ └── sample_50x80.bmp
├── output/ # 分析结果会输出到这里
├── scripts/ # 配套 Python 脚本
└── docs/ # 文档
cd ${WORKSPACE}
.\7884_brain.exe
预期输出:显示引擎 Banner 和帮助信息。如果没有报错,说明引擎正常工作。
=================================================================
| 7 8 8 4 |
| Structure Induction Engine V13 by 20260628 |
=================================================================
| CPU Cores: 20 Memory: 32684 MB |
| CUDA: Available GPU Memory: 24 GB |
=================================================================
注意:引擎默认精简输出,正常运行时控制台只显示关键信息,详细日志写入文件。
本章用一个 BMP 文件分析流程,带你跑通全链路。跟着做就行,不用理解原理。
把待分析的二进制文件放到一个目录下:
# 确认样本存在(3 个不同尺寸的 BMP 文件)
dir ${WORKSPACE}\test_samples\bmp
预期输出:
sample_100x100.bmp sample_200x150.bmp sample_50x80.bmp
样本要求:至少 1 个,推荐 3-5 个同格式文件。文本文件(.txt/.md)会被自动跳过。
cd ${WORKSPACE}
.\7884_brain.exe --input test_samples/bmp --output output
预期输出:Banner 信息 + 分析进度。结束后退出码为 0。
如果报错:
CUDA manager 错误 → 你的 GPU 不支持 CUDA,改用 --cuda-disableDirectory is empty → 样本目录里没有二进制文件引擎完成后,在 output/ 下生成一个时间戳目录,例如 output_20260702_201821/。
实测数据(RTX 5090, 3个BMP样本):
| 指标 | 值 |
|---|---|
| 总耗时 | ~62.8 秒 |
| 其中 IFFA 分析 | ~45.9 秒(最耗时模块) |
| 发现字段数 | 257 |
| 发现关系数 | 1304 |
| 总体质量评分 | 0.78 |
打开生成的 HTML 报告:
start output/output_20260702_201821/structure_report.html
或者用配套脚本解析 JSON:
python scripts/03_output_reader.py --input output/output_20260702_201821/structure_report.json
输出示例:
=================================================================
字段结构树(共 257 个字段)
=================================================================
├─ [ 0] Magic_0x424D6675 类型: DWORD 偏移: 0 大小: 4
├─ [ 1] NullData_6_bytes 类型: WORD 偏移: 4 大小: 6
...
─────────────────────────────────────────────────────────────────
质量评分
─────────────────────────────────────────────────────────────────
quality_overall: 0.78 coverage: 1.0
consistency: 0.822 refutation: 0.4695
基于生成的 Peach XML 配置,生成 10 个变异样本:
.\7884_brain.exe --Gen output/output_20260702_201821/example/format_schema.xml -i 10
预期输出:
[*] Starting fuzzing, iterations 1-10
[*] Engine: Basic (default)
[*] Fuzzing completed. Generated 10 samples
遇到问题? Error: Failed to load XML → 确认 XML 文件路径正确。
# 列出生成的变异文件
dir ${WORKSPACE}\OutSample\*.bmp
到此完成!你已经跑通了 样本 → 分析 → 结果查看 → 变异生成 的完整流程。
对样本执行结构分析,输出结构描述文件。
基本语法:
7884_brain.exe --input <样本目录> --output <输出目录> [可选参数]
参数列表:
| 参数 | 说明 | 默认值 |
|---|---|---|
--input <dir> / -i | 输入样本目录(必填) | — |
--output <dir> / -o | 输出目录 | ./output |
--cuda-enable | 启用 CUDA 加速 | 自动检测 |
--cuda-disable | 禁用 CUDA | — |
--batch <num> | 批处理大小 | 128 |
--cpu-threads <num> | CPU 线程数 | 8 |
--max-iterations <num> | 最大训练迭代次数 | 100 |
--plugin-dir <dir> | Python 插件目录 | 无 |
--log <file> | 日志文件路径 | ./logs/run_log.txt |
实际可用命令:
# 完整模式(自动检测 CUDA)
7884_brain.exe --input test_samples/bmp --output output
# 无 GPU 时禁用 CUDA
7884_brain.exe --input test_samples/bmp --output output --cuda-disable
# 轻量模式(快速预览)
7884_brain.exe --input test_samples/bmp --output output --cuda-disable --max-iterations 50 --cpu-threads 4
# 指定插件目录
7884_brain.exe --input test_samples/bmp --output output --plugin-dir my_plugins
基于生成的 Peach XML 配置,批量生成变异样本。
基本语法:
7884_brain.exe --Gen <xml_file> [-i N] [-o PATH] [-s SEED] [--engine basic|pro]
参数列表:
| 参数 | 说明 | 默认值 |
|---|---|---|
--Gen <xml_file> | 启动 Gen 模式(必填) | — |
-i, --iterations <N> | 迭代次数 | 1000 |
-o, --output <path> | 输出路径模板 | fuzz_{0}.bin |
-s, --seed <N> | 随机种子(相同种子可复现) | 当前时间 |
--engine basic/pro | 变异引擎选择 | basic |
--range N,M | 断点续跑 | — |
-1 | 单次迭代(等价于 -i 1) | — |
实际可用命令:
# 基本用法(Basic 引擎,1000 次迭代)
7884_brain.exe --Gen output/xxx/example/format_schema.xml
# 指定迭代次数和输出路径
7884_brain.exe --Gen output/xxx/example/format_schema.xml -i 100 -o "fuzz\{0}.bin"
# Pro 引擎 + 指定种子(可复现)
7884_brain.exe --Gen output/xxx/example/format_schema.xml --engine pro -i 500 -s 42
# 断点续跑(从第 10 次跑到第 20 次)
7884_brain.exe --Gen output/xxx/example/format_schema.xml --range 10,20
# 单次变异快速测试
7884_brain.exe --Gen output/xxx/example/format_schema.xml -1
| 退出码 | 含义 | 怎么办 |
|---|---|---|
0 | 成功 | 去输出目录看结果 |
1 | 失败 | 看控制台错误信息,参考第 10 章故障排除 |
引擎通过组合参数实现不同的运行模式。注意:引擎没有 --mode 参数,你需要手动组合以下参数。
7884_brain.exe --input test_samples/bmp --output output
7884_brain.exe --input test_samples/bmp --output output --cuda-disable
7884_brain.exe --input test_samples/bmp --output output --cuda-disable --max-iterations 50 --cpu-threads 4
| 模式 | 总耗时 | IFFA 耗时 | 说明 |
|---|---|---|---|
| 完整 | ~62.8 秒 | ~45.9 秒 | 完整管线,GPU 推理 |
| 仅 CPU | 更慢 | ~45.9 秒 | ML 推理在 CPU 执行 |
| 轻量 | ~60 秒 | ~45.9 秒 | 跳过 GPU 推理 |
关键结论:IFFA 是最耗时的模块,约占 73%。无论哪种模式,IFFA 都会执行。轻量模式主要跳过 GPU 推理阶段。
有 NVIDIA GPU 吗?
├── 是 → 想完整分析?→ 默认模式(不加 --cuda-disable)
│ 想快速看看?→ 轻量模式
└── 否 → 想完整分析?→ 加 --cuda-disable
想快速看看?→ 轻量模式
引擎在 --output 目录下生成 output_YYYYMMDD_HHMMSS/ 时间戳子目录,里面包含以下文件。
structure_report.html浏览器打开,可视化展示所有分析结果。推荐从此入手。
start output/output_20260702_201821/structure_report.html
structure_report.jsonJSON 格式,包含所有字段、关系、质量指标。用配套脚本解析:
python scripts/03_output_reader.py --input output/output_20260702_201821/structure_report.json
质量评分示例(实测数据):
{
"quality": {
"quality_overall": 0.78,
"coverage": 1.0,
"consistency": 0.822,
"refutation": 0.4695,
"cross_validation": 0.9999
}
}
example/format_schema.py可直接运行的 Python 校验脚本:
python output/output_20260702_201821/example/format_schema.py sample.bmp
输出示例:
文件格式: 已识别且验证通过
example/format_schema.xmlPeach XML 格式的配置,传给 --Gen 参数使用。
example/format_schema.bt010 Editor → Templates → Open Template → 选择此文件。
example/format_schema.ksyKaitai Struct 格式,可编译为 Python/Java/C++ 等语言:
kaitai-struct-compiler format_schema.ksy -t python
example/format_schema.yarYARA 规则:
yara format_schema.yar sample.bmp
| 文件名 | 用途 |
|---|---|
iffa_structure_analysis.txt | IFFA 详细逆向报告 |
performance.csv | 各模块耗时统计(怀疑引擎慢时看这个) |
sampling_suggestions.txt | 覆盖度分析和增量采样建议 |
test_suite.txt | 边界测试用例(154 个) |
test_results.txt | 边界测试执行结果 |
afl_dictionary.dict | AFL 字典(92 条词条) |
trained_model.model | 训练好的 ML 模型 |
structure_diff.html | 样本间结构差异对比 |
前置条件:先运行结构归纳,获得 format_schema.xml 文件。
# Step 1:结构归纳
7884_brain.exe --input test_samples/bmp --output output
# Step 2:找到 XML 文件(在 output/output_YYYYMMDD_HHMMSS/example/format_schema.xml)
# Step 3:运行 Gen 模式
7884_brain.exe --Gen output/xxx/example/format_schema.xml -i 100
| 对比 | Basic(默认) | Pro(--engine pro) |
|---|---|---|
| 变异策略数 | 15 种 | 46 种 |
| 策略覆盖率 | 15.2%(实测) | 41.3%(实测) |
| 总变异操作 | 11(实测) | 37(实测) |
| Havoc 组合 | 无 | 8~32 层叠加 |
| 确定性遍历 | 无 | 7 阶段 |
| 字典注入 | 无 | ✅ |
| 整数溢出 | 无 | ✅ |
| 运行速度 | 快(0.03秒/10次) | 较慢 |
| 推荐迭代次数 | 100~10,000 | 1,000~100,000 |
选哪个?
# 第一次运行(指定种子)
7884_brain.exe --Gen format_schema.xml -i 100 -s 42
# 第二次运行(相同种子,得到完全相同的结果)
7884_brain.exe --Gen format_schema.xml -i 100 -s 42
用于 Bug 复现和回归测试。不指定 -s 则每次结果不同。
# 计划跑 10000 次,跑到 5000 次时中断了
# 从中断处继续,跑 5001~10000 次
7884_brain.exe --Gen format_schema.xml --range 5001,10000
引擎支持三种类型的 Python 插件,让你在分析管线的不同阶段注入自定义逻辑。
| 类型 | 执行阶段 | 用途 |
|---|---|---|
analyzer | 分析阶段 | 自定义分析逻辑 |
output | 输出阶段 | 自定义输出格式 |
post_processor | 后处理阶段 | 结果过滤、统计、报表 |
class PluginBase:
plugin_info = {
"name": "my_plugin",
"version": "1.0.0",
"description": "My custom plugin",
"plugin_type": "output",
"author": "Me",
}
def run(self, context):
# context 包含 input_path, results, config
return {"success": True, "message": "ok", "data": {}}
完整示例见 scripts/07_plugin_example.py。
7884_brain.exe --input test_samples/bmp --output output --plugin-dir my_plugins/
插件加载顺序:analyzer → output → post_processor。
每个指标范围 0.0~1.0,越高越好。
| 指标 | 实测值 | 可接受 | 含义 | 怎么提升 |
|---|---|---|---|---|
quality_overall | 0.78 | ≥ 0.70 | 综合质量评分 | 增加样本数量 |
coverage | 1.0 | ≥ 0.80 | 已识别字段占总字节比例 | 增加样本多样性 |
consistency | 0.822 | ≥ 0.70 | 跨样本字段一致性 | 确保样本同格式 |
refutation | 0.4695 | ≥ 0.50 | 结构假设被验证的程度 | 增加样本数量 |
cross_validation | 0.9999 | ≥ 0.85 | 不同分析路径的交叉验证 | 使用更多样本 |
简单判断:
overall ≥ 0.70:结果可用,有参考价值overall ≥ 0.85:结果可靠,可以直接用refutation < 0.50:样本太少,加几个样本| 错误信息 | 原因 | 解决方法 |
|---|---|---|
Error: Failed to load samples from directory | 样本目录不存在或为空 | 确认目录存在且包含二进制文件 |
Directory is empty or contains no readable files | 目录中没有有效二进制文件 | 放入 .bmp/.png/.zip 等文件 |
Error: Failed to create CUDA manager | GPU 不可用 | 加 --cuda-disable |
Error: Failed to create sample analyzer | 内存不足 | 检查可用内存(≥ 4GB) |
退出码 1 + 无错误信息 | 输入目录无有效文件 | 确认目录中有非文本二进制文件 |
| Gen 模式找不到 XML | 路径错误 | 先运行结构归纳生成 XML |
| IFFA 报错 | 路径含空格或中文 | 移到不含空格/中文的路径 |
| 控制台没有输出 | V13 默认精简输出 | 看日志文件,这是正常现象 |
CUDA 不可用
7884_brain.exe --input samples --output output --cuda-disable
空目录报错
# 检查目录内容
dir test_samples/bmp
# 确保有 .bmp 等二进制文件
IFFA 耗时过长
IFFA 占 73% 的总时间(约 46 秒),这是正常的。如果觉得慢:
输出目录找不到
引擎在 --output 目录下创建时间戳子目录。用配套脚本自动定位:
python scripts/01_run_induction.py --input test_samples/bmp --mode lightweight
Q: 引擎运行后控制台没输出,是不是坏了?
A: 不是。V13 版本默认精简输出,只显示关键信息和错误。所有详细信息写入日志文件。
Q: 为什么 lightweight 模式也要跑 60 秒?
A: lightweight 模式跳过的是 GPU 推理,但 IFFA 模块(~46 秒)仍然会执行。
Q: 样本放哪个目录?
A: 任意目录,只要路径不含空格和中文。推荐用纯英文路径。
Q: 能分析哪些格式?
A: 任意二进制格式(BMP, PNG, ZIP, PE, ELF 等)。文本文件(.txt/.md)会被自动跳过。
Q: 需要几个样本?
A: 最少 1 个,推荐 3~5 个。太少则质量评分偏低。
Q: 输出文件在哪里?
A: 在 --output 目录下的 output_YYYYMMDD_HHMMSS/ 子目录中。
Q: 生成的 Python 脚本怎么用?
A: python format_schema.py <要校验的文件>
Q: --mode 参数怎么不能用?
A: 引擎没有 --mode 参数。参考第 5 章,用 --cuda-disable 等参数组合实现。
| 场景 | 推荐配置 |
|---|---|
| 第一次用,想试试 | --cuda-disable --max-iterations 50 --cpu-threads 4 |
| 正式分析,有 GPU | 默认参数 |
| 正式分析,无 GPU | --cuda-disable |
| 批量分析 | 先用轻量筛选,再正式分析 |
| 目的 | 迭代次数 | 引擎 |
|---|---|---|
| 快速测试 | 10~100 | Basic |
| 一般 Fuzzing | 1,000~10,000 | Basic |
| 深度 Fuzzing | 10,000~100,000 | Pro |
# 结构归纳(自动定位输出目录)
python scripts/01_run_induction.py --input test_samples/bmp --output output
# 生成变异样本
python scripts/02_run_gen.py --xml output/xxx/example/format_schema.xml -i 1000
# 解析结果
python scripts/03_output_reader.py --input output/xxx/structure_report.json
# 1. 验证样本
dir ${WORKSPACE}\test_samples\bmp\
# 2. 轻量分析(快速预览)
7884_brain.exe --input test_samples/bmp --output output --cuda-disable --max-iterations 50 --cpu-threads 4
# 3. 查看质量评分
python scripts/03_output_reader.py --input output/latest/structure_report.json
# 4. 如果质量可接受,正式分析
7884_brain.exe --input test_samples/bmp --output output
# 5. 生成变异样本
7884_brain.exe --Gen output/latest/example/format_schema.xml -i 10000
# 6. 用变异样本测试你的解析器
文档版本: v2.0 | 引擎版本: V13 | 最后更新: 2026-07-02
>
配套脚本在scripts/目录,测试样本在test_samples/目录。
命令速查表见docs/APPENDIX_A_cheatsheet.md,输出文件速查表见docs/APPENDIX_B_output_reference.md。