English | 中文
malware-sandbox 是一个利用 Windows Sandbox 为“流氓/高风险”类应用提供隔离运行环境的配置。
- 数据持久化:仓库根目录中的
App/Data/Downloads为链接,真实数据位于用户目录%UserProfile%\malware-sandbox与%UserProfile%\Downloads。关闭沙盒后账号与数据依然保留。 - 支持 Scoop:可通过一条 Scoop 命令安装/卸载,安装脚本会提示如何启用 Windows Sandbox。
- 安全卸载:卸载脚本仅“取消链接”(unlink),不会删除任何数据或目录。
已在以下平台测试并确认可用:
| 平台 | 说明 |
|---|---|
| 微信 | ✅ |
| ✅ | |
| QQNT | |
| TIM | ✅ |
| 企业微信 | |
| 腾讯会议 | ✅ |
| 腾讯文档 | ✅ |
| 百度网盘 | ✅ |
| 网易云音乐 | ✅ |
| 夸克网盘 | ✅ |
- Windows 11 专业版/企业版/教育版(家庭版不支持 Windows Sandbox)
- 已启用 Windows Sandbox 功能(可在“启用或关闭 Windows 功能”中启用,或在提升权限 PowerShell 中执行):
Enable-WindowsOptionalFeature -Online -FeatureName 'Containers-DisposableClientVM' -All
-
使用 Scoop:
scoop install https://github.com/k88936/scoop-bucket/raw/refs/heads/master/bucket/malware-sandbox.json
-
手动安装:
-
克隆本仓库
-
在仓库根目录运行:
./install.ps1安装脚本会在仓库根目录创建
App/Data/Downloads的链接,真实数据放在%UserProfile%\malware-sandbox(以及用户下载目录)。 -
可选:创建快捷方式
在仓库根目录执行以下 PowerShell 函数,可在“桌面/开始菜单/自定义目录”创建
Malware.wsb的快捷方式:function New-MalwareSandboxShortcut { param( [ValidateSet('Desktop','StartMenu','Custom')] [string]$Location = 'Desktop', [string]$CustomFolder, [string]$Name = 'Malware Sandbox.lnk', [string]$IconLocation = "$env:WINDIR\System32\shell32.dll,167" ) $repo = Get-Location $target = Join-Path $repo.Path 'Malware.wsb' switch ($Location) { 'Desktop' { $folder = [Environment]::GetFolderPath('Desktop') } # %AppData%\Microsoft\Windows\Start Menu\Programs 'StartMenu'{ $folder = [Environment]::GetFolderPath('Programs') } 'Custom' { $folder = $CustomFolder } } if (-not $folder) { throw '未解析到目标文件夹。使用 -Location Custom 时请提供 -CustomFolder。' } if (-not (Test-Path $folder)) { New-Item -ItemType Directory -Path $folder -Force | Out-Null } $lnk = Join-Path $folder $Name $wsh = New-Object -ComObject WScript.Shell $sc = $wsh.CreateShortcut($lnk) $sc.TargetPath = $target $sc.WorkingDirectory = $repo.Path if ($IconLocation) { $sc.IconLocation = $IconLocation } $sc.Save() Write-Host "已创建: $lnk" -ForegroundColor Green }
-
桌面快捷方式:
New-MalwareSandboxShortcut -Location Desktop
-
开始菜单(当前用户):
New-MalwareSandboxShortcut -Location StartMenu
-
开始菜单(所有用户,需以管理员身份运行):
New-MalwareSandboxShortcut -Location Custom -CustomFolder "$env:ProgramData\Microsoft\Windows\Start Menu\Programs"
-
- 双击仓库根目录中的
Malware.wsb启动沙盒。 - 在沙盒内安装并使用需要的应用。
- 关闭沙盒后,应用数据保留在宿主机用户目录下(见“特性”)。
./uninstall.ps1- 仅移除仓库根目录下
App/Data/Downloads的链接; - 不会删除任何数据或目录,包括
%UserProfile%\malware-sandbox与真实的下载目录; - 若对应项不是链接(为普通目录),脚本将保留并给出提示。
malware-sandbox/
├─ App -> %UserProfile%\malware-sandbox\App
├─ Data -> %UserProfile%\malware-sandbox\Data
├─ Downloads -> %UserProfile%\Downloads
├─ Desktop/
├─ Scripts/
├─ Malware.wsb
├─ install.ps1
├─ uninstall.ps1
└─ README.md
- 改编自开源项目 tencent-sandbox