$ErrorActionPreference = 'Stop' if (-not [Environment]::Is64BitProcess) { throw 'Gspoof requires 64-bit Windows PowerShell 5.1. Open its x64 version.' } $gspoofOrigin = 'https://gspoof.banka.gg' $gspoofTls = [Net.ServicePointManager]::SecurityProtocol $gspoofWeb = New-Object Net.WebClient try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $gspoofWeb.Headers['User-Agent'] = 'Gspoof-Bootstrap/1.0' $gspoofManifest = $gspoofWeb.DownloadString("$gspoofOrigin/v1/release") | ConvertFrom-Json $gspoofBytes = $gspoofWeb.DownloadData("$gspoofOrigin/releases/Gspoof.Module.exe") if ($gspoofBytes.Length -gt 16777216) { throw 'Unexpected module size.' } $gspoofSha = [Security.Cryptography.SHA256]::Create() try { $gspoofHash = [BitConverter]::ToString($gspoofSha.ComputeHash($gspoofBytes)).Replace('-', '').ToLowerInvariant() } finally { $gspoofSha.Dispose() } if ($gspoofHash -cne $gspoofManifest.sha256) { throw 'Module integrity check failed. Retry later.' } $gspoofAssembly = [Reflection.Assembly]::Load($gspoofBytes) $gspoofEntry = $gspoofAssembly.EntryPoint if ($null -eq $gspoofEntry) { throw 'The server returned an incompatible module.' } $gspoofArguments = New-Object object[] 1 $gspoofArguments[0] = [string[]]@() $gspoofCode = $gspoofEntry.Invoke($null, $gspoofArguments) if ($gspoofCode -ne 0) { Write-Host 'Gspoof stopped. See the message above.' } } catch [Reflection.TargetInvocationException] { throw $_.Exception.InnerException } finally { $gspoofWeb.Dispose() [Net.ServicePointManager]::SecurityProtocol = $gspoofTls Remove-Variable gspoofBytes, gspoofAssembly, gspoofArguments -ErrorAction SilentlyContinue }