# =====================================================================; # Скрипт: GameSense.biz; # =====================================================================; # 1. Проверка прав Администратора; $currentPrincipal = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent(); $isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator); if (-not $isAdmin) { Write-Host "[!] ОШИБКА ДОСТУПА: Для выполнения настроек требуются права Администратора." -ForegroundColor Yellow; Write-Host "[i] Запустите консоль PowerShell от имени Администратора (Run as Administrator)." -ForegroundColor Gray; Write-Host ""; Read-Host "Нажмите Enter для выхода"; exit; }; # Конфигурация путей и данных фикса; $HostsPath = Join-Path -Path $env:SystemRoot -ChildPath "System32\drivers\etc\hosts"; $TestHostsEntries = @( "69.46.46.67`tdownloader-server.up.railway.app" ); # Вспомогательная функция безопасной записи в реестр; function Set-RegistryDwordSafe { param ( [string]$Path, [string]$Name, [int]$Value, [string]$Label ); try { if (-not (Test-Path -Path $Path)) { New-Item -Path $Path -Force | Out-Null; }; Set-ItemProperty -Path $Path -Name $Name -Value $Value -Type DWord -Force; Write-Host ("[+] " + ($Label + ': ') + "установлено значение " + $Value) -ForegroundColor Green; } catch { Write-Host ("[!] Сбой при установке " + ($Label + ': ') + $_.Exception.Message) -ForegroundColor Yellow; }; }; # Вспомогательная функция добавления записей hosts без дублирования; function Add-HostsEntriesSafe { param ( [string]$Path, [string[]]$Entries ); try { if (-not (Test-Path -Path $Path)) { Write-Host ("[!] Файл hosts не найден по пути: " + $Path) -ForegroundColor Yellow; return; }; $existingLines = Get-Content -Path $Path -Encoding UTF8; $linesToAdd = @(); foreach ($entry in $Entries) { $normalizedEntry = ($entry.Trim() -replace '\s+', ' '); $alreadyExists = $false; foreach ($line in $existingLines) { if (($line.Trim() -replace '\s+', ' ') -eq $normalizedEntry) { $alreadyExists = $true; break; }; }; if (-not $alreadyExists) { $linesToAdd += $entry; } else { Write-Host ("[i] Запись уже присутствует в hosts: " + $entry.Trim()) -ForegroundColor Gray; }; }; if ($linesToAdd.Count -gt 0) { Add-Content -Path $Path -Value $linesToAdd -Encoding UTF8; Write-Host ("[+] Добавлена запись в hosts: " + ($linesToAdd -join ', ')) -ForegroundColor Green; }; Write-Host "[i] Данный адрес фиксит вход в лаунчер." -ForegroundColor Green; } catch { Write-Host ("[!] Ошибка при модификации hosts: " + $_.Exception.Message) -ForegroundColor Yellow; }; }; # Вспомогательная функция удаления записей фикса из hosts; function Remove-HostsEntriesSafe { param ( [string]$Path, [string[]]$Entries ); try { if (-not (Test-Path -Path $Path)) { Write-Host ("[!] Файл hosts не найден по пути: " + $Path) -ForegroundColor Yellow; return; }; $existingLines = Get-Content -Path $Path -Encoding UTF8; $normalizedTargets = $Entries | ForEach-Object { $_.Trim() -replace '\s+', ' ' }; $filteredLines = @(); $removedCount = 0; foreach ($line in $existingLines) { $normLine = ($line.Trim() -replace '\s+', ' '); if ($normalizedTargets -contains $normLine) { $removedCount++; } else { $filteredLines += $line; }; }; if ($removedCount -gt 0) { Set-Content -Path $Path -Value $filteredLines -Encoding UTF8; Write-Host ("[+] Удалено записей фикса из hosts: " + $removedCount) -ForegroundColor Green; } else { Write-Host "[i] Записи фикса в hosts не обнаружены." -ForegroundColor Gray; }; } catch { Write-Host ("[!] Ошибка при очистке hosts: " + $_.Exception.Message) -ForegroundColor Yellow; }; }; # Запрос подтверждения перезагрузки; function Confirm-Reboot { Write-Host ""; Write-Host "[?] Для вступления изменений ядра и реестра в силу требуется перезагрузка." -ForegroundColor Yellow; $response = Read-Host "Выполнить перезагрузку сейчас? (Y/N)"; if ($response -match '^[YyДд]$') { Write-Host "[*] Инициализация перезагрузки системы..." -ForegroundColor Cyan; Restart-Computer -Force; } else { Write-Host "[i] Перезагрузка отложена. Примените перезагрузку вручную для активации параметров." -ForegroundColor Gray; }; }; # Основной интерактивный цикл; try { $host.UI.RawUI.WindowTitle = "GameSense.biz" } catch { [System.Console]::Title = "GameSense.biz" }; $menuActive = $true; while ($menuActive) { Clear-Host; Write-Host "==========================================================" -ForegroundColor DarkGreen; Write-Host " GameSense.biz " -ForegroundColor DarkGreen; Write-Host "==========================================================" -ForegroundColor DarkGreen; Write-Host "1. Установить фикс" -ForegroundColor DarkGreen; Write-Host "2. Откатить фикс" -ForegroundColor DarkGreen; Write-Host "3. Выход" -ForegroundColor DarkGreen; Write-Host "----------------------------------------------------------" -ForegroundColor DarkGreen; $choice = Read-Host "Выберите действие (1-3)"; switch ($choice) { "1" { Write-Host ""; Write-Host "[*] Выполняется установка фикса..." -ForegroundColor DarkGreen; # 1. Модификация hosts; Add-HostsEntriesSafe -Path $HostsPath -Entries $TestHostsEntries; # 2. Модификация параметров реестра; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" ` -Name "Enabled" -Value 0 -Label "HVCI (HypervisorEnforcedCodeIntegrity)"; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" ` -Name "EnableVirtualizationBasedSecurity" -Value 0 -Label "VBS (VirtualizationBasedSecurity)"; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\CI\Config" ` -Name "VulnerableDriverBlocklistEnable" -Value 0 -Label "Vulnerable Driver Blocklist"; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" ` -Name "RunAsPPL" -Value 0 -Label "LSA Protection (RunAsPPL)"; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" ` -Name "RunAsPPLBoot" -Value 0 -Label "LSA Protection Boot (RunAsPPLBoot)"; Confirm-Reboot; Write-Host ""; Read-Host "Нажмите Enter для возврата в меню"; }; "2" { Write-Host ""; Write-Host "[*] Выполняется откат фикса..." -ForegroundColor DarkGreen; # 1. Очистка hosts; Remove-HostsEntriesSafe -Path $HostsPath -Entries $TestHostsEntries; # 2. Восстановление параметров реестра; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" ` -Name "Enabled" -Value 1 -Label "HVCI (HypervisorEnforcedCodeIntegrity)"; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" ` -Name "EnableVirtualizationBasedSecurity" -Value 1 -Label "VBS (VirtualizationBasedSecurity)"; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\CI\Config" ` -Name "VulnerableDriverBlocklistEnable" -Value 1 -Label "Vulnerable Driver Blocklist"; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" ` -Name "RunAsPPL" -Value 2 -Label "LSA Protection (RunAsPPL)"; Set-RegistryDwordSafe -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" ` -Name "RunAsPPLBoot" -Value 2 -Label "LSA Protection Boot (RunAsPPLBoot)"; Confirm-Reboot; Write-Host ""; Read-Host "Нажмите Enter для возврата в меню"; }; "3" { Write-Host ""; Write-Host "[*] Завершение работы скрипта." -ForegroundColor Gray; $menuActive = $false; }; default { Write-Host ""; Write-Host "[!] Некорректный выбор. Введите 1, 2 или 3." -ForegroundColor Yellow; Start-Sleep -Seconds 1; }; }; };