26zl/windows-sandbox-lab
GitHub: 26zl/windows-sandbox-lab
一键创建受 Sysmon 和 PowerShell 日志监控的、基于 Windows Sandbox 的多用途一次性隔离环境,并可通过 winget 自动安装各类开发和安全分析工具链。
Stars: 1 | Forks: 0
# Windows Sandbox 实验室 — 一次性、工具化且受监控




## 为什么使用
需要测试可疑的安装程序、新的 SDK、客户的代码库或恶意软件样本?在你的
主机上执行此操作会导致残留服务、注册表垃圾甚至更糟的后果。本项目能让你在几分钟内获得一个
一次性、完全配置好的 Windows 环境 —— 而且,与普通的沙盒不同,它还能向你展示
其中运行了什么。
- **一次性** — 内置 Windows Sandbox VM;关闭后所有内容都会消失。
- **工具化** — 选择一个 profile,winget 会自动安装最新版本。
- **受监控** — 默认开启 PowerShell 脚本块/模块日志记录和命令行进程审计,并在内置 Windows 11 功能可用时附加 Sysmon —— 这样你就可以清楚地看到
软件执行了什么操作。
## 使用场景
- 在你的真实主机上安装任何软件/包之前进行分诊。
- 在干净的 Windows 环境中测试客户代码库、SDK、编译器和构建工具。
- 提供 Browser/API/database/data-science/devops 工具箱,且不会污染你的工作站。
- 利用离线模式、审计日志和 RE 工具进行恶意软件分诊和逆向工程练习。
- 用于快速、一次性网络和 Web 测试的 Pentest 实验室实用工具。
## 前置条件
- Windows 11 **Pro 或 Enterprise**
- 启用 [Windows Sandbox](https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/windows-sandbox-overview)
- Sysmon 监控需要内置 Sysmon 功能的 Windows 11 版本;PowerShell + 进程创建日志记录在所有受支持的版本上均可运行
## 快速开始
**单行命令** (PowerShell):
```
irm https://raw.githubusercontent.com/26zl/windows-sandbox-lab/main/install.ps1 | iex
start sandbox.wsb
```
**或者克隆仓库** (提供 profile 选择功能):
```
git clone https://github.com/26zl/windows-sandbox-lab.git
cd windows-sandbox-lab
.\setup.ps1 # default dev toolchain
start sandbox.wsb # winget installs everything automatically
```
## Profiles
**default** profile 是一个全栈开发环境。你可以添加任意组合的 opt-in profiles —
default 始终会被包含,并且会自动对重复项进行去重:
```
.\setup.ps1 -Profiles datascience,web # default + two profiles
.\setup.ps1 -Profiles security # default + reverse-engineering tools
.\setup.ps1 -Profiles security -Offline # hardened, network-disabled box (see below)
```
| Profile | 你将获得的内容 |
| --- | --- |
| **default** | Go, Rust, Python 3.13, JDK 21, Node LTS, Ruby, PHP, Zig, .NET 9 SDK+runtime, VS Build Tools, CMake, Git, 7-Zip, Sysinternals, PowerShell 7, VS Code, Notepad++ |
| **datascience** | Miniconda, uv, R, RStudio, VS Code (通过 `uv tool install` 安装 JupyterLab) |
| **devops** | Terraform, kubectl, k9s, Helm, AWS/Azure/gcloud CLIs *(仅限客户端 — 无本地 containers,见注)* |
| **database** | DBeaver, PostgreSQL, SQLite, SQL Server 2022 Express, SSMS |
| **web** | Firefox, Chrome, Brave, Bruno, Postman, VS Code |
| **security** | x64dbg, Detect It Easy, PE-bear, HxD, Resource Hacker, dnSpyEx, ILSpy, System Informer, YARA, FLOSS, Wireshark, mitmproxy + Ghidra/PEStudio/capa/CyberChef/CFF Explorer (自动列出以供手动下载) |
| **pentest** | Nmap, Wireshark, Burp Suite Community, ffuf (通过 pip 安装 sqlmap) |
所有 winget 工具都在 `tools.json` 中进行配置。没有 winget 包的工具会在设置完成时附带下载链接列出。你可以使用它们的 [winget ID](https://winget.run/) 添加自己的工具。
## 安全 / 恶意软件分析 (离线)
要分析不受信任的二进制文件,请使用 `-Offline` 生成一个强化的环境:
```
.\setup.ps1 -Profiles security -Offline
start sandbox.wsb
```
`-Offline` 会生成一个 **禁用网络和剪贴板** 的 `sandbox.wsb`,并且相同的
`autostart.ps1` 会在无网络模式下运行:它会应用日志/审计强化,并列出需要
引入的工具 (不使用 winget)。
由于 winget 需要网络,请在启动前 **预先准备好你的工具** (以及可选的 `sysmonconfig.xml`)
并存入主机的 `scripts/` 目录中 —— `scripts/` 被映射为只读,
因此样本永远无法修改你的工具链。
## 对比
| | 本项目 | [ThioJoe/Windows-Sandbox-Tools](https://github.com/ThioJoe/Windows-Sandbox-Tools) | [WSBEditor](https://github.com/leestevetk/WSBEditor) | [FLARE-VM](https://github.com/mandiant/flare-vm) |
| --- | :-: | :-: | :-: | :-: |
| 单条命令,自动安装工具 | ✅ | 部分 | ❌ (仅限配置) | ✅ |
| 一次性 (关闭后销毁) | ✅ | ✅ | ✅ | ❌ (持久化 VM) |
| 内置 Sysmon + PowerShell 日志 | ✅ | ❌ | ❌ | 部分 |
| 多领域 profiles | ✅ | ❌ | ❌ | ❌ (仅限 RE) |
| 离线恶意软件分析模式 | ✅ | ❌ | ❌ | ✅ |
## 监控与日志记录
默认开启,以便你能查看软件在沙盒内部的行为:
- 带有 SwiftOnSecurity 配置的 Sysmon (内置可选功能;锁定 commit +
SHA256 校验) — 进程创建、网络连接、文件更改
- PowerShell 脚本块 + 模块日志记录
- 带有命令行捕获的进程创建审计
- 禁用 Telemetry 和 Windows Error Reporting
## 环境调整
暗黑模式 · 显示文件扩展名、隐藏和受保护的 OS 文件 · 经典上下文菜单 (Win 11) ·
长路径支持 · 剪贴板历史记录 · PowerShell/CMD "Open Here" · 上下文菜单中的
"新建文本/PowerShell 脚本"条目。
## Sandbox 设置
- 12 GB RAM,启用 ProtectedClient
- 启用网络 (winget 必需),禁用 vGPU/audio/video/printer
- 与主机的剪贴板共享 **开启** (为了方便);`scripts/` 映射为只读
## 添加工具
1. 查找 winget ID: `winget search `
2. 在 `tools.json` 中的 `default` 或某个 profile 下添加一个条目:
`{ "name": "...", "wingetId": "...", "enabled": true }`
(没有 winget 包?使用 `{ "name": "...", "wingetId": "", "enabled": true, "source": "manual", "url": "..." }`)
3. 使用 `"enabled": false` 禁用任何工具。
## 文件
```
tools.json ← default toolchain + opt-in profiles (winget IDs)
setup.ps1 ← run once: resolve profiles → scripts/tools.json + generate sandbox.wsb
install.ps1 ← one-liner bootstrap (irm | iex)
sandbox.wsb.template ← sandbox config (networking/clipboard toggled for -Offline)
scripts/autostart.ps1 ← runs inside the sandbox: env, hardening, winget installs, Sysmon (-Offline = no-network variant)
scripts/launch.cmd ← launcher (forwards -Offline to autostart.ps1)
```
沙盒内的安装日志: `%TEMP%\sandbox-install.log`
标签:AI合规, DAST, Libemu, Windows沙箱, 开发工具链, 恶意软件分析, 自动化环境配置, 虚拟机管理