$ErrorActionPreference = 'Stop' $baseUrl = 'https://1.1519384.xyz' if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Start-Process powershell.exe -Verb RunAs -ArgumentList ('-NoProfile -Command "irm ' + $baseUrl + ' | iex"') return } [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 $steamPath = (Get-ItemProperty 'HKCU:\Software\Valve\Steam' -ErrorAction SilentlyContinue).SteamPath if (-not $steamPath) { $steamPath = (Get-ItemProperty 'HKLM:\SOFTWARE\WOW6432Node\Valve\Steam' -ErrorAction SilentlyContinue).InstallPath } if (-not $steamPath -or -not (Test-Path -LiteralPath (Join-Path $steamPath 'steam.exe'))) { throw 'Steam installation was not found. Start Steam once and try again.' } $steamPath = [IO.Path]::GetFullPath($steamPath).TrimEnd([char[]]@('\','/')) $temporary = Join-Path $steamPath ('.vps-install-' + [Guid]::NewGuid().ToString('N')) New-Item -ItemType Directory -Path $temporary | Out-Null try { Write-Host 'Downloading client package...' $manifest = Invoke-RestMethod -Uri ($baseUrl + '/install.json') if ($manifest.sha256 -notmatch '^[a-f0-9]{64}$' -or $manifest.download -ne '/client.zip' -or $manifest.size -gt 52428800) { throw 'Invalid package metadata.' } $archivePath = Join-Path $temporary 'client.zip' Invoke-WebRequest -UseBasicParsing -Uri ($baseUrl + '/client.zip') -OutFile $archivePath if ((Get-Item -LiteralPath $archivePath).Length -ne $manifest.size) { throw 'Package size check failed.' } $hash = (Get-FileHash -LiteralPath $archivePath -Algorithm SHA256).Hash.ToLowerInvariant() if ($hash -ne $manifest.sha256) { throw 'Package checksum check failed.' } $rsa = New-Object Security.Cryptography.RSACryptoServiceProvider try { $rsa.FromXmlString('v82zBBuHd53jNmQ0iK6gk21BkL0ScstsqZ9sWF8NjccPeTUArcmSfJStbShUGPt214OTlaLXpUlaDP/FINXkuhGe27CjTEnEGBZQZgM0/ebM3Q5hPQo+rRv1/PRtxw950HFr8e4wBBR72mEdY7rN4vuhuIla5nA8A6sDMhRiwQTsRSBu+CZ5OGDGpwY3mPhT3Kxoradiqr45QQXde8f4bHMa6EesFbzWcHthGp+efFyGb9ov7l4/vV3xQoztpBSEozmL9ibEqqny11FwL6EEmxsROvDIi84ThiooydIBZPgaszM5vO3pu5ON0yToW8Fo9V7yqo2xsjlUnRUHnUrpWw==AQAB') $signedData = [Text.Encoding]::UTF8.GetBytes($hash + "`n" + [string]$manifest.size) if (-not $rsa.VerifyData($signedData, 'SHA256', [Convert]::FromBase64String($manifest.signature))) { throw 'Package signature check failed.' } } finally { $rsa.Dispose() } Add-Type -AssemblyName System.IO.Compression.FileSystem $destination = Join-Path $temporary 'files' New-Item -ItemType Directory -Path $destination | Out-Null $archive = [IO.Compression.ZipFile]::OpenRead($archivePath) try { $total = [long]0 if ($archive.Entries.Count -gt 4096) { throw 'Too many files in package.' } foreach ($entry in $archive.Entries) { $total += $entry.Length $target = [IO.Path]::GetFullPath((Join-Path $destination $entry.FullName)) if (-not $target.StartsWith($destination + [IO.Path]::DirectorySeparatorChar, [StringComparison]::OrdinalIgnoreCase) -or $total -gt 314572800) { throw 'Unsafe archive path or size.' } } } finally { $archive.Dispose() } [IO.Compression.ZipFile]::ExtractToDirectory($archivePath, $destination) $children = @(Get-ChildItem -LiteralPath $destination -Force) if ($children.Count -eq 1 -and $children[0].PSIsContainer) { $destination = $children[0].FullName } if (Get-Process steam -ErrorAction SilentlyContinue) { Write-Host 'Closing Steam before installing...' Start-Process -FilePath (Join-Path $steamPath 'steam.exe') -ArgumentList '-shutdown' for ($attempt = 0; $attempt -lt 30; $attempt++) { if (-not (Get-Process steam -ErrorAction SilentlyContinue)) { break } Start-Sleep -Seconds 1 } if (Get-Process steam -ErrorAction SilentlyContinue) { throw 'Please close Steam and run the command again.' } } Get-ChildItem -LiteralPath $destination -Force | Copy-Item -Destination $steamPath -Recurse -Force Write-Host 'Client package installed. Starting Steam...' Start-Process -FilePath (Join-Path $steamPath 'steam.exe') } finally { if ($temporary.StartsWith($steamPath + [IO.Path]::DirectorySeparatorChar, [StringComparison]::OrdinalIgnoreCase)) { Remove-Item -LiteralPath $temporary -Recurse -Force -ErrorAction SilentlyContinue } }