pointblank-club/vestigo
GitHub: pointblank-club/vestigo
一套结合 Ghidra 静态分析与 Qiling 动态追踪的固件分析流水线,专注于加密函数检测与机器学习数据集生成。
Stars: 79 | Forks: 10
# Vestigo:固件分析与加密检测流水线
Vestigo 是一套工具、脚本和服务的集合,旨在自动化以下流程:(1) 生成交叉编译的测试二进制文件,(2) 静态和动态分析固件/二进制文件,(3) 提取适用于 ML 的特征,以及 (4) 生成用于加密函数检测的数据集和推理结果。该仓库结合了基于无头 Ghidra 的提取、基于 Qiling 的动态追踪、数据集生成流水线(包括可选的 LLM 辅助标记),以及一个用于 Web 访问的小型后端 + 前端。
本 README 提供了简明、实用的概述和快速入门指南,以便您能快速运行该流水线并参与贡献。
## 核心项目目标
- 提取适用于 ML 的函数级和追踪级特征
- 提供静态 (Ghidra) 和动态 (Qiling) 分析实用工具
- 提供用于构建训练 CSV 和运行推理的脚本
- 提供用于文件上传和分析的后端 API 和前端
## 快速概览 / 亮点
- 语言:Python(主要工具和后端),TypeScript/React 前端
- 主要目录:`ghidra_scripts`、`qiling_analysis`、`ml`、`backend`、`frontend`
- 重要入口点:
- `generate_dataset.py` — 从 Ghidra JSON 创建 ML CSV
- `analyzer.py`、`bare_metal.py`、`main.py` — 编排分析流程
- `factory/builder.py` — 跨架构/优化矩阵交叉编译源代码
- `qiling_analysis/` — 动态追踪和批量提取流水线
- `backend/` — 带有分析端点的 FastAPI 后端
## 快速设置
### 1. 自动安装
```
./setup.sh
source activate_vestigo.sh
```
**安装内容:**
- 包含所有依赖项的 Python 环境(FastAPI、Qiling、ML 库)
- Ghidra 无头分析器 (/opt/ghidra)
- Qiling 框架 + rootfs
- 交叉编译工具链(ARM、MIPS、AArch64)
- 容器运行时(Podman/Docker)
**选项:** `--minimal` | `--skip-ghidra` | `--skip-ml` | `--help`
### 2. 必要的手动步骤
**前端 (Node.js 18+):**
```
# 根据您的操作系统安装 Node.js,然后:
cd frontend && npm install && cd ..
```
**数据库:**
```
# 选项 A:Local
sudo apt install postgresql && sudo -u postgres createdb vestigo
# 选项 B:Cloud (https://neon.tech - 推荐)
# 获取 connection string 并添加到 .env
```
**配置 .env:**
```
DATABASE_URL=postgresql://user:pass@host:5432/vestigo
OPENAI_API_KEY=sk-your-key-here # Get from platform.openai.com
```
**初始化数据库:**
```
cd backend && prisma db push && prisma generate && cd ..
```
## 使用方法
**始终先激活环境:** `source activate_vestigo.sh`
### 静态分析
```
python3 scripts/analyzer.py
```
### 动态分析
```
python3 qiling_analysis/tests/verify_crypto.py
```
### 生成 ML 数据集
```
python3 scripts/generate_dataset.py --input-dir ghidra_output --output dataset.csv
```
### 批量处理
```
python3 qiling_analysis/batch_extract_features.py \
--dataset-dir ./dataset_binaries --output-dir ./results --parallel 4
```
### 交叉编译二进制文件
```
python3 factory/builder.py --source algorithm.c
```
### LLM 加密分析
```
python3 qiling_analysis/tests/llm/crypto_deep_analyzer.py --strace trace.log --output analysis.json
```
### 运行 Web 界面
```
# Backend (终端 1)
cd backend && uvicorn main:app --reload
# Frontend (终端 2)
cd frontend && npm run dev
```
## 项目结构
```
vestigo-data/
├── setup.sh # Automated installation
├── activate_vestigo.sh # Environment activation
├── backend/ # FastAPI server
├── frontend/ # React UI
├── factory/ # Cross-compilation tools
├── ghidra_scripts/ # Ghidra analysis scripts
├── qiling_analysis/ # Dynamic tracing pipeline
├── ml/ # ML models and training
├── scripts/ # Analysis orchestration
└── dataset_binaries/ # Sample binaries
```
**关键脚本:**
- `scripts/analyzer.py` - Ghidra 静态分析
- `scripts/generate_dataset.py` - 创建 ML 数据集
- `qiling_analysis/tests/verify_crypto.py` - 动态分析
- `factory/builder.py` - 交叉编译
## 故障排除
| 问题 | 解决方案 |
|-------|----------|
| 找不到虚拟环境 | 运行 `./setup.sh` |
| 导入错误 | `pip install -r requirements.txt -r backend/requirements.txt` |
| Qiling rootfs 缺失 | `git clone --depth 1 https://github.com/qilingframework/rootfs.git qiling_analysis/rootfs` |
| 找不到 Ghidra | 设置 `export GHIDRA_HOME=/opt/ghidra` |
| 数据库错误 | 检查 `.env` 中的 `DATABASE_URL`,运行 `prisma generate` |
| OpenAI 配额超限 | 请在 platform.openai.com 查看账单 |
| 前端无法启动 | `cd frontend && rm -rf node_modules && npm install` |
## 系统要求
- **操作系统**:Ubuntu/Debian、Fedora/RHEL、Arch、macOS
- **内存**:最低 8GB,推荐 16GB
- **磁盘**:约 10GB
- **Python**:3.9+(推荐 3.11)
- **Node.js**:18+(用于前端)
## 文档
- `qiling_analysis/QUICKSTART_GUIDE.md` - 动态分析指南
- `CONTRIBUTING.md` - 贡献指南
## 许可证
Apache-2.0 - 参见 `LICENSE`
标签:AMSI绕过, Apex, AV绕过, CTF工具, FastAPI, Ghidra, Petitpotam, Python, Qiling, React, Syscalls, 二进制分析, 二进制安全, 云安全监控, 云安全运维, 云资产清单, 动态追踪, 固件分析, 威胁检测, 密码学检测, 嵌入式安全, 恶意代码分析, 数据集生成, 无后门, 机器学习, 测试用例, 漏洞搜索, 特征提取, 请求拦截, 跨平台编译, 逆向工具, 逆向工程, 配置文件, 静态分析