- Go stdlib-only gateway: serves noVNC client, password auth, WS<->TCP relay - auth: PBKDF2-HMAC-SHA256 password hash, HMAC session cookies, login rate limit - relay: hand-written RFC 6455 WebSocket + transparent RFB bridge - vncspawner: cross-OS VNC server detection/launch (Windows/Linux/macOS) - server: /login /logout /vnc /api/status routes, session middleware, embed.FS - scripts: get-novnc, get-vnc (zip-verified), list-ips, open-firewall - run.bat: one-click launcher (asks only password), lists access IPs - README/AGENTS.md (Russian), .gitignore (root-anchored binaries)
121 lines
3.8 KiB
Batchfile
121 lines
3.8 KiB
Batchfile
@echo off
|
||
REM ============================================================
|
||
REM web-vnc launcher - § ¯ã᪠¢ ®¤¨ ª«¨ª. ‘¯à 訢 ¥â ⮫쪮 ¯ ஫ì.
|
||
REM ============================================================
|
||
chcp 866 >nul
|
||
cd /d "%~dp0"
|
||
|
||
echo.
|
||
echo === web-vnc: VNC ¢ ¡à 㧥ॠ===
|
||
echo.
|
||
|
||
REM --- 1. �¨ ਪ ---
|
||
if exist "web-vnc.exe" goto havebin
|
||
where go >nul 2>nul
|
||
if not errorlevel 1 goto dogobuild
|
||
echo [®è¨¡ª ] web-vnc.exe ¥ ©¤¥, Go ¥ ãáâ ®¢«¥.
|
||
echo “áâ ®¢¨â¥ Go á https://go.dev/dl/ «¨¡® ¯®«®¦¨â¥ ᮡà ë© web-vnc.exe à冷¬.
|
||
echo.
|
||
pause
|
||
exit /b 1
|
||
:dogobuild
|
||
echo ‘®¡¨à î web-vnc.exe ...
|
||
go build -o web-vnc.exe .\cmd\web-vnc
|
||
if errorlevel 1 goto buildfail
|
||
:havebin
|
||
|
||
REM --- 2. noVNC-ª«¨¥â ---
|
||
if exist "internal\server\static\core\rfb.js" goto havenovnc
|
||
echo noVNC-ª«¨¥â ¥éñ ¥ ¢áâ஥. �ëâ îáì ᪠ç âì ...
|
||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\get-novnc.ps1"
|
||
if errorlevel 1 goto novncfail
|
||
echo �¥à¥á®¡¨à î á noVNC ...
|
||
go build -o web-vnc.exe .\cmd\web-vnc
|
||
goto havenovnc
|
||
:novncfail
|
||
echo [¯à¥¤ã¯à¥¦¤¥¨¥] �¥ 㤠«®áì ᪠ç âì noVNC (¥â ¨â¥à¥â ?).
|
||
echo ‚ ¡à 㧥ॠ®âªà®¥âáï áâà ¨æ á ¯®¤áª §ª®©. �®¢â®à¨â¥ ¯®§¦¥: scripts\get-novnc.ps1
|
||
echo.
|
||
:havenovnc
|
||
|
||
REM --- 3. VNC-á¥à¢¥à (¯®¨áª/§ £à㧪 ) ---
|
||
set "SPAWNARGS="
|
||
set "SPAWN_CMD="
|
||
if exist "vnc\winvnc.exe" goto uselocalvnc
|
||
if exist "vnc\tvnserver.exe" goto uselocalvnc
|
||
if exist "C:\Program Files\UltraVNC\winvnc.exe" goto autodetectvnc
|
||
if exist "C:\Program Files (x86)\UltraVNC\winvnc.exe" goto autodetectvnc
|
||
if exist "C:\Program Files\uvnc bvba\UltraVNC\winvnc.exe" goto autodetectvnc
|
||
if exist "C:\Program Files (x86)\uvnc bvba\UltraVNC\winvnc.exe" goto autodetectvnc
|
||
if exist "C:\Program Files\TightVNC\tvnserver.exe" goto autodetectvnc
|
||
if exist "C:\Program Files (x86)\TightVNC\tvnserver.exe" goto autodetectvnc
|
||
echo VNC-á¥à¢¥à ¥ ©¤¥. �ëâ îáì ᪠ç âì ¯®àâ â¨¢ë© UltraVNC ...
|
||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\get-vnc.ps1"
|
||
if errorlevel 1 goto novncserver
|
||
if exist "vnc\winvnc.exe" goto uselocalvnc
|
||
if exist "vnc\tvnserver.exe" goto uselocalvnc
|
||
goto novncserver
|
||
:uselocalvnc
|
||
if exist "vnc\winvnc.exe" set "SPAWN_CMD=vnc\winvnc.exe -run"
|
||
if exist "vnc\tvnserver.exe" if not defined SPAWN_CMD set "SPAWN_CMD=vnc\tvnserver.exe -run"
|
||
set "SPAWNARGS=--spawn-command "%SPAWN_CMD%""
|
||
echo � ©¤¥ «®ª «ìë© VNC-á¥à¢¥à: %SPAWN_CMD%
|
||
goto vncdone
|
||
:autodetectvnc
|
||
echo VNC-á¥à¢¥à ©¤¥ ¢ á¨á⥬¥ ( ¢â®-®¯à¥¤¥«¥¨¥ ¯à¨ § ¯ã᪥).
|
||
goto vncdone
|
||
:novncserver
|
||
echo [¯à¥¤ã¯à¥¦¤¥¨¥] VNC-á¥à¢¥à ¥ 㤠«®áì ¯®«ãç¨âì.
|
||
echo �¥§ VNC-á¥à¢¥à à ¡®ç¨© á⮫ ¥ ¡ã¤¥â âà ᫨஢ âìáï.
|
||
echo “áâ ®¢¨â¥ UltraVNC/TightVNC ¢àãçãî ¨«¨ ¯®¢â®à¨â¥: scripts\get-vnc.ps1
|
||
echo.
|
||
:vncdone
|
||
|
||
REM --- 4. � ஫ì ---
|
||
:getpw
|
||
set "PW="
|
||
set /p "PW=‚¢¥¤¨â¥ ¯ à®«ì ¤®áâ㯠: "
|
||
if "%PW%"=="" goto emptypw
|
||
goto gotpw
|
||
:emptypw
|
||
echo � à®«ì ¥ ¬®¦¥â ¡ëâì ¯ãáâë¬.
|
||
goto getpw
|
||
:gotpw
|
||
|
||
REM --- 5. •íè ¯ ஫ï + â®â ¦¥ ¯ à®«ì ¤«ï VNC-á¥à¢¥à ---
|
||
echo ƒ¥¥à¨àãî åíè ¯ ஫ï ...
|
||
for /f "delims=" %%i in ('web-vnc.exe --gen-hash "%PW%"') do set "HASH=%%i"
|
||
if "%HASH%"=="" goto hashfail
|
||
REM ’®â ¦¥ ¯ à®«ì ¡ã¤¥â ¢â®¬ â¨ç¥áª¨ ¯¥à¥¤ noVNC ¤«ï ¢â®à¨§ 樨 VNC-á¥à¢¥à¥.
|
||
set "WEBVNC_VNC_PASSWORD=%PW%"
|
||
set "PW="
|
||
|
||
REM --- 6. „®áâã¯ë¥ ¤à¥á ---
|
||
echo.
|
||
echo === €¤à¥á ¤«ï ¯®¤ª«î票ï (¯®àâ 8080) ===
|
||
echo http://localhost:8080
|
||
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\list-ips.ps1"') do echo http://%%a:8080
|
||
echo.
|
||
echo …᫨ á ¤à㣮© ¬ è¨ë ¥ ®âªàë¢ ¥âáï - ®¤¨ à § ¢ë¯®«¨â¥ ®â ¨¬¥¨
|
||
echo ¤¬¨¨áâà â®à : scripts\open-firewall.bat
|
||
echo.
|
||
|
||
REM --- 7. ‡ ¯ã᪠---
|
||
echo ‡ ¯ã᪠î web-vnc http://localhost:8080
|
||
echo Žáâ ®¢¨âì: Ctrl+C
|
||
echo.
|
||
web-vnc.exe --password-hash "%HASH%" %SPAWNARGS% --spawn --listen :8080
|
||
echo.
|
||
echo ‘¥à¢¥à ®áâ ®¢«¥.
|
||
pause
|
||
exit /b
|
||
|
||
:buildfail
|
||
echo ‘¡®àª ¥ 㤠« áì.
|
||
pause
|
||
exit /b 1
|
||
|
||
:hashfail
|
||
echo [®è¨¡ª ] �¥ 㤠«®áì ᣥ¥à¨à®¢ âì åíè ¯ ஫ï.
|
||
pause
|
||
exit /b 1 |