wellingtonlee/vmbuilder
GitHub: wellingtonlee/vmbuilder
基于 Packer 的自动化构建器,用于快速创建预配置 35+ 款分析工具并完成系统加固的 Windows 11 恶意软件分析虚拟机。
Stars: 0 | Forks: 0
# VMBuilder — 自动化恶意软件分析虚拟机构建器
用于构建预配置用于恶意软件分析的 Windows 11 25H2 虚拟机的自动化构建器。使用 [Packer](https://www.packer.io/) 和 PowerShell 创建一个完全配置好的 VMware 虚拟机,包含 35+ 种分析工具、Windows 加固以及有序的桌面布局。
## 功能特性
- **YAML 驱动的配置** — 通过编辑 `config/tools.yaml` 添加或移除工具
- **35 种预配置工具**,包括调试器、反汇编器、PE 分析器、网络工具和系统监视器
- **全面的 Windows 加固** — 禁用 Defender、Windows Update、遥测、Cortana、UAC、SmartScreen 和防火墙
- **有序的桌面** — 工具按类别文件夹分组(调试器、反汇编器、PE 分析、网络、系统监控、实用工具)
- **深色模式**,配备 MesloLG Nerd Font,显示文件扩展名并显示隐藏文件
- **构建后验证**,附带 JSON 报告
- **Clean 快照** 在构建完成后自动创建
## 前置条件
- **[Packer](https://www.packer.io/downloads)** (>= 1.10)
- **VMware Workstation** (Windows/Linux) 或 **VMware Fusion** (macOS)
- **Python 3.8+** 及 pip
- **Windows 11 25H2 ISO** — [从 Microsoft 下载](https://www.microsoft.com/software-download/windows11)
## 快速开始
1. **克隆仓库:**
git clone https://github.com/wellingtonlee/vmbuilder.git
cd vmbuilder
2. **安装 Python 依赖:**
pip install -r requirements.txt
3. **配置:**
cp config/config.example.yaml config/config.yaml
编辑 `config/config.yaml` 并将 `iso.path` 设置为您的 Windows 11 25H2 ISO 位置。
4. **检查工具**(可选):
编辑 `config/tools.yaml` 以启用/禁用工具或更新下载 URL。
在构建之前,必须更新带有 `PLACEHOLDER` URL 的工具。
5. **验证配置:**
python build.py --config config/config.yaml --validate-only
6. **构建虚拟机:**
python build.py --config config/config.yaml
构建过程大约需要 1-2 小时,具体取决于网络速度。生成的虚拟机将位于 `output/` 目录中。
## 配置说明
### 虚拟机设置 (`config/config.yaml`)
| 设置 | 默认值 | 描述 |
|---------|---------|-------------|
| `vm.name` | `MalwareAnalysis-Win11-25H2` | 虚拟机名称 |
| `vm.cpus` | `4` | CPU 核心数 (1-32) |
| `vm.memory_mb` | `8192` | 内存 (MB) (2048-65536) |
| `vm.disk_size_mb` | `102400` | 磁盘 (MB) (40960-1048576) |
| `vm.username` | `malware` | 本地管理员用户名 |
| `vm.password` | `malware` | 本地管理员密码 |
| `iso.path` | — | **必填。** Windows 11 ISO 路径 |
| `iso.checksum` | `none` | SHA256 校验和或 `none` |
| `output.directory` | `./output` | 构建输出目录 |
| `output.snapshot_name` | `Clean` | 构建后快照名称 |
### 工具覆盖
无需修改 `tools.yaml` 即可覆盖单个工具的设置:
```
tool_overrides:
ida-free:
enabled: false
ghidra:
url: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_12.0_build/ghidra_12.0.zip"
```
## 添加新工具
向 `config/tools.yaml` 添加条目。无需修改代码。示例:
```
- name: pestudio
display_name: "pestudio"
method: direct-download
url: "https://www.winitor.com/tools/pestudio/current/pestudio.zip"
download_type: zip
install_dir: "C:\\Tools\\pestudio"
category: "PE Analysis"
exe_path: "C:\\Tools\\pestudio\\pestudio.exe"
enabled: true
```
### 安装方式
| 方式 | 描述 | 必填字段 |
|--------|-------------|-----------------|
| `choco` | Chocolatey 包 | `choco_package` |
| `direct-download` | 从 URL 下载 | `url`, `download_type` (zip/exe/msi/7z), `install_dir` |
| `winget` | Windows 包管理器 | `winget_id` |
| `powershell` | 运行 PowerShell 命令 | `command` |
| `shortcut-only` | 为现有 exe 创建快捷方式 | `depends_on`, `exe_path` |
## 内置工具
### 调试器
x64dbg, WinDbg, dnSpyEx, ret-sync
### 反汇编器
IDA Free, Ghidra
### PE 分析
CFF Explorer, Detect-It-Easy, PE-Bear, imHex, Capa, Capa rules, Capa explorer web, FLOSS
### 网络
Wireshark, FakeNet-NG, Fiddler Classic, WinDump
### 系统监控
Sysinternals Suite (Process Explorer, Process Monitor, Autoruns, TCPView, WinObj), System Informer, ProcDOT, Regshot, API Monitor v2, Regfsnotify
### 实用工具
7-Zip, Sublime Text 4, CyberChef, Graphviz, Python, JDK Temurin, YARA
### 其他
MesloLG Nerd Font, Microsoft Edge (预装), 内核调试模式 (`bcdedit /debug on`)
## Windows 加固
构建过程应用以下针对恶意软件分析的加固措施:
- **Windows Defender** — 已禁用(实时保护、服务、篡改保护)
- **Windows Update** — 已禁用 (wuauserv, UsoSvc, WaaSMedicSvc)
- **遥测** — 已禁用 (DiagTrack, dmwappushservice)
- **Cortana** — 已禁用
- **UAC** — 已禁用
- **SmartScreen** — 已禁用
- **防火墙** — 已禁用(FakeNet-NG 和网络分析需要)
- **内核调试** — 通过 bcdedit 启用
## CLI 参考
```
python build.py [OPTIONS]
Options:
--config PATH Path to config YAML (default: config/config.example.yaml)
--tools PATH Path to tools YAML (default: config/tools.yaml)
--validate-only Validate configuration without building
--skip-verify Skip post-build verification step
--skip-snapshot Skip taking a clean snapshot after build
```
## 项目结构
```
vmbuilder/
├── build.py # Host-side orchestrator
├── config/
│ ├── config.example.yaml # VM settings template
│ ├── tools.yaml # Tool definitions (35 tools)
│ └── schema.json # Config validation schema
├── packer/
│ ├── windows.pkr.hcl # Packer build template
│ ├── variables.pkr.hcl # Variable declarations
│ └── plugins.pkr.hcl # Required plugins
├── answer/
│ ├── autounattend.xml # Unattended Windows install
│ └── setup-winrm.ps1 # WinRM bootstrap
├── scripts/
│ ├── install/ # Tool installation scripts
│ ├── config/ # OS hardening and configuration
│ └── verify/ # Post-build verification
└── resources/
└── wallpaper.png # Optional custom wallpaper
```
## 故障排除
### ISO 镜像索引不匹配
如果 Windows 安装程序无法找到正确的版本,请验证您的 ISO 中的镜像索引:
```
dism /Get-ImageInfo /ImageFile:D:\sources\install.wim
```
`autounattend.xml` 期望的是 "Windows 11 Pro"。如果您的 ISO 使用不同的版本名称,请编辑 `answer/autounattend.xml` 中的 ``。
### WinRM 连接超时
如果 Packer 等待 WinRM 超时,请确保虚拟机具有网络连接并且已创建防火墙规则。您可以在 `packer/windows.pkr.hcl` 中增加超时时间 (`winrm_timeout`)。
### 占位符 URL
URL 中带有 `PLACEHOLDER_UPDATE_ME` 的工具将无法下载。在构建之前,请在 `config/tools.yaml` 中更新这些 URL:
- IDA Free — 从 [hex-rays.com/ida-free](https://hex-rays.com/ida-free/) 获取
- WinDump — 从 WinDump 项目页面获取
- Regfsnotify — 从项目下载页面获取
- Capa explorer web — 从 [Capa releases](https://github.com/mandiant/capa/releases) 获取
- ret-sync — 从 [ret-sync releases](https://github.com/bootleg/ret-sync/releases) 获取
## 许可证
MIT
标签:AI合规, Conpot, DAST, DevSecOps, IPv6, Libemu, OpenCanary, Packer, PE分析, PowerShell, Python, VMware, Wayback Machine, Windows 11, Windows安全, YAML配置, 上游代理, 云资产清单, 反汇编, 工具集, 恶意软件分析, 无后门, 沙箱环境, 漏洞分析, 特权提升, 系统分析, 系统加固, 网络分析, 网络安全, 网络连接监控, 自动化部署, 虚拟机构建, 路径探测, 逆向工具, 逆向工程, 隐私保护