diff options
| author | WindowsAddict | 2024-08-15 03:41:57 +0000 |
|---|---|---|
| committer | GitHub | 2024-08-15 03:41:57 +0000 |
| commit | bdaf15ade405329a738c1d1ed782551fe9036008 (patch) | |
| tree | cad8b2a7e0c45a0f8fd1a333e2b1f544d6fc5796 | |
| parent | 6b6d52cc2953e363c4bdf195325af12c93b40f53 (diff) | |
| parent | 1446336912952c6fa78ee3eaa9ade8969af2e463 (diff) | |
| download | massgrave.dev-bdaf15ade405329a738c1d1ed782551fe9036008.zip | |
Merge pull request #17 from ave9858/verify
Add additional integrity check
| -rw-r--r-- | static/get.ps1 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/static/get.ps1 b/static/get.ps1 index 0d3b604..8a67b82 100644 --- a/static/get.ps1 +++ b/static/get.ps1 @@ -24,6 +24,20 @@ catch { $response = Invoke-WebRequest -Uri $RandomURL2 -UseBasicParsing
}
+# Verify script integrity
+$releaseHash = 'D666A4C7810B9D3FE9749F2D4E15C5A65D4AC0D7F0B14A144D6631CE61CC5DF3'
+$stream = New-Object IO.MemoryStream
+$writer = New-Object IO.StreamWriter $stream
+$writer.Write($response)
+$writer.Flush()
+$stream.Position = 0
+$hash = [BitConverter]::ToString([Security.Cryptography.SHA256]::Create().ComputeHash($stream)) -replace '-'
+if ($hash -ne $releaseHash) {
+ Write-Warning "Hash ($hash) mismatch, aborting!`nReport this issue at https://massgrave.dev/troubleshoot"
+ $response = $null
+ return
+}
+
$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" }
|
