This repository was archived by the owner on Jun 21, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
168 lines (146 loc) · 7.1 KB
/
Copy pathinstall.ps1
File metadata and controls
168 lines (146 loc) · 7.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# malware-sandbox Install Script
# This script sets up the malware-sandbox Windows Sandbox configuration
Write-Host "Installing malware-sandbox..." -ForegroundColor Green
# Root path where the repository (Tencent.wsb etc.) lives
$InstallPath = $PSScriptRoot
Write-Host "Using repository path: $InstallPath" -ForegroundColor DarkGray
# Persistent storage base in user profile (kept outside repo / program dir). We link App/Data/Downloads to here.
$UserBase = Join-Path $env:UserProfile "malware-sandbox"
$UserApp = Join-Path $UserBase "App"
$UserData = Join-Path $UserBase "Data"
$UserDownloads = Join-Path $env:UserProfile "Downloads" # real user downloads
Write-Host "User persistent base: $UserBase" -ForegroundColor DarkGray
# Provide Windows Sandbox information (without requiring admin privileges)
Write-Host "Windows Sandbox Requirements:" -ForegroundColor Yellow
Write-Host "- Windows 11 Pro/Enterprise/Education" -ForegroundColor White
Write-Host "- Windows Sandbox feature must be enabled" -ForegroundColor White
Write-Host ""
Write-Host "To enable Windows Sandbox (run as Administrator):" -ForegroundColor Cyan
Write-Host "Enable-WindowsOptionalFeature -Online -FeatureName 'Containers-DisposableClientVM' -All" -ForegroundColor White
Write-Host "Then restart your computer." -ForegroundColor White
Write-Host ""
Write-Host "Preparing user persistent base (App/Data)..." -ForegroundColor Yellow
foreach ($p in @($UserBase,$UserApp,$UserData)) {
if (-not (Test-Path $p)) { New-Item -ItemType Directory -Path $p -Force | Out-Null; Write-Host "Created: $p" -ForegroundColor Gray }
}
# Helper: ensure directory link (prefer junction, fallback symlink, fallback plain folder)
function Ensure-DirLink($linkPath, $targetPath) {
if (-not (Test-Path $targetPath)) { New-Item -ItemType Directory -Path $targetPath -Force | Out-Null }
if (Test-Path $linkPath) {
$item = Get-Item $linkPath -ErrorAction SilentlyContinue
if ($item -and ($item.Attributes -band [IO.FileAttributes]::ReparsePoint)) {
Write-Host "Already linked: $linkPath" -ForegroundColor DarkGray
return
}
if ($linkPath -ne $targetPath) {
Write-Host "Existing normal directory at $linkPath. Migrating contents to $targetPath..." -ForegroundColor Yellow
Get-ChildItem -Path $linkPath -Force | ForEach-Object { Move-Item -Path $_.FullName -Destination $targetPath -Force }
Remove-Item $linkPath -Recurse -Force
}
}
try {
New-Item -ItemType Junction -Path $linkPath -Target $targetPath -Force | Out-Null
Write-Host "Linked (Junction): $linkPath -> $targetPath" -ForegroundColor Green
} catch {
Write-Warning "Junction failed for $linkPath. Trying symbolic link. $_"
try {
New-Item -ItemType SymbolicLink -Path $linkPath -Target $targetPath -Force | Out-Null
Write-Host "Linked (Symlink): $linkPath -> $targetPath" -ForegroundColor Green
} catch {
Write-Warning "Failed to link $linkPath. Using plain folder (NOT LINKED)."
if (-not (Test-Path $linkPath)) { New-Item -ItemType Directory -Path $linkPath -Force | Out-Null }
}
}
}
Write-Host "Linking App, Data, Downloads..." -ForegroundColor Yellow
Ensure-DirLink (Join-Path $InstallPath "App") $UserApp
Ensure-DirLink (Join-Path $InstallPath "Data") $UserData
Ensure-DirLink (Join-Path $InstallPath "Downloads") $UserDownloads
# Create required directory structure (original logic retained). Since App/Data are links, their subdirectories go into user profile.
Write-Host "Creating directory structure (original logic) ..." -ForegroundColor Yellow
$directories = @(
"App\QQ",
"App\QQNT",
"App\TIM",
"App\WeChat",
"App\Weixin",
"App\WXWork",
"App\WeMeet",
"App\TencentDocs",
"App\CloudMusic",
"Data\Common Files",
"Data\Documents\Tencent",
"Data\Documents\WeChat",
"Data\Documents\xwechat_files",
"Data\Documents\WXWork",
"Data\Roaming\Tencent",
"Data\Roaming\WeChat",
"Data\Roaming\xwechat",
"Data\Roaming\TencentDocs",
"Data\Roaming\WeMeet",
"Data\Roaming\baidu",
"Data\Roaming\BaiduYunGuanjia",
"Data\Roaming\BaiduYunKernel",
"Data\Roaming\Adobe",
"Data\Roaming\quark-cloud-drive",
"Data\Local\Quark",
"Data\Local\QuarkUpdater",
"Data\Local\Programs\Quark",
"Data\Local\Programs\Common\Quark",
"Data\Local\Programs\quark-cloud-drive",
"Data\Local\CloudMusic",
"Data\SysWOW64",
"Data\ProgramData\Tencent",
"Desktop",
"Scripts",
"Data\Documents\CloudMusic"
)
foreach ($dir in $directories) {
$fullPath = Join-Path $InstallPath $dir
if (-not (Test-Path $fullPath)) {
New-Item -ItemType Directory -Path $fullPath -Force | Out-Null
Write-Host "Created: $fullPath" -ForegroundColor Gray
}
}
# Downloads already linked earlier; nothing further here.
# Move sandbox-setup.ps1 to Scripts directory if it exists
Write-Host "Setting up sandbox scripts..." -ForegroundColor Yellow
$setupScriptSource = Join-Path $InstallPath "sandbox-setup.ps1"
$setupScriptTarget = Join-Path $InstallPath "Scripts\sandbox-setup.ps1"
if (Test-Path $setupScriptSource) {
try {
Copy-Item -Path $setupScriptSource -Destination $setupScriptTarget -Force
Write-Host "Moved sandbox-setup.ps1 to Scripts directory" -ForegroundColor Green
} catch {
Write-Warning "Failed to move sandbox-setup.ps1: $($_.Exception.Message)"
}
}
# Create desktop shortcuts
Write-Host "Creating desktop shortcuts..." -ForegroundColor Yellow
$desktopPath = Join-Path $InstallPath "Desktop"
$shortcuts = @(
@{Name = "QQ.lnk"; Target = "C:\Program Files (x86)\Tencent\QQ\QQ.exe" },
@{Name = "WeChat.lnk"; Target = "C:\Program Files\Tencent\WeChat\WeChat.exe" },
@{Name = "WeMeet.lnk"; Target = "C:\Program Files\Tencent\WeMeet\WeMeet.exe" }
)
foreach ($shortcut in $shortcuts) {
$shortcutPath = Join-Path $desktopPath $shortcut.Name
if (-not (Test-Path $shortcutPath)) {
# Create empty shortcut files as placeholders
New-Item -ItemType File -Path $shortcutPath -Force | Out-Null
Write-Host "Created shortcut placeholder: $($shortcut.Name)" -ForegroundColor Gray
}
}
Write-Host "malware-sandbox installation completed!" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host "1. Ensure Windows Sandbox is enabled (see requirements above)" -ForegroundColor White
Write-Host "2. Double-click Malware.wsb to start the sandbox" -ForegroundColor White
Write-Host "3. Install your malware applications inside the sandbox" -ForegroundColor White
Write-Host "4. Move desktop shortcuts to fix persistence" -ForegroundColor White
Write-Host ""
Write-Host "Features:" -ForegroundColor Cyan
Write-Host "- Downloads folder is linked to your user Downloads" -ForegroundColor White
Write-Host "- Files downloaded in sandbox will appear in your main Downloads" -ForegroundColor White
Write-Host "- App & Data stored in user profile for persistence (%UserProfile%/malware-sandbox)" -ForegroundColor White
Write-Host "- Directory structure automatically created" -ForegroundColor White