Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d7ed7042ec | |||
| 4496a30552 | |||
| ca1a596f85 | |||
| b3edf1bdcc | |||
| c6306aa918 | |||
| d5bbc9a564 | |||
| d2aab8ee4b | |||
| 304217d36e | |||
| 2622397542 | |||
| 702123e39c | |||
| 01ef7707c4 | |||
| 064d39d80b | |||
| 1b93d41421 |
+47
-32
@@ -40,7 +40,7 @@ class Bot
|
|||||||
$this->reg = '~' . implode('|', [
|
$this->reg = '~' . implode('|', [
|
||||||
'GET / HTTP',
|
'GET / HTTP',
|
||||||
'GET /favicon.ico HTTP',
|
'GET /favicon.ico HTTP',
|
||||||
preg_quote($this->getHashBot())
|
preg_quote($this->getHashBot(1))
|
||||||
]) . '~';
|
]) . '~';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1188,8 +1188,7 @@ class Bot
|
|||||||
$this->ssh('ssserver -v -d -c /config.json', 'ss');
|
$this->ssh('ssserver -v -d -c /config.json', 'ss');
|
||||||
$this->ssh('sslocal -v -d -c /config.json', 'proxy');
|
$this->ssh('sslocal -v -d -c /config.json', 'proxy');
|
||||||
|
|
||||||
$this->sd($c, 1);
|
if (empty($nomenu)) {
|
||||||
if (!empty($nomenu)) {
|
|
||||||
$this->menu('ss');
|
$this->menu('ss');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4324,47 +4323,47 @@ DNS-over-HTTPS with IP:
|
|||||||
'data' => [
|
'data' => [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title'),
|
'text' => $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title') . ' ' . $this->i18n($this->ssh($this->getPacConf()['amnezia'] ? 'awg' : 'wg', 'wg') ? 'on' : 'off'),
|
||||||
'callback_data' => "/changeWG 0",
|
'callback_data' => "/changeWG 0",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title'),
|
'text' => $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title') . ' ' . $this->i18n($this->ssh($this->getPacConf()['wg1_amnezia'] ? 'awg' : 'wg', 'wg1') ? 'on' : 'off'),
|
||||||
'callback_data' => "/changeWG 1",
|
'callback_data' => "/changeWG 1",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('xray'),
|
'text' => $this->i18n('xray') . ' ' . $this->i18n($this->ssh('pgrep xray', 'xr') ? 'on' : 'off'),
|
||||||
'callback_data' => "/xray",
|
'callback_data' => "/xray",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('naive'),
|
'text' => $this->i18n('naive') . ' ' . $this->i18n($this->ssh('pgrep caddy', 'np') ? 'on' : 'off'),
|
||||||
'callback_data' => "/menu naive",
|
'callback_data' => "/menu naive",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('ocserv'),
|
'text' => $this->i18n('ocserv') . ' ' . $this->i18n($this->ssh('pgrep ocserv', 'oc') ? 'on' : 'off'),
|
||||||
'callback_data' => "/menu oc",
|
'callback_data' => "/menu oc",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('mtproto'),
|
'text' => $this->i18n('mtproto') . ' ' . $this->i18n($this->ssh('pgrep mtproto-proxy', 'tg') ? 'on' : 'off'),
|
||||||
'callback_data' => "/mtproto",
|
'callback_data' => "/mtproto",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('ad_title'),
|
'text' => $this->i18n('ad_title') . ' ' . $this->i18n(exec("JSON=1 timeout 2 dnslookup google.com ad") ? 'on' : 'off'),
|
||||||
'callback_data' => "/menu adguard",
|
'callback_data' => "/menu adguard",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('warp') . ': ' . $this->warpStatus(),
|
'text' => $this->i18n('warp') . ' ' . $this->i18n($this->warpStatus()),
|
||||||
'callback_data' => "/warp",
|
'callback_data' => "/warp",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => $this->i18n('sh_title'),
|
'text' => $this->i18n('sh_title') . ' ' . $this->i18n($this->ssh('pgrep ssserver', 'ss') ? 'on' : 'off'),
|
||||||
'callback_data' => "/menu ss",
|
'callback_data' => "/menu ss",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -5346,8 +5345,16 @@ DNS-over-HTTPS with IP:
|
|||||||
$p = $this->getPacConf();
|
$p = $this->getPacConf();
|
||||||
$users = array_map(fn ($e) => trim($e), explode(',', $users));
|
$users = array_map(fn ($e) => trim($e), explode(',', $users));
|
||||||
$users = array_map(fn ($e) => explode(':', $e), $users);
|
$users = array_map(fn ($e) => explode(':', $e), $users);
|
||||||
|
foreach ($c['inbounds'][0]['settings']['clients'] as $k => $v) {
|
||||||
|
$uuids[] = $v['id'];
|
||||||
|
$emails[] = $v['email'];
|
||||||
|
}
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
$uuid = $user[1] ?: trim($this->ssh('xray uuid', 'xr'));
|
$uuid = $user[1] ?: trim($this->ssh('xray uuid', 'xr'));
|
||||||
|
if (in_array($uuid, $uuids ?: []) || in_array($user[0], $emails ?: [])) {
|
||||||
|
$this->send($this->input['chat'], "user {$user[0]} already exists");
|
||||||
|
return $this->xray();
|
||||||
|
}
|
||||||
$c['inbounds'][0]['settings']['clients'][] = $p['transport'] != 'Reality' ? [
|
$c['inbounds'][0]['settings']['clients'][] = $p['transport'] != 'Reality' ? [
|
||||||
'id' => $uuid,
|
'id' => $uuid,
|
||||||
'email' => $user[0],
|
'email' => $user[0],
|
||||||
@@ -5377,20 +5384,22 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->send($this->input['chat'], 'wrong format');
|
$this->send($this->input['chat'], 'wrong format');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
|
||||||
$this->switchXr($i, 1);
|
|
||||||
$c = $this->getXray();
|
|
||||||
}
|
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['time'] = $time;
|
$c['inbounds'][0]['settings']['clients'][$i]['time'] = $time;
|
||||||
}
|
}
|
||||||
file_put_contents('/config/xray.json', json_encode($c, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
$this->restartXray($c, 1);
|
||||||
$this->userXr($i);
|
if (!empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
||||||
|
$this->switchXr($i, 0, 1);
|
||||||
|
} else {
|
||||||
|
$this->userXr($i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switchXr($i, $nm = 0)
|
public function switchXr($i, $nm = 0, $time = false)
|
||||||
{
|
{
|
||||||
$c = $this->getXray();
|
$c = $this->getXray();
|
||||||
unset($c['inbounds'][0]['settings']['clients'][$i]['time']);
|
if (empty($time)) {
|
||||||
|
unset($c['inbounds'][0]['settings']['clients'][$i]['time']);
|
||||||
|
}
|
||||||
if (empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
if (empty($c['inbounds'][0]['settings']['clients'][$i]['off'])) {
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['off'] = $c['inbounds'][0]['settings']['clients'][$i]['id'];
|
$c['inbounds'][0]['settings']['clients'][$i]['off'] = $c['inbounds'][0]['settings']['clients'][$i]['id'];
|
||||||
$c['inbounds'][0]['settings']['clients'][$i]['id'] = trim($this->ssh('xray uuid', 'xr'));
|
$c['inbounds'][0]['settings']['clients'][$i]['id'] = trim($this->ssh('xray uuid', 'xr'));
|
||||||
@@ -5999,7 +6008,6 @@ DNS-over-HTTPS with IP:
|
|||||||
|
|
||||||
public function frequencyAnalyze($line, $pac)
|
public function frequencyAnalyze($line, $pac)
|
||||||
{
|
{
|
||||||
preg_match('~(?<date>.+)\sfrom\s(?<ip>\d+\.\d+\.\d+\.\d+)(?=.+email:\s(?<email>.+))~', $line, $m);
|
|
||||||
if (!empty($this->pool)) {
|
if (!empty($this->pool)) {
|
||||||
foreach ($this->pool as $i => $j) {
|
foreach ($this->pool as $i => $j) {
|
||||||
if (!empty($j['ips'])) {
|
if (!empty($j['ips'])) {
|
||||||
@@ -6011,6 +6019,9 @@ DNS-over-HTTPS with IP:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (empty(preg_match('~(?<date>.+)\sfrom\s(?<ip>\d+\.\d+\.\d+\.\d+)(?=.+email:\s(?<email>.+))~', $line, $m))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!empty($m['ip']) && !empty($m['email'])) {
|
if (!empty($m['ip']) && !empty($m['email'])) {
|
||||||
$ip = ip2long($m['ip']);
|
$ip = ip2long($m['ip']);
|
||||||
if (!empty($this->pool[$m['email']]['ip']) && $this->pool[$m['email']]['ip'] != $ip) {
|
if (!empty($this->pool[$m['email']]['ip']) && $this->pool[$m['email']]['ip'] != $ip) {
|
||||||
@@ -6022,18 +6033,19 @@ DNS-over-HTTPS with IP:
|
|||||||
if (empty($v['off']) && $v['email'] == $m['email']) {
|
if (empty($v['off']) && $v['email'] == $m['email']) {
|
||||||
require __DIR__ . '/config.php';
|
require __DIR__ . '/config.php';
|
||||||
foreach ($c['admin'] as $admin) {
|
foreach ($c['admin'] as $admin) {
|
||||||
$this->send($admin, "vless: {$m['email']} is turned off (limit by one IP)");
|
$this->send($admin, "vless: {$m['email']} limit ip " . count($this->pool[$m['email']]['ips']) . ' > ' . ($pac['ip_count'] ?: 1), button: [[
|
||||||
|
[
|
||||||
|
'text' => $this->i18n($c['off'] ? 'off' : 'on'),
|
||||||
|
'callback_data' => "/switchXr $k",
|
||||||
|
],
|
||||||
|
]]);
|
||||||
}
|
}
|
||||||
unset($this->pool[$m['email']]);
|
unset($this->pool[$m['email']]);
|
||||||
$this->switchXr($k, 1);
|
|
||||||
$flag = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($flag)) {
|
$this->pool[$m['email']]['ip'] = $ip;
|
||||||
$this->pool[$m['email']]['ip'] = $ip;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6358,7 +6370,7 @@ DNS-over-HTTPS with IP:
|
|||||||
header("Location: hiddify://install-config/?url=$si");
|
header("Location: hiddify://install-config/?url=$si");
|
||||||
exit;
|
exit;
|
||||||
case 'c':
|
case 'c':
|
||||||
header("Location: clash://install-config/?url=$cl&name=$email");
|
header("Location: clash://install-config/?url=$cl&overwrite=no&name=$email");
|
||||||
exit;
|
exit;
|
||||||
case 'w':
|
case 'w':
|
||||||
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
$link = htmlspecialchars($si, ENT_XML1, 'UTF-8');
|
||||||
@@ -6805,14 +6817,16 @@ DNS-over-HTTPS with IP:
|
|||||||
$this->ssh("nginx -s reload 2>&1", 'up');
|
$this->ssh("nginx -s reload 2>&1", 'up');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHashBot()
|
public function getHashBot($notset = false)
|
||||||
{
|
{
|
||||||
$p = $this->getPacConf();
|
$p = $this->getPacConf();
|
||||||
if (!empty($p['hashbot'])) {
|
if (!empty($p['hashbot'])) {
|
||||||
return $p['hashbot'];
|
return $p['hashbot'];
|
||||||
}
|
}
|
||||||
$p['hashbot'] = substr(hash('sha256', $this->key), 0, 8);
|
$p['hashbot'] = substr(hash('sha256', $this->key), 0, 8);
|
||||||
$this->setPacConf($p);
|
if (empty($notset)) {
|
||||||
|
$this->setPacConf($p);
|
||||||
|
}
|
||||||
return $p['hashbot'];
|
return $p['hashbot'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8083,8 +8097,9 @@ DNS-over-HTTPS with IP:
|
|||||||
}
|
}
|
||||||
echo "$ip\n";
|
echo "$ip\n";
|
||||||
var_dump($r = $this->request('setWebhook', [
|
var_dump($r = $this->request('setWebhook', [
|
||||||
'url' => "https://$ip/tlgrm?k={$this->key}",
|
'url' => "https://$ip/tlgrm?k={$this->key}",
|
||||||
'certificate' => curl_file_create('/certs/self_public'),
|
'certificate' => curl_file_create('/certs/self_public'),
|
||||||
|
'allowed_updates' => json_encode(['*']),
|
||||||
]));
|
]));
|
||||||
if (!empty($r['result']) && $r['result'] == true) {
|
if (!empty($r['result']) && $r['result'] == true) {
|
||||||
file_put_contents('/start', 1);
|
file_put_contents('/start', 1);
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ switch (true) {
|
|||||||
|
|
||||||
// adguard cookie
|
// adguard cookie
|
||||||
case preg_match('~^' . preg_quote("/webapp$hash/check") . '~', $_SERVER['REQUEST_URI']) && $webapp:
|
case preg_match('~^' . preg_quote("/webapp$hash/check") . '~', $_SERVER['REQUEST_URI']) && $webapp:
|
||||||
setcookie('c', substr(hash('sha256', $c['key']), 0, 8), 0, '/');
|
setcookie('c', $hash, 0, '/');
|
||||||
echo "/adguard$hash/";
|
echo "/adguard$hash/";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@
|
|||||||
"uuid": "~uid~",
|
"uuid": "~uid~",
|
||||||
"network": "tcp",
|
"network": "tcp",
|
||||||
"flow": "xtls-rprx-vision",
|
"flow": "xtls-rprx-vision",
|
||||||
|
"udp": true,
|
||||||
"tls": true,
|
"tls": true,
|
||||||
"reality-opts": {
|
"reality-opts": {
|
||||||
"public-key": "~public_key~",
|
"public-key": "~public_key~",
|
||||||
|
|||||||
+12
-4
@@ -42,10 +42,18 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
php:
|
php:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
ng:
|
||||||
|
condition: service_started
|
||||||
ad:
|
ad:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
ss:
|
ss:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
|
xr:
|
||||||
|
condition: service_started
|
||||||
|
oc:
|
||||||
|
condition: service_started
|
||||||
|
np:
|
||||||
|
condition: service_started
|
||||||
env_file:
|
env_file:
|
||||||
- path: ./.env
|
- path: ./.env
|
||||||
required: true # default
|
required: true # default
|
||||||
@@ -79,9 +87,6 @@ services:
|
|||||||
- 80:80
|
- 80:80
|
||||||
hostname: nginx
|
hostname: nginx
|
||||||
container_name: nginx-${VER}
|
container_name: nginx-${VER}
|
||||||
depends_on:
|
|
||||||
up:
|
|
||||||
condition: service_started
|
|
||||||
env_file:
|
env_file:
|
||||||
- path: ./.env
|
- path: ./.env
|
||||||
required: true # default
|
required: true # default
|
||||||
@@ -95,6 +100,9 @@ services:
|
|||||||
xray:
|
xray:
|
||||||
ipv4_address: 10.10.1.2
|
ipv4_address: 10.10.1.2
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
depends_on:
|
||||||
|
php:
|
||||||
|
condition: service_healthy
|
||||||
php:
|
php:
|
||||||
image: mercurykd/vpnbot-php:1.7
|
image: mercurykd/vpnbot-php:1.7
|
||||||
build:
|
build:
|
||||||
@@ -147,7 +155,7 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
service:
|
service:
|
||||||
image: mercurykd/vpnbot-php:1.6
|
image: mercurykd/vpnbot-php:1.7
|
||||||
build:
|
build:
|
||||||
dockerfile: dockerfile/php.dockerfile
|
dockerfile: dockerfile/php.dockerfile
|
||||||
args:
|
args:
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ xr: # консоль сервиса
|
|||||||
docker compose exec xr /bin/sh
|
docker compose exec xr /bin/sh
|
||||||
oc: # консоль сервиса
|
oc: # консоль сервиса
|
||||||
docker compose exec oc /bin/sh
|
docker compose exec oc /bin/sh
|
||||||
|
service: # консоль сервиса
|
||||||
|
docker compose exec service /bin/sh
|
||||||
clean:
|
clean:
|
||||||
docker image prune
|
docker image prune
|
||||||
docker builder prune
|
docker builder prune
|
||||||
|
|||||||
@@ -1,3 +1,19 @@
|
|||||||
|
17.05.2025 v2.19
|
||||||
|
- фикс падения vless при одинаковом имени пользователей
|
||||||
|
- фикс падения vless при установке таймера для выключенного пользователя
|
||||||
|
- подсветка в меню работы процесса контейнера
|
||||||
|
- overwrite=no для импорта клеш подписки (legiz)
|
||||||
|
18.04.2025 v2.18
|
||||||
|
- фикс отсутствия ssl при первом старте
|
||||||
|
- iplimit уведомляет без отключения пользователя
|
||||||
|
- включение udp в mihomo-шаблоне
|
||||||
|
- удаление лишнего образа пхп
|
||||||
|
07.04.2025 v2.17
|
||||||
|
- фикс циклической перезагрузки панели adguardHome
|
||||||
|
07.04.2025 v2.16
|
||||||
|
- фикс warp
|
||||||
|
07.04.2025 v2.15
|
||||||
|
- миграция поддоменов np/oc вместе в с бэкапом
|
||||||
02.03.2025 v2.14
|
02.03.2025 v2.14
|
||||||
- vless ip limit: фикс выключения юзера
|
- vless ip limit: фикс выключения юзера
|
||||||
22.02.2025 v2.13
|
22.02.2025 v2.13
|
||||||
|
|||||||
Reference in New Issue
Block a user