diff --git a/README.md b/README.md index 7bd2de6..5a5458f 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,10 @@ | Файл | Описание простыми словами | | --------------------------- | ------------------------------------------------------------------ | -| `install-docker-proxy.ps1` | 🚀 **Автоустановщик** — скачайте и запустите, всё сделает сам | -| `discord-windows-hack.ps1` | 🎮 Установка ProxiFyre для Discord/Vesktop | -| `setup-singbox-native.ps1` | 🎯 Нативный sing-box для Discord UDP (голосовые) | +| `manage.ps1` | 🚀 **Главный скрипт** — меню управления всеми компонентами | +| `scripts/setup-singbox.ps1` | 📦 Установка и настройка VPN клиента (sing-box) | +| `scripts/setup-discord.ps1` | 🎮 Настройка ProxiFyre для Discord/Vesktop | +| `scripts/uninstall-all.ps1` | 🗑️ Полное удаление всех компонентов | | `web/server.py` | Веб-интерфейс для управления через браузер | | `web/index.html` | Страница с красивым интерфейсом | | `docker/entrypoint.sh` | Главный скрипт запуска контейнера | @@ -70,23 +71,23 @@ ## 📥 Установка (Windows — самый простой способ) -Откройте **PowerShell** и выполните: +Откройте **PowerShell от имени Администратора** и выполните: ```powershell # Перейдите в папку с проектом cd путь\к\папке\vpn-proxy -# Запустите установщик (проверит Docker, соберёт и запустит) -.\install-docker-proxy.ps1 +# Запустите главное меню управления +.\manage.ps1 ``` -> 💡 **Что делает скрипт:** +> 💡 **Что умеет главное меню:** > -> - Проверяет установлен ли Docker и Docker Compose -> - Если Docker не установлен — показывает ссылку на скачивание -> - Если уже установлено — показывает статус и меню управления -> - Собирает и запускает контейнер -> - Предлагает установить ProxiFyre для Discord/Vesktop +> - Устанавливает и настраивает VPN клиент (sing-box) — **рекомендуется** +> - Показывает статус всех компонентов +> - Показывает IP-адреса для подключения из локальной сети +> - Настраивает ProxiFyre для Discord/Vesktop +> - Полностью удаляет все установленные компоненты ### Если уже установлено @@ -209,39 +210,38 @@ Discord не поддерживает системные настройки пр ```powershell # Запустите от имени Администратора -.\discord-windows-hack.ps1 +.\manage.ps1 +# Выберите пункт [2] — Настройка Discord/Vesktop ``` **Что делает скрипт:** - Устанавливает драйвер Windows Packet Filter - Устанавливает ProxiFyre как службу Windows - Настраивает перехват трафика для Discord/Vesktop -- Направляет его через прокси `127.0.0.1:8080` +- Направляет его через локальный прокси `127.0.0.1:1080` -> ⚠️ **Важно:** Docker Desktop на Windows **не поддерживает UDP**. Голосовые звонки Discord могут не работать. -> Для полной поддержки голоса используйте `setup-singbox-native.ps1`. +> ⚠️ **Важно:** Для работы Discord требуется установленный VPN клиент (пункт [1] в меню). -### 🎯 Нативный sing-box для Discord (голосовые звонки) +### 🎯 VPN Клиент (sing-box) — Рекомендуемый способ -Если Docker запущен локально на Windows и голосовые звонки Discord не работают: +Нативный VPN клиент с поддержкой UDP для игр и голосовых звонков: ```powershell # Запустите от имени Администратора -.\setup-singbox-native.ps1 +.\manage.ps1 +# Выберите пункт [1] — VPN Клиент (Sing-box) ``` **Что делает скрипт:** -- Спрашивает режим работы (удалённый прокси или локальный Docker) - Загружает sing-box v1.11.4 для Windows -- Работает с подписками (как веб-интерфейс) +- Работает с подписками и VLESS ссылками - Создаёт задачу автозапуска в Планировщике Windows -- Настраивает ProxiFyre на локальный SOCKS5 (порт 1080) +- Открывает порт 1080 для SOCKS5 прокси +- Показывает IP-адреса для использования в локальной сети -**Если ProxiFyre уже установлен:** -При повторном запуске скрипт покажет: +**При повторном запуске скрипт покажет:** - Текущий статус службы -- Настроенные приложения и прокси -- Меню управления (запуск, остановка, логи, переустановка) +- Меню управления (смена сервера, перезапуск, остановка) --- diff --git a/manage.ps1 b/manage.ps1 index 4863bed..0a5958f 100644 --- a/manage.ps1 +++ b/manage.ps1 @@ -2,6 +2,9 @@ # 🚀 VPN PROXY CONTROL CENTER (WINDOWS) # ========================================== # Главный скрипт управления. Запускать от имени Администратора. +# Использование: .\manage.ps1 [-Debug] + +param([switch]$Debug) $ScriptDir = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path } $LibDir = "$ScriptDir\scripts\lib" @@ -15,10 +18,15 @@ if (!(Test-Path "$LibDir\Common.ps1")) { . "$LibDir\Common.ps1" . "$LibDir\System.ps1" +# Установка режима отладки +if ($Debug) { + Set-DebugMode -Enabled $true +} + Ensure-Admin while ($true) { - Write-Header "VPN PROXY CONTROL CENTER" + Write-Header "VPN PROXY CONTROL CENTER" -ClearScreen # --- СБОР СТАТУСОВ --- @@ -38,6 +46,27 @@ while ($true) { Write-Host " [1] 📦 VPN Клиент (Sing-box)" -NoNewline -ForegroundColor White Write-Host " [$sbStr]" -ForegroundColor $sbColor Write-Host " Основной способ. Поддерживает UDP и игры." -ForegroundColor Gray + + # Показываем информацию о подключении если sing-box работает + if ($sbStatus -eq "Running") { + $LocalProxyPort = 1080 + . "$LibDir\Net.ps1" + $ips = Get-LocalIPs + + Write-Host "" + Write-Host " 📡 ПОДКЛЮЧЕНИЕ К ПРОКСИ" -ForegroundColor Cyan + Write-Host " ─────────────────────────────" -ForegroundColor DarkGray + Write-Host " Локально: " -NoNewline -ForegroundColor Gray + Write-Host "127.0.0.1:$LocalProxyPort" -ForegroundColor Green + + if ($ips) { + Write-Host " Из сети:" -ForegroundColor Gray + foreach ($ip in $ips) { + Write-Host " ${ip}:$LocalProxyPort" -ForegroundColor Yellow + } + } + Write-Host "" + } Write-Host "" Write-Host " [2] 🎮 Настройка Discord/Vesktop" -NoNewline -ForegroundColor White diff --git a/scripts/lib/Common.ps1 b/scripts/lib/Common.ps1 index 0a18391..0ed302b 100644 --- a/scripts/lib/Common.ps1 +++ b/scripts/lib/Common.ps1 @@ -2,6 +2,25 @@ # 🛠️ COMMON UTILS # ========================================== +# --- ГЛОБАЛЬНЫЕ НАСТРОЙКИ --- + +# Режим отладки (передаётся через -Debug) +if (-not (Test-Path variable:script:DebugMode)) { + $script:DebugMode = $false +} + +function Set-DebugMode { + param([bool]$Enabled) + $script:DebugMode = $Enabled + if ($Enabled) { + Write-Host " 🔧 Debug режим включён" -ForegroundColor Magenta + } +} + +function Get-DebugMode { + return $script:DebugMode +} + # --- ЦВЕТА И ВЫВОД --- function Write-Step { param($msg) Write-Host "`n📦 $msg" -ForegroundColor Cyan } @@ -10,8 +29,20 @@ function Write-Warning { param($msg) Write-Host " ⚠️ $msg" -ForegroundColo function Write-Error { param($msg) Write-Host " ❌ $msg" -ForegroundColor Red } function Write-Info { param($msg) Write-Host " ℹ️ $msg" -ForegroundColor Gray } +function Write-DebugLog { + param($msg) + if ($script:DebugMode) { + Write-Host " [DEBUG] $msg" -ForegroundColor DarkGray + } +} + function Write-Header { - param($Title) + param($Title, [switch]$ClearScreen) + + if ($ClearScreen -and -not $script:DebugMode) { + Clear-Host + } + Write-Host "" Write-Host "==========================================" -ForegroundColor Cyan Write-Host " $Title" -ForegroundColor Cyan @@ -19,6 +50,36 @@ function Write-Header { Write-Host "" } +# --- ЗАПУСК КОМАНД --- + +function Invoke-Silent { + param( + [string]$FilePath, + [string]$Arguments, + [switch]$Wait + ) + + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.FileName = $FilePath + $psi.Arguments = $Arguments + $psi.UseShellExecute = $false + $psi.CreateNoWindow = $true + + if (-not $script:DebugMode) { + $psi.RedirectStandardOutput = $true + $psi.RedirectStandardError = $true + } + + $process = [System.Diagnostics.Process]::Start($psi) + + if ($Wait) { + $process.WaitForExit() + return $process.ExitCode + } + + return $process +} + # --- ПОЛЕЗНЫЕ ФУНКЦИИ --- function Get-ScriptDirectory { @@ -55,5 +116,3 @@ function Show-Menu { return Read-Host "$Prompt" } - - diff --git a/scripts/lib/System.ps1 b/scripts/lib/System.ps1 index b3dc5b8..217713e 100644 --- a/scripts/lib/System.ps1 +++ b/scripts/lib/System.ps1 @@ -4,24 +4,6 @@ # --- СИСТЕМНАЯ ИНФОРМАЦИЯ --- -function Get-HWID { - param([string]$StoreDir) - - $hwidFile = "$StoreDir\hwid" - if (Test-Path $hwidFile) { - return (Get-Content $hwidFile -Raw).Trim() - } - - $hwid = [System.Guid]::NewGuid().ToString("N").Substring(0, 16) - - if (!(Test-Path $StoreDir)) { - New-Item -ItemType Directory -Path $StoreDir -Force | Out-Null - } - - Set-Content -Path $hwidFile -Value $hwid - return $hwid -} - function Get-SystemInfo { return @{ os = "windows" diff --git a/scripts/setup-discord.ps1 b/scripts/setup-discord.ps1 index 19d8b29..4f5918c 100644 --- a/scripts/setup-discord.ps1 +++ b/scripts/setup-discord.ps1 @@ -2,74 +2,94 @@ # 🎮 DISCORD PROXY SETUP # ========================================== -param([switch]$Force) +param( + [switch]$Force, + [switch]$Debug +) $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path . "$ScriptDir\lib\Common.ps1" . "$ScriptDir\lib\Net.ps1" . "$ScriptDir\lib\System.ps1" -Write-Header "НАСТРОЙКА DISCORD / VESKTOP" +if ($Debug) { Set-DebugMode -Enabled $true } + +Write-Header "НАСТРОЙКА DISCORD / VESKTOP" -ClearScreen Ensure-Admin $InstallPath = "C:\Tools\ProxiFyre" +$ConfigPath = "$InstallPath\app-config.json" $DriverUrl = "https://github.com/wiresock/ndisapi/releases/download/v3.6.2/Windows.Packet.Filter.3.6.2.1.x64.msi" $AppUrl = "https://github.com/wiresock/proxifyre/releases/download/v2.1.4/ProxiFyre-v2.1.4-x64-signed.zip" -# Проверка Sing-box -$singboxStatus = Get-TaskStatus -Name "SingBoxProxy" -$localProxy = "127.0.0.1:1080" -$useLocal = $false +# --- ФУНКЦИИ --- -if ($singboxStatus -eq "Running") { - Write-Info "Обнаружен работающий Native Sing-box." - $useLocal = $true -} -else { - Write-Warning "Native Sing-box не запущен!" - Write-Host " Для работы голосовых звонков он необходим." -ForegroundColor Gray - Write-Host " Вы можете вернуться в главное меню и настроить его." -ForegroundColor Gray - if ((Read-Host " Продолжить настройку БЕЗ него (голос может не работать)? (y/n)") -ne 'y') { exit } +function Test-ProxyConnection { + param([string]$ProxyAddr) + + Write-Info "Проверка подключения к прокси $ProxyAddr..." + + try { + $parts = $ProxyAddr -split ":" + $host_ = $parts[0] + $port = [int]$parts[1] + + # 1. Проверяем TCP соединение + $tcp = New-Object System.Net.Sockets.TcpClient + $tcp.Connect($host_, $port) + $tcp.Close() + Write-Success "TCP соединение установлено" + + # 2. Пробуем получить внешний IP через прокси (используем curl для SOCKS5) + try { + $result = & curl.exe -s -x "socks5://$ProxyAddr" "http://v4.ident.me" --connect-timeout 5 2>$null + if ($result -match "^\d+\.\d+\.\d+\.\d+$") { + Write-Success "Внешний IP через прокси: $result" + return $true + } + } + catch {} + + Write-Warning "TCP работает, но не удалось получить IP. Возможно прокси не полностью настроен." + return $true + } + catch { + Write-Error "Не удалось подключиться к $ProxyAddr" + Write-Host " Убедитесь, что прокси запущен и доступен." -ForegroundColor Gray + return $false + } } -# Меню выбора приложений -Write-Host "`n🎮 Какие приложения проксировать?" -ForegroundColor Yellow -$appOpts = [Ordered]@{ - "1" = "Discord" - "2" = "Vesktop" - "3" = "Discord + Vesktop" -} -$appChoice = Show-Menu -Options $appOpts -$targetApps = switch ($appChoice) { - "1" { @("Discord") } - "2" { @("Vesktop") } - "3" { @("Vesktop", "Discord") } - default { @("Discord") } +function Get-CurrentConfig { + if (Test-Path $ConfigPath) { + try { + $cfg = Get-Content $ConfigPath -Raw | ConvertFrom-Json + return @{ + Apps = $cfg.proxies[0].appNames -join ", " + Proxy = $cfg.proxies[0].socks5ProxyEndpoint + } + } + catch {} + } + return $null } -$proxyAddr = $localProxy -if (!$useLocal) { - $proxyAddr = Read-Host "Введите адрес прокси (хост:порт) [Enter для $localProxy]" - if ([string]::IsNullOrWhiteSpace($proxyAddr)) { $proxyAddr = $localProxy } -} +function Install-ProxiFyre { + # Установка драйвера + Write-Step "Установка драйвера..." + $msi = "$env:TEMP\WinpkFilter.msi" + if (Download-File -Url $DriverUrl -Destination $msi) { + Start-Process msiexec.exe -ArgumentList "/i `"$msi`" /qn /norestart" -Wait + Write-Success "Драйвер готов" + } -# Установка драйвера -Write-Step "Установка драйвера..." -$msi = "$env:TEMP\WinpkFilter.msi" -if (Download-File -Url $DriverUrl -Destination $msi) { - Start-Process msiexec.exe -ArgumentList "/i `"$msi`" /qn /norestart" -Wait - Write-Success "Драйвер готов" -} - -# Установка ProxiFyre -Write-Step "Установка ProxiFyre..." -if (!(Test-Path $InstallPath) -or $Force) { + # Установка ProxiFyre + Write-Step "Установка ProxiFyre..." New-Item -ItemType Directory -Path $InstallPath -Force | Out-Null $zip = "$env:TEMP\ProxiFyre.zip" if (Download-File -Url $AppUrl -Destination $zip) { Expand-Archive -Path $zip -DestinationPath $InstallPath -Force - # Handle update folder structure if needed, simplified here assuming flat or check generic $exe = Get-ChildItem $InstallPath -Recurse -Filter "ProxiFyre.exe" | Select -First 1 if ($exe.DirectoryName -ne $InstallPath) { Copy-Item "$($exe.DirectoryName)\*" $InstallPath -Recurse -Force @@ -78,23 +98,177 @@ if (!(Test-Path $InstallPath) -or $Force) { } } -# Конфиг -$cfg = @{ - logLevel = "Info" - proxies = @(@{ - appNames = $targetApps - socks5ProxyEndpoint = $proxyAddr - supportedProtocols = @("TCP", "UDP") - }) - excludes = @() +function Configure-And-Start { + param($TargetApps, $ProxyAddr) + + # Конфиг + $cfg = @{ + logLevel = "Info" + proxies = @(@{ + appNames = $TargetApps + socks5ProxyEndpoint = $ProxyAddr + supportedProtocols = @("TCP", "UDP") + }) + excludes = @() + } + $cfg | ConvertTo-Json -Depth 5 | Set-Content $ConfigPath -Encoding UTF8 + + # Служба + Write-Step "Перезапуск службы..." + if (Get-DebugMode) { + & "$InstallPath\ProxiFyre.exe" stop + & "$InstallPath\ProxiFyre.exe" install + & "$InstallPath\ProxiFyre.exe" start + } + else { + & "$InstallPath\ProxiFyre.exe" stop 2>&1 | Out-Null + & "$InstallPath\ProxiFyre.exe" install 2>&1 | Out-Null + & "$InstallPath\ProxiFyre.exe" start 2>&1 | Out-Null + } + + Write-Success "Готово! Discord должен работать через прокси." } -$cfg | ConvertTo-Json -Depth 5 | Set-Content "$InstallPath\app-config.json" -Encoding UTF8 -# Служба -Write-Step "Перезапуск службы..." -Start-Process "$InstallPath\ProxiFyre.exe" -ArgumentList "stop" -Wait -NoNewWindow -Start-Process "$InstallPath\ProxiFyre.exe" -ArgumentList "install" -Wait -NoNewWindow -Start-Process "$InstallPath\ProxiFyre.exe" -ArgumentList "start" -Wait -NoNewWindow +function Select-Apps { + Write-Host "`n🎮 Какие приложения проксировать?" -ForegroundColor Yellow + $appOpts = [Ordered]@{ + "1" = "Discord" + "2" = "Vesktop" + "3" = "Discord + Vesktop" + } + $appChoice = Show-Menu -Options $appOpts + $result = switch ($appChoice) { + "1" { @("Discord") } + "2" { @("Vesktop") } + "3" { @("Vesktop", "Discord") } + default { @("Discord") } + } + return $result +} -Write-Success "Готово! Discord должен работать через прокси." +function Get-ProxyAddress { + # Проверяем локальный sing-box + $singboxStatus = Get-TaskStatus -Name "SingBoxProxy" + $localProxy = "127.0.0.1:1080" + + if ($singboxStatus -eq "Running") { + Write-Info "Обнаружен работающий VPN клиент (Sing-box)." + Write-Host " Рекомендуется использовать локальный прокси: " -NoNewline -ForegroundColor Gray + Write-Host $localProxy -ForegroundColor Green + + $useLocal = Read-Host " Использовать локальный? (y/n) [y]" + if ($useLocal -ne 'n') { + return $localProxy + } + } + else { + Write-Warning "VPN клиент не запущен!" + Write-Host " Вы можете указать адрес удалённого прокси." -ForegroundColor Gray + } + + # Запрашиваем адрес + while ($true) { + $proxyAddr = Read-Host "`n Введите адрес прокси (IP:порт)" + + if ([string]::IsNullOrWhiteSpace($proxyAddr)) { + Write-Warning "Адрес не указан" + continue + } + + if ($proxyAddr -notmatch "^[\d\.]+:\d+$") { + Write-Error "Неверный формат. Ожидается: IP:порт (например 192.168.1.100:1080)" + continue + } + + # Проверяем подключение + if (Test-ProxyConnection -ProxyAddr $proxyAddr) { + return $proxyAddr + } + + $retry = Read-Host " Попробовать другой адрес? (y/n)" + if ($retry -ne 'y') { return $null } + } +} + +# --- MAIN --- + +$isInstalled = Test-Path "$InstallPath\ProxiFyre.exe" +$discSvc = Get-Service -Name "ProxiFyreService" -ErrorAction SilentlyContinue +$currentConfig = Get-CurrentConfig + +if ($isInstalled -and $currentConfig -and -not $Force) { + # Уже установлено — показываем меню управления + Write-Info "ProxiFyre уже установлен." + Write-Host "" + Write-Host " Статус: " -NoNewline -ForegroundColor Gray + if ($discSvc.Status -eq 'Running') { + Write-Host "АКТИВЕН" -ForegroundColor Green + } + else { + Write-Host "ОСТАНОВЛЕН" -ForegroundColor Yellow + } + Write-Host " Приложения: $($currentConfig.Apps)" -ForegroundColor Gray + Write-Host " Прокси: $($currentConfig.Proxy)" -ForegroundColor Gray + Write-Host "" + + $opts = [Ordered]@{ + "1" = "Изменить настройки (приложения/прокси)" + "2" = "Проверить подключение к прокси" + "3" = "Перезапустить службу" + "4" = "Остановить службу" + "5" = "Переустановить" + "b" = "Назад" + } + + $action = Show-Menu -Options $opts + + switch ($action) { + "1" { + $targetApps = Select-Apps + $proxyAddr = Get-ProxyAddress + if ($proxyAddr) { + Configure-And-Start -TargetApps $targetApps -ProxyAddr $proxyAddr + } + } + "2" { + Test-ProxyConnection -ProxyAddr $currentConfig.Proxy | Out-Null + } + "3" { + Write-Step "Перезапуск службы..." + Start-Process "$InstallPath\ProxiFyre.exe" -ArgumentList "stop" -Wait -NoNewWindow + Start-Process "$InstallPath\ProxiFyre.exe" -ArgumentList "start" -Wait -NoNewWindow + Write-Success "Перезапущено!" + } + "4" { + Start-Process "$InstallPath\ProxiFyre.exe" -ArgumentList "stop" -Wait -NoNewWindow + Write-Success "Остановлено!" + } + "5" { + $Force = $true + } + "b" { exit } + } + + if (-not $Force) { + Start-Sleep -Seconds 2 + exit + } +} + +# --- НОВАЯ УСТАНОВКА --- + +if (-not $isInstalled -or $Force) { + Install-ProxiFyre +} + +$targetApps = Select-Apps +$proxyAddr = Get-ProxyAddress + +if (-not $proxyAddr) { + Write-Error "Прокси не настроен. Выход." + Start-Sleep -Seconds 2 + exit +} + +Configure-And-Start -TargetApps $targetApps -ProxyAddr $proxyAddr Start-Sleep -Seconds 3 diff --git a/scripts/setup-singbox.ps1 b/scripts/setup-singbox.ps1 index 772df9e..f55555d 100644 --- a/scripts/setup-singbox.ps1 +++ b/scripts/setup-singbox.ps1 @@ -4,6 +4,7 @@ param( [switch]$Force, + [switch]$Debug, [string]$SubscriptionUrl = "" ) @@ -158,7 +159,9 @@ function Parse-VlessUrl { # --- MAIN --- -Write-Header "NATIVE SING-BOX (UDP ПОДДЕРЖКА)" +if ($Debug) { Set-DebugMode -Enabled $true } + +Write-Header "NATIVE SING-BOX (UDP ПОДДЕРЖКА)" -ClearScreen $taskStatus = Get-TaskStatus -Name $TaskName diff --git a/scripts/uninstall-all.ps1 b/scripts/uninstall-all.ps1 index d1f8ff3..72494b3 100644 --- a/scripts/uninstall-all.ps1 +++ b/scripts/uninstall-all.ps1 @@ -2,11 +2,15 @@ # 🗑️ UNINSTALL ALL (CLEANUP) # ========================================== +param([switch]$Debug) + $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path . "$ScriptDir\lib\Common.ps1" . "$ScriptDir\lib\System.ps1" -Write-Header "ПОЛНОЕ УДАЛЕНИЕ" +if ($Debug) { Set-DebugMode -Enabled $true } + +Write-Header "ПОЛНОЕ УДАЛЕНИЕ" -ClearScreen Ensure-Admin @@ -27,11 +31,17 @@ if (Test-Path "C:\Tools\sing-box") { Write-Success "Файлы удалены" } -Write-Step "Удаление Discrod Proxy (ProxiFyre)..." +Write-Step "Удаление Discord Proxy (ProxiFyre)..." $pfDir = "C:\Tools\ProxiFyre" if (Test-Path "$pfDir\ProxiFyre.exe") { - Start-Process "$pfDir\ProxiFyre.exe" -ArgumentList "uninstall" -Wait -NoNewWindow + if (Get-DebugMode) { + & "$pfDir\ProxiFyre.exe" uninstall + } + else { + & "$pfDir\ProxiFyre.exe" uninstall 2>&1 | Out-Null + } Start-Sleep -Seconds 2 + Write-Success "Служба удалена" } if (Test-Path $pfDir) {