Add simple iGUI

This commit is contained in:
akimcom2 2025-06-21 15:23:25 +03:00
parent f76d4cf376
commit 5f2df51061
27 changed files with 348 additions and 14 deletions

View File

@ -1,5 +1,25 @@
@echo off @echo off
@chcp 65001 >nul
set "LOCAL_VERSION=1.8.1" set "LOCAL_VERSION=1.8.1"
:: Обработка аргументов
if "%~1"=="" goto help
if /i "%~1"=="install" goto service_install
if /i "%~1"=="remove" goto service_remove
if /i "%~1"=="status" goto service_status
if /i "%~1"=="diagnostics" goto service_diagnostics
if /i "%~1"=="updates" goto service_check_updates
if /i "%~1"=="game" goto game_switch
if /i "%~1"=="ipset" goto ipset_switch
if /i "%~1"=="ipset_update" goto ipset_update
if /i "%~1"=="status_zapret" call :test_service zapret soft & exit /b
if /i "%~1"=="check_updates" call :service_check_updates soft & exit /b
if /i "%~1"=="load_game_filter" call :game_switch_status & exit /b
:help
echo Использование: service.bat [install^|remove^|status^|diagnostics^|updates^|game^|ipset^|ipset_update]
echo Дополнительно: status_zapret, check_updates, load_game_filter
exit /b
:: External commands :: External commands
if "%~1"=="status_zapret" ( if "%~1"=="status_zapret" (
@ -66,16 +86,24 @@ chcp 437 > nul
echo Checking services and tasks... echo Checking services and tasks...
call :test_service zapret call :test_service zapret
call :test_service WinDivert call :test_service WinDivert
tasklist /FI "IMAGENAME eq winws.exe" | find /I "winws.exe" > nul tasklist /FI "IMAGENAME eq winws.exe" | find /I "winws.exe" > nul
setlocal enabledelayedexpansion
if !errorlevel!==0 ( if !errorlevel!==0 (
call :PrintGreen "Bypass is ACTIVE" call :PrintGreen "Bypass is ACTIVE"
) else ( ) else (
call :PrintRed "Bypass NOT FOUND" call :PrintRed "Bypass NOT FOUND"
) )
pause pause
goto menu exit /k
:: --- Подпрограммы ---
:PrintGreen
echo %~1
exit /b
:PrintRed
echo %~1
exit /b
:test_service :test_service
set "ServiceName=%~1" set "ServiceName=%~1"
@ -95,7 +123,6 @@ if "%ServiceStatus%"=="RUNNING" (
) else if not "%~2"=="soft" ( ) else if not "%~2"=="soft" (
echo "%ServiceName%" service is NOT running. echo "%ServiceName%" service is NOT running.
) )
exit /b exit /b
@ -114,7 +141,6 @@ net stop "WinDivert14"
sc delete "WinDivert14" sc delete "WinDivert14"
pause pause
goto menu
:: INSTALL ============================= :: INSTALL =============================
@ -122,6 +148,9 @@ goto menu
cls cls
chcp 65001 > nul chcp 65001 > nul
:: Включаем поддержку !variable!
setlocal enabledelayedexpansion
:: Main :: Main
cd /d "%~dp0" cd /d "%~dp0"
set "BIN_PATH=%~dp0bin\" set "BIN_PATH=%~dp0bin\"
@ -139,6 +168,8 @@ for %%f in (*.bat) do (
) )
) )
endlocal
:: Choosing file :: Choosing file
set "choice=" set "choice="
set /p "choice=Input file index (number): " set /p "choice=Input file index (number): "
@ -148,7 +179,6 @@ set "selectedFile=!file%choice%!"
if not defined selectedFile ( if not defined selectedFile (
echo Invalid choice, exiting... echo Invalid choice, exiting...
pause pause
goto menu
) )
:: Args that should be followed by value :: Args that should be followed by value
@ -242,7 +272,6 @@ sc description %SRVCNAME% "Zapret DPI bypass software"
sc start %SRVCNAME% sc start %SRVCNAME%
pause pause
goto menu
:: CHECK UPDATES ======================= :: CHECK UPDATES =======================
@ -263,7 +292,6 @@ if not defined GITHUB_VERSION (
echo Warning: failed to fetch the latest version. Check your internet connection. This warning does not affect the operation of zapret echo Warning: failed to fetch the latest version. Check your internet connection. This warning does not affect the operation of zapret
pause pause
if "%1"=="soft" exit /b if "%1"=="soft" exit /b
goto menu
) )
:: Version comparison :: Version comparison
@ -272,7 +300,6 @@ if "%LOCAL_VERSION%"=="%GITHUB_VERSION%" (
if "%1"=="soft" exit /b if "%1"=="soft" exit /b
pause pause
goto menu
) )
echo New version available: %GITHUB_VERSION% echo New version available: %GITHUB_VERSION%
@ -291,7 +318,6 @@ if /i "%CHOICE%"=="Y" (
if "%1"=="soft" exit /b if "%1"=="soft" exit /b
pause pause
goto menu
:: DIAGNOSTICS ========================= :: DIAGNOSTICS =========================
@ -412,7 +438,6 @@ if /i "!CHOICE!"=="Y" (
echo: echo:
pause pause
goto menu
:: GAME SWITCH ======================== :: GAME SWITCH ========================
@ -446,7 +471,6 @@ if not exist "%gameFlagFile%" (
) )
pause pause
goto menu
:: IPSET SWITCH ======================= :: IPSET SWITCH =======================
@ -496,7 +520,6 @@ if !errorlevel!==0 (
) )
pause pause
goto menu
:: IPSET UPDATE ======================= :: IPSET UPDATE =======================
@ -524,7 +547,6 @@ if exist "%SystemRoot%\System32\curl.exe" (
echo Finished echo Finished
pause pause
goto menu
:: Utility functions :: Utility functions

107
gui.hta Normal file
View File

@ -0,0 +1,107 @@
<html>
<head>
<title>Zapret GUI</title>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta charset="UTF-8">
<script language="JavaScript" src="src/js/window.js"></script>
<HTA:APPLICATION
BORDER="thin"
BORDERSTYLE="normal"
ICON="src/fav.ico"
WINDOWSTATE="normal"
INNERBORDER="no"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="yes"
SINGLEINSTANCE="yes"
RESIZE="no"
CONTEXTMENU="no"
SYSMENU="yes"
SCROLL="no"
SELECTION="no"
VERSION="1.0"
>
<link rel="stylesheet" href="src/css/style.css">
</head>
<body>
<div id="pages">
<div name="Page 1">
<div class="button" onclick="setPage(3);">Настройки запрета</div>
<div class="button" onclick="setPage(4);">Включить определенный сервис</div>
<div class="button" onclick="setPage(5);">Помощь</div>
<div class="button fixed right" onclick="setPage(2);">Настройки</div>
</div>
<div name="Page 2">
<div class="button" onclick="txt({'message': 'ipset-all.txt'},{'message': ''}, 1);">Редактировать конфигурационный файл для доменов (ipset-all.txt)</div>
<div class="button" onclick="txt({'message': 'list-general.txt'},{'message': ''}, 1);">Редактировать конфигурационный файл для IP и подсетей (list-general.txt)</div>
<div class="button" onclick="shell({'message': 'service.bat'},{'message': 'game'}, 1);">Игровой фильтр (enabled)</div>
<div class="button" onclick="shell({'message': 'service.bat'},{'message': 'ipset'}, 1);">Ipset (loaded)</div>
<div class="button" onclick="shell({'message': 'service.bat'},{'message': 'ipset_update'}, 1);">Обновить ipset</div>
<div class="backButton button" onclick="setPage(1);">Назад</div>
</div>
<div name="Page 3">
<div class="button" onclick="shell({'message': 'service.bat'},{'message': 'install'}, 1);">Установить сервис</div>
<div class="button" onclick="shell({'message': 'service.bat'},{'message': 'remove'}, 1);">Удалить сервис</div>
<div class="button" onclick="shell({'message': 'service.bat'},{'message': 'status'}, 1);">Статус сервиса</div>
<div class="button" onclick="shell({'message': 'service.bat'},{'message': 'diagnostics'}, 1);">Запустить диагностику</div>
<div class="button" onclick="shell({'message': 'service.bat'},{'message': 'updates'}, 1);">Проверка обновлений</div>
<div class="backButton button" onclick="setPage(1);">Назад</div>
</div>
<div name="Page 4">
<div class="button" onclick="shellDefinite({'message': 'general.bat'},{'message': ''}, 1);">general</div>
<div class="button" onclick="shellDefinite({'message': 'general(ALT).bat'},{'message': ''}, 1);">general (ALT)</div>
<div class="button" onclick="shellDefinite({'message': 'general(ALT2).bat'},{'message': ''}, 1);">general (ALT2)</div>
<div class="button" onclick="shellDefinite({'message': 'general(ALT3).bat'},{'message': ''}, 1);">general (ALT3)</div>
<div class="button" onclick="shellDefinite({'message': 'general(ALT4).bat'},{'message': ''}, 1);">general (ALT4)</div>
<div class="button" onclick="shellDefinite({'message': 'general(ALT5).bat'},{'message': ''}, 1);">general (ALT5)</div>
<div class="button" onclick="shellDefinite({'message': 'general(ALT6).bat'},{'message': ''}, 1);">general (ALT6)</div>
<div class="button" onclick="shellDefinite({'message': 'general(FAKE TLS ALT).bat'},{'message': ''}, 1);">general(FAKE TLS ALT)</div>
<div class="button" onclick="shellDefinite({'message': 'general(FAKE TLS AUTO ALT).bat'},{'message': ''}, 1);">general(FAKE TLS AUTO ALT)</div>
<div class="button" onclick="shellDefinite({'message': 'general(FAKE TLS AUTO ALT2).bat'},{'message': ''}, 1);">general(FAKE TLS AUTO ALT2)</div>
<div class="backButton button" onclick="setPage(1);">Назад</div>
</div>
<div name="Page 5">
<div style="text-align:center;">
<p><em>“Plug & Play”</em> — обход блокировок,<br>
<img src="https://cdn-icons-png.flaticon.com/128/5968/5968756.png" height="11"> <strong>Discord</strong> и
<img src="https://cdn-icons-png.flaticon.com/128/1384/1384060.png" height="11"> <strong>YouTube</strong> для Windows</p>
</div>
<h3>Краткие описания функций</h3>
<ul>
<li><h4><strong><code>Настройки запрета</code></strong></h4>
<ul>
<li><strong><code>Установить сервис</code></strong> — установить стратегию в автозапуск</li>
<li><strong><code>Удалить сервис</code></strong> — удалить службы</li>
<li><strong><code>Статус сервиса</code></strong> — проверить статус обхода</li>
<li><strong><code>Запустить диагностику</code></strong> — диагностика ошибок + очистка кэша Discord</li>
<li><strong><code>Проверка обновлений</code></strong> — проверить обновления</li>
<li><strong><code>Игровой фильтр</code></strong> — режим для игр<br>
После выбора — перезапустите компьютер
</li>
<li><strong><code>Ipset</code></strong> — вкл/выкл список сервисов из <code>ipset-all.txt</code></li>
<li><strong><code>Обновить ipset list</code></strong> — обновить список <code>ipset-all.txt</code></li>
</ul>
</li>
<li><h4><strong><code>Включить определенный сервис</code></strong></h4>
Запуск определенной стратегии обхода.<br>
Пробуйте разные (ALT, МГТС и др.), пока не найдете работающий вариант.
</li>
</ul>
</body>
</html>
<div class="backButton button" onclick="setPage(1);">Назад</div>
</div>
</div>
</body>
<script language="JavaScript" src="src/js/pages.js"></script>
</html>

51
src/css/style.css Normal file
View File

@ -0,0 +1,51 @@
body {
font-family: Verdana, Geneva, Tahoma, sans-serif;
padding: 0;
margin: 0;
background: #282828;
padding-top: 7px;
}
.button {
padding: 10px;
background: rgb(80, 80, 80);
color: white;
cursor: pointer;
margin: 10px;
border-radius: 2px;
}
.button:hover {
color: rgb(200, 200, 200)
}
.backButton {
color: rgb(255, 255, 0);
}
.backButton:hover{
color: rgb(200, 200, 0)
}
.page {
display: none
}
.fixed {
position: absolute;
bottom: 0;
}
.right {
right: 0;
}
.left {
left: 0
}
.author {
font-size: 10px;
color: #606060;
padding: 10px
}

BIN
src/fav.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

37
src/js/pages.js Normal file
View File

@ -0,0 +1,37 @@
/**
* Simulate app routing using pagination
*
* - Get all elements from container
* - Set first to visible
* - Create change visibility function
*
*/
// get elements from container
var container = document.getElementById("pages")
var items = container.children
var pages = [null]
var page = 1
// Add 'page' class to all elements inside 'pages' container
for(var i = 0; i < items.length; i++){
if(items[i]){
items[i].className = [items[i].className, "page"].join(" ")
pages.push(items[i])
}
}
// Set first page to visible
if(pages[page]) pages[page].style.display = "block"
// Function used to set visibility, called from 'gui.hta' file
function setPage(p){
var curr = pages[p]
var prev = pages[page]
if(curr){
prev.style.display = "none";
curr.style.display = "block";
page = p
}
}

117
src/js/window.js Normal file
View File

@ -0,0 +1,117 @@
// Here you can set window size
var width = 800
var height = 600
// Apply window size at start
window.resizeTo(width, height);
// Center window
window.moveTo(
(screen.width - width) / 2,
(screen.height - height) / 2
);
// Function to send message from JS to BATCH ( Sends to path )
function shell(path, msg, visible) {
try {
var shellApp = new ActiveXObject("Shell.Application");
var fs = new ActiveXObject("Scripting.FileSystemObject");
// Путь к текущему HTA-файлу
var rawPath = decodeURIComponent(window.location.pathname);
if (rawPath.charAt(0) === "/" && rawPath.charAt(2) === ":") {
rawPath = rawPath.slice(1); // Убираем лишний слеш
}
// Путь к папке "bat"
var parentFolder = fs.GetParentFolderName(rawPath);
var batFolder = fs.BuildPath(parentFolder, "bat");
// Полный путь к .bat файлу
var batFile = fs.BuildPath(batFolder, path.message);
// Подготавливаем аргументы (без кавычек!)
var arguments = "";
if (msg && msg.message) {
arguments = msg.message; // без кавычек!
}
// Собираем команду (путь и аргумент в кавычках вместе)
var fullCommand = "\"" + batFile + "\" " + arguments;
// Запуск от имени администратора
shellApp.ShellExecute("cmd.exe", "/k " + fullCommand, "", "runas", visible || 1);
} catch (e) {
var errorMessage = "Ошибка запуска скрипта:\n";
errorMessage += e.message;
alert(errorMessage);
}
}
function txt(path, msg, visible) {
try {
var shell = new ActiveXObject("WScript.Shell");
var fs = new ActiveXObject("Scripting.FileSystemObject");
// Путь к текущему HTA-файлу
var rawPath = decodeURIComponent(window.location.pathname);
if (rawPath.charAt(0) === "/" && rawPath.charAt(2) === ":") {
rawPath = rawPath.slice(1); // Убираем лишний слеш в начале пути
}
// Путь к папке "lists"
var parentFolder = fs.GetParentFolderName(rawPath);
var listsFolder = fs.BuildPath(parentFolder, "lists");
// Полный путь к файлу
var filePath = fs.BuildPath(listsFolder, path.message);
// Подготавливаем аргумент как строку в кавычках
var quotedMsg = "";
if (msg && msg.message) {
quotedMsg = "\"";
quotedMsg += msg.message;
quotedMsg += "\"";
}
// Собираем команду для запуска Блокнота
var command = "\"";
command += filePath;
command += "\" ";
command += quotedMsg;
// Запуск Notepad
shell.Run("notepad.exe " + command, visible || 1, false);
} catch (e) {
var errorMessage = "Ошибка открытия файла:\n";
errorMessage += e.message;
alert(errorMessage);
}
}
function shellDefinite(path,visible) {
try {
var shellApp = new ActiveXObject("Shell.Application");
var fs = new ActiveXObject("Scripting.FileSystemObject");
// Путь к текущему HTA-файлу
var rawPath = decodeURIComponent(window.location.pathname);
if (rawPath.charAt(0) === "/" && rawPath.charAt(2) === ":") {
rawPath = rawPath.slice(1); // Убираем лишний слеш
}
// Путь к папке "bat"
var parentFolder = fs.GetParentFolderName(rawPath);
var batFolder = fs.BuildPath(parentFolder, "bat");
// Полный путь к .bat файлу
var batFile = fs.BuildPath(batFolder, path.message);
// Запуск от имени администратора
shellApp.ShellExecute("cmd.exe", "/k " + batFile, "", "runas", visible || 1);
} catch (e) {
var errorMessage = "Ошибка запуска скрипта:\n";
errorMessage += e.message;
alert(errorMessage);
}
}