Skip to content

Commit 1f30da5

Browse files
committed
update wsb builder
1 parent 7f39933 commit 1f30da5

8 files changed

Lines changed: 74 additions & 6 deletions

File tree

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.DS_Store
1+
**/.DS_Store
2+
**/._DS_Store
23

34
Utils/Toolkits/*
45
!Utils/Toolkits/.gitkeep
@@ -12,5 +13,8 @@ Input/*
1213
Output/*
1314
!Output/.gitkeep
1415

16+
Tools/*
17+
!Tools/.gitkeep
18+
1519
# Work-in-progress profiles — not yet released
1620
.drafts/

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to RedSand are documented here. Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Note: the artifacts here are Windows Sandbox configs and PowerShell scripts rather than a versioned API, so semver is followed loosely — minor version bumps reflect meaningful additions to the user-facing surface.
44

5+
## [2.2] - 2026-05-28
6+
7+
### Added
8+
- **`build-wsb.ps1`** - added an option to provide local directory that will be mapped into the Sandbox
9+
10+
### Changed
11+
- **Profiles** - by default, mapping gitignored `Tools` directory, to drop-in portable tooling, can be further tweaked - check out README's `Using your own tools` section
12+
513
## [2.1] — 2026-05-19
614

715
### Added

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ RedSand/
7979
├── Files/ # Read-write scratch (default profile only)
8080
├── Input/ # Read-only sample / evidence drop (Analysis + Forensics)
8181
├── Output/ # Read-write results dir (Analysis + Forensics)
82+
├── Tools/ # Read-only BYO tools (mapped by every profile, see Customization)
8283
└── Utils/
8384
├── Toolkits/ # Tools downloaded by OnHost scripts land here
8485
└── Scripts/
@@ -162,6 +163,37 @@ powershell.exe -ExecutionPolicy Bypass -File .\Utils\Scripts\AdditionalScripts\O
162163

163164
The tool-pack builder asks for install scope — pick **Global** for the sandbox (admin install via scoop's `--global`) or **Per-user** if you're generating something for your everyday machine. The generated script adapts: per-user output drops the `#Requires -RunAsAdministrator` line and the `--global` flag, so the same builder works for both RedSand and standalone use.
164165

166+
### Using your own tools (`Tools/`)
167+
168+
Every profile maps `Tools/` read-only into the sandbox at `C:\users\WDAGUtilityAccount\Desktop\Tools\`. Three ways to put things there:
169+
170+
1. **Drop files directly.** Copy a portable tool's folder (e.g. an extracted `dnSpy/`) into `Tools/`. It shows up inside the sandbox immediately on next launch.
171+
2. **Junction to an existing host install.** If a tool already lives somewhere on your host (e.g. `C:\Program Files\IDA Free 9.0`), create a directory junction without copying anything:
172+
```cmd
173+
mklink /J Tools\IDA "C:\Program Files\IDA Free 9.0"
174+
```
175+
`/J` doesn't require admin (unlike `/D` symlinks). The sandbox sees `Desktop\Tools\IDA\` mapped to that host directory — read-only, so the sandbox can't mutate your install.
176+
3. **Map an arbitrary host path directly in a wsb.** When a tool lives somewhere awkward (different drive, path with spaces, etc.) and you don't want a junction, add a `MappedFolder` to your profile's `.wsb` with an explicit `<SandboxFolder>` destination:
177+
```xml
178+
<MappedFolder>
179+
<HostFolder>D:\Reverse Engineering\Binary Ninja</HostFolder> <!-- where it lives on YOUR machine -->
180+
<SandboxFolder>C:\BinaryNinja</SandboxFolder> <!-- where it appears INSIDE the sandbox -->
181+
<ReadOnly>true</ReadOnly>
182+
</MappedFolder>
183+
```
184+
`<HostFolder>` is the source on the host; `<SandboxFolder>` is the *destination* inside the VM. Omit `<SandboxFolder>` and the mapping defaults to `C:\users\WDAGUtilityAccount\Desktop\<basename>\` — fine for most folders, but `<SandboxFolder>` is useful when (a) you want a clean path like `C:\BinaryNinja\` that scripts inside the sandbox can reference, (b) two host folders share a basename and would collide on the default Desktop scheme, or (c) the host folder name contains spaces and you'd rather not navigate `Desktop\Binary Ninja\` in PowerShell.
185+
186+
**Don't want to hand-edit XML?** `build-wsb.ps1` handles this interactively. When you say yes to "Add another mapped folder?" it prompts for:
187+
```
188+
Host path (any: ..\Input\, or absolute like D:\Tools\Binja): D:\Reverse Engineering\Binary Ninja
189+
Read-only? [Y/n]: y
190+
Map to a specific path inside the sandbox (defaults to Desktop\<folder name>)? [y/N]: y
191+
Sandbox path (e.g. C:\BinaryNinja): C:\BinaryNinja
192+
```
193+
The generated wsb gets a `MappedFolder` block with both `<HostFolder>` and `<SandboxFolder>` set. The summary screen shows custom destinations as `host -> sandbox` so you can verify before writing.
194+
195+
`Tools/` itself is gitignored, so anything you put there stays local to your machine.
196+
165197
## Security notes
166198

167199
A few things worth knowing before you drop sensitive material into the sandbox:

Tools/.gitkeep

Whitespace-only changes.

Utils/Scripts/AdditionalScripts/OnHost/build-wsb.ps1

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,20 @@ Write-Host ""
9292
Write-Host "--- Mapped folders (paths are relative to the .wsb's location) ---" -ForegroundColor Cyan
9393

9494
if (Read-YesNo -Prompt 'Add standard RedSand mappings (..\Utils\ read-only, ..\Files\ read-write)?' -Default $true) {
95-
$mappedFolders += @{ Host = '..\Utils\'; ReadOnly = $true }
96-
$mappedFolders += @{ Host = '..\Files\'; ReadOnly = $false }
95+
$mappedFolders += @{ Host = '..\Utils\'; ReadOnly = $true; Sandbox = $null }
96+
$mappedFolders += @{ Host = '..\Files\'; ReadOnly = $false; Sandbox = $null }
9797
}
9898

9999
while (Read-YesNo -Prompt 'Add another mapped folder?' -Default $false) {
100-
$hostPath = Read-Host ' Host path (e.g. ..\Input\)'
100+
$hostPath = Read-Host ' Host path (any: ..\Input\, or absolute like D:\Tools\Binja)'
101101
if ([string]::IsNullOrWhiteSpace($hostPath)) { continue }
102102
$ro = Read-YesNo -Prompt ' Read-only?' -Default $true
103-
$mappedFolders += @{ Host = $hostPath; ReadOnly = $ro }
103+
$sandboxPath = $null
104+
if (Read-YesNo -Prompt ' Map to a specific path inside the sandbox (defaults to Desktop\<folder name>)?' -Default $false) {
105+
$sandboxPath = Read-Host ' Sandbox path (e.g. C:\BinaryNinja)'
106+
if ([string]::IsNullOrWhiteSpace($sandboxPath)) { $sandboxPath = $null }
107+
}
108+
$mappedFolders += @{ Host = $hostPath; ReadOnly = $ro; Sandbox = $sandboxPath }
104109
}
105110

106111
# Logon command - three-way
@@ -134,7 +139,8 @@ if ($mappedFolders.Count -gt 0) {
134139
Write-Host "Mapped folders:"
135140
foreach ($mf in $mappedFolders) {
136141
$mode = if ($mf.ReadOnly) { 'read-only' } else { 'read-write' }
137-
Write-Host (" - {0} ({1})" -f $mf.Host, $mode)
142+
$dest = if ($mf.Sandbox) { " -> $($mf.Sandbox)" } else { '' }
143+
Write-Host (" - {0}{1} ({2})" -f $mf.Host, $dest, $mode)
138144
}
139145
}
140146
Write-Host "LogonCommand: $logonChoice"
@@ -164,6 +170,9 @@ if ($mappedFolders.Count -gt 0) {
164170
foreach ($mf in $mappedFolders) {
165171
$lines += ' <MappedFolder>'
166172
$lines += " <HostFolder>$(Escape-Xml $mf.Host)</HostFolder>"
173+
if ($mf.Sandbox) {
174+
$lines += " <SandboxFolder>$(Escape-Xml $mf.Sandbox)</SandboxFolder>"
175+
}
167176
$lines += " <ReadOnly>$($mf.ReadOnly.ToString().ToLower())</ReadOnly>"
168177
$lines += ' </MappedFolder>'
169178
}

profiles/RedSand-Analysis.wsb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
<HostFolder>..\Output\</HostFolder>
3333
<ReadOnly>false</ReadOnly>
3434
</MappedFolder>
35+
<!-- Bring-your-own tools: drop binaries in ..\Tools\ or junction to existing host installs. See README. -->
36+
<MappedFolder>
37+
<HostFolder>..\Tools\</HostFolder>
38+
<ReadOnly>true</ReadOnly>
39+
</MappedFolder>
3540
</MappedFolders>
3641
<LogonCommand>
3742
<Command>powershell.exe -ExecutionPolicy Bypass -File C:\users\WDAGUtilityAccount\Desktop\Utils\Scripts\DefaultScripts\setup.ps1</Command>

profiles/RedSand-Forensics.wsb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<HostFolder>..\Output\</HostFolder>
3232
<ReadOnly>false</ReadOnly>
3333
</MappedFolder>
34+
<!-- Bring-your-own tools: drop binaries in ..\Tools\ or junction to existing host installs. See README. -->
35+
<MappedFolder>
36+
<HostFolder>..\Tools\</HostFolder>
37+
<ReadOnly>true</ReadOnly>
38+
</MappedFolder>
3439
</MappedFolders>
3540
<LogonCommand>
3641
<Command>powershell.exe -ExecutionPolicy Bypass -File C:\users\WDAGUtilityAccount\Desktop\Utils\Scripts\DefaultScripts\setup.ps1</Command>

profiles/RedSand.wsb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
<HostFolder>..\Files\</HostFolder>
1616
<ReadOnly>false</ReadOnly>
1717
</MappedFolder>
18+
<!-- Bring-your-own tools: drop binaries in ..\Tools\ or junction to existing host installs. See README. -->
19+
<MappedFolder>
20+
<HostFolder>..\Tools\</HostFolder>
21+
<ReadOnly>true</ReadOnly>
22+
</MappedFolder>
1823
</MappedFolders>
1924
<LogonCommand>
2025
<Command>powershell.exe -ExecutionPolicy Bypass -File C:\users\WDAGUtilityAccount\Desktop\Utils\Scripts\DefaultScripts\setup.ps1</Command>

0 commit comments

Comments
 (0)