summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorWindowsAddict2024-07-23 02:20:24 +0000
committerWindowsAddict2024-07-23 02:20:24 +0000
commit1c7b2446c29aa410dd78cdf461abc6812738349d (patch)
treea9aaea7497508a201d28842b918a4e75d0bc3f65 /static
parent044f7426f5fe52382cde3ab355f333aae324f374 (diff)
downloadmassgrave.dev-1c7b2446c29aa410dd78cdf461abc6812738349d.zip
Use GUID and add comspec variable
Diffstat (limited to 'static')
-rw-r--r--static/get.ps16
1 files changed, 4 insertions, 2 deletions
diff --git a/static/get.ps1 b/static/get.ps1
index 92760da..7b46c21 100644
--- a/static/get.ps1
+++ b/static/get.ps1
@@ -24,7 +24,7 @@ catch {
$response = Invoke-WebRequest -Uri $RandomURL2 -UseBasicParsing
}
-$rand = Get-Random -Maximum 99999999
+$rand = [Guid]::NewGuid().Guid
$isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544')
$FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\MAS_$rand.cmd" } else { "$env:TEMP\MAS_$rand.cmd" }
@@ -33,7 +33,9 @@ $prefix = "@::: $rand `r`n"
$content = $prefix + $response
Set-Content -Path $FilePath -Value $content
-Start-Process $FilePath $ScriptArgs -Wait
+# Set ComSpec variable for current session in case its corrupt in the system
+$env:ComSpec = "$env:SystemRoot\system32\cmd.exe"
+Start-Process cmd.exe "/c """"$FilePath"" $ScriptArgs""" -Wait
$FilePaths = @("$env:TEMP\MAS*.cmd", "$env:SystemRoot\Temp\MAS*.cmd")
foreach ($FilePath in $FilePaths) { Get-Item $FilePath | Remove-Item }