Compare commits

...

13 Commits

Author SHA1 Message Date
mercury 6dafba5618 update version 2025-01-04 22:56:21 +04:00
mercury 7daf61a4f5 improve main menu 2025-01-04 21:52:26 +04:00
mercury f9266827c9 ability to install the desired version 2025-01-03 17:09:51 +04:00
mercury 9e22c64771 update readme 2025-01-03 16:22:10 +04:00
mercury a2026a4436 adaptation of the log analyzer 2025-01-03 13:55:49 +04:00
mercury 95c5b5b8fd update version 2024-12-26 18:29:55 +04:00
mercury efbe20485a ability to change subdomain for naiveproxy 2024-12-26 18:28:24 +04:00
mercury 475eea1f47 ability to change subdomain for openconnect 2024-12-26 18:12:42 +04:00
mercury 02d9cdcccc improve update script 2024-12-26 16:59:06 +04:00
mercury d633799f11 update version 2024-12-26 16:26:34 +04:00
Konstantin ead66c3951 Merge pull request #29 from legiz-ru/dev
sb1.10+tun-inbound + sb-win64-1.10.5
2024-12-26 09:46:35 +04:00
legiz-ru bd7742d8b2 update tun inbound (changes in sb 1.10+)
change inet4_address to address

https://sing-box.sagernet.org/migration/#tun-address-fields-are-merged
2024-12-24 16:32:07 +03:00
legiz-ru ac593629a8 update singbox 1.10.5 windows x64 2024-12-24 16:24:58 +03:00
7 changed files with 120 additions and 114 deletions
+87 -20
View File
@@ -37,20 +37,9 @@ class Bot
'xray', 'xray',
]; ];
$this->reg = '~' . implode('|', [ $this->reg = '~' . implode('|', [
'GET /ws HTTP',
'GET /adguard/(?:.+)? HTTP',
'GET /webapp(?:.+)? HTTP',
'GET /pac(?:.+)? HTTP',
'GET \.well-known(?:.+)? HTTP',
'GET /v2ray(?:.+)? HTTP',
'GET /dns-query(?:.+)? HTTP',
'GET / HTTP', 'GET / HTTP',
'GET /tlgrm(?:.+)? HTTP',
'GET /jsoneditor.min.css HTTP',
'GET /jsoneditor.min.js HTTP',
'GET /jquery-3.7.1.min.js HTTP',
'GET /img/jsoneditor-icons.svg HTTP',
'GET /favicon.ico HTTP', 'GET /favicon.ico HTTP',
preg_quote($this->getHashBot())
]) . '~'; ]) . '~';
} }
@@ -358,12 +347,18 @@ class Bot
case preg_match('~^/changeCamouflage$~', $this->input['callback'], $m): case preg_match('~^/changeCamouflage$~', $this->input['callback'], $m):
$this->changeCamouflage(); $this->changeCamouflage();
break; break;
case preg_match('~^/changeOcDomain$~', $this->input['callback'], $m):
$this->changeOcDomain();
break;
case preg_match('~^/changeOcPass$~', $this->input['callback'], $m): case preg_match('~^/changeOcPass$~', $this->input['callback'], $m):
$this->changeOcPass(); $this->changeOcPass();
break; break;
case preg_match('~^/changeNaiveUser$~', $this->input['callback'], $m): case preg_match('~^/changeNaiveUser$~', $this->input['callback'], $m):
$this->changeNaiveUser(); $this->changeNaiveUser();
break; break;
case preg_match('~^/changeNaiveSubdomain$~', $this->input['callback'], $m):
$this->changeNaiveSubdomain();
break;
case preg_match('~^/changeNaivePass$~', $this->input['callback'], $m): case preg_match('~^/changeNaivePass$~', $this->input['callback'], $m):
$this->changeNaivePass(); $this->changeNaivePass();
break; break;
@@ -816,7 +811,7 @@ class Bot
$this->input['chat'], $this->input['chat'],
"@{$this->input['username']} enter camouflage key", "@{$this->input['username']} enter camouflage key",
$this->input['message_id'], $this->input['message_id'],
reply: 'enter password', reply: 'enter camouflage key',
); );
$_SESSION['reply'][$r['result']['message_id']] = [ $_SESSION['reply'][$r['result']['message_id']] = [
'start_message' => $this->input['message_id'], 'start_message' => $this->input['message_id'],
@@ -826,6 +821,22 @@ class Bot
]; ];
} }
public function changeOcDomain()
{
$r = $this->send(
$this->input['chat'],
"@{$this->input['username']} enter subdomain",
$this->input['message_id'],
reply: 'enter subdomain',
);
$_SESSION['reply'][$r['result']['message_id']] = [
'start_message' => $this->input['message_id'],
'start_callback' => $this->input['callback_id'],
'callback' => 'chOcSubdomain',
'args' => [],
];
}
public function changeOcDns() public function changeOcDns()
{ {
$r = $this->send( $r = $this->send(
@@ -864,7 +875,7 @@ class Bot
$this->input['chat'], $this->input['chat'],
"@{$this->input['username']} enter login", "@{$this->input['username']} enter login",
$this->input['message_id'], $this->input['message_id'],
reply: 'enter password', reply: 'enter login',
); );
$_SESSION['reply'][$r['result']['message_id']] = [ $_SESSION['reply'][$r['result']['message_id']] = [
'start_message' => $this->input['message_id'], 'start_message' => $this->input['message_id'],
@@ -874,6 +885,22 @@ class Bot
]; ];
} }
public function changeNaiveSubdomain()
{
$r = $this->send(
$this->input['chat'],
"@{$this->input['username']} enter subdomain",
$this->input['message_id'],
reply: 'enter subdomain',
);
$_SESSION['reply'][$r['result']['message_id']] = [
'start_message' => $this->input['message_id'],
'start_callback' => $this->input['callback_id'],
'callback' => 'chNpSubdomain',
'args' => [],
];
}
public function changeNaivePass() public function changeNaivePass()
{ {
$r = $this->send( $r = $this->send(
@@ -987,6 +1014,34 @@ class Bot
$this->menu('oc'); $this->menu('oc');
} }
public function chOcSubdomain($domain)
{
$pac = $this->getPacConf();
if (empty($domain)) {
unset($pac["oc_domain"]);
} else {
$pac["oc_domain"] = $domain;
}
$this->setPacConf($pac);
$this->chocdomain($pac['domain']);
$this->setUpstreamDomainOcserv($pac['domain']);
$this->menu('oc');
}
public function chNpSubdomain($domain)
{
$pac = $this->getPacConf();
if (!empty($data)) {
unset($pac['np_domain']);
} else {
$pac['np_domain'] = $domain;
}
$this->setPacConf($pac);
$this->restartNaive();
$this->setUpstreamDomainNaive($pac['domain']);
$this->menu('naive');
}
public function chnplogin($user) public function chnplogin($user)
{ {
$pac = $this->getPacConf(); $pac = $this->getPacConf();
@@ -4024,16 +4079,16 @@ DNS-over-HTTPS with IP:
$c = yaml_parse_file($f)['services']; $c = yaml_parse_file($f)['services'];
$main[] = 'v' . getenv('VER') . " $branch" . ($update ? ' (have updates)' : ''); $main[] = 'v' . getenv('VER') . " $branch" . ($update ? ' (have updates)' : '');
$main[] = ''; $main[] = '';
$main[] = $this->i18n($c['wg'] ? 'on' : 'off') . ' ' . getenv('WGPORT') . ' Wireguard';
$main[] = $this->i18n($c['wg1'] ? 'on' : 'off') . ' ' . getenv('WG1PORT') . ' Wireguard 1';
$main[] = $this->i18n($c['tg'] ? 'on' : 'off') . ' ' . getenv('TGPORT') . ' MTProto';
$main[] = $this->i18n($c['ad'] ? 'on' : 'off') . ' 853 AdguardHome DoT';
$main[] = '';
$main[] = $cron; $main[] = $cron;
$main[] = $this->i18n($backup ? 'on' : 'off') . ' autobackup' . ($backup ? " $backup" : ''); $main[] = $this->i18n($backup ? 'on' : 'off') . ' autobackup' . ($backup ? " $backup" : '');
$main[] = $this->i18n($conf['autoupdate'] ? 'on' : 'off') . ' autoupdate'; $main[] = $this->i18n($conf['autoupdate'] ? 'on' : 'off') . ' autoupdate';
$main[] = $this->i18n($conf['autoscan'] ? 'on' : 'off') . ' autoscan'; $main[] = $this->i18n($conf['autoscan'] ? 'on' : 'off') . ' autoscan';
$main[] = $this->i18n($conf['autodeny'] ? 'on' : 'off') . ' autoblock' . ($conf['deny'] ? ': ' . count($conf['deny']) : ''); $main[] = $this->i18n($conf['autodeny'] ? 'on' : 'off') . ' autoblock' . ($conf['deny'] ? ': ' . count($conf['deny']) : '');
$main[] = '';
$main[] = $this->i18n($c['wg'] ? 'on' : 'off') . ' ' . getenv('WGPORT') . ' Wireguard';
$main[] = $this->i18n($c['wg1'] ? 'on' : 'off') . ' ' . getenv('WG1PORT') . ' Wireguard 1';
$main[] = $this->i18n($c['tg'] ? 'on' : 'off') . ' ' . getenv('TGPORT') . ' MTProto';
$main[] = $this->i18n($c['ad'] ? 'on' : 'off') . ' 853 AdguardHome DoT';
if (!empty($conf['domain'])) { if (!empty($conf['domain'])) {
$main[] = ''; $main[] = '';
$oc = $this->getHashSubdomain('oc'); $oc = $this->getHashSubdomain('oc');
@@ -4823,6 +4878,12 @@ DNS-over-HTTPS with IP:
$text[] = "Menu -> NaiveProxy"; $text[] = "Menu -> NaiveProxy";
$np = $this->getHashSubdomain('np'); $np = $this->getHashSubdomain('np');
$text[] = "<code>https://{$pac['naive']['user']}:{$pac['naive']['pass']}@$np.$domain</code>"; $text[] = "<code>https://{$pac['naive']['user']}:{$pac['naive']['pass']}@$np.$domain</code>";
$data[] = [
[
'text' => $this->i18n('change subdomain'),
'callback_data' => "/changeNaiveSubdomain",
],
];
$data[] = [ $data[] = [
[ [
'text' => $this->i18n('change login'), 'text' => $this->i18n('change login'),
@@ -4926,6 +4987,12 @@ DNS-over-HTTPS with IP:
$text[] = "<code>https://$oc.$domain/?$cs</code>"; $text[] = "<code>https://$oc.$domain/?$cs</code>";
} }
$text[] = "password: <span class='tg-spoiler'>$pass</span>"; $text[] = "password: <span class='tg-spoiler'>$pass</span>";
$data[] = [
[
'text' => $this->i18n('change subdomain'),
'callback_data' => "/changeOcDomain",
],
];
$data[] = [ $data[] = [
[ [
'text' => $this->i18n('change secret'), 'text' => $this->i18n('change secret'),
@@ -6386,7 +6453,7 @@ DNS-over-HTTPS with IP:
public function getHashSubdomain($subdomain) public function getHashSubdomain($subdomain)
{ {
return substr(hash('sha256', "$subdomain{$this->key}"), 0, 8); return $this->getPacConf()["{$subdomain}_domain"] ?: substr(hash('sha256', "$subdomain{$this->key}"), 0, 8);
} }
public function addWg($page) public function addWg($page)
+2 -2
View File
@@ -9,7 +9,7 @@
"tag": "tun-in", "tag": "tun-in",
"domain_strategy": "prefer_ipv4", "domain_strategy": "prefer_ipv4",
"interface_name": "sing-tun", "interface_name": "sing-tun",
"inet4_address": "172.19.0.1\/30", "address": ["172.19.0.1\/30"],
"mtu": 1400, "mtu": 1400,
"gso": true, "gso": true,
"auto_route": true, "auto_route": true,
@@ -192,4 +192,4 @@
], ],
"final": "direct" "final": "direct"
} }
} }
+10 -90
View File
@@ -1,87 +1,14 @@
telegram bot to manage servers (inside the bot) telegram bot to manage servers (inside the bot)
<img src="https://github.com/user-attachments/assets/ec5faa51-987c-461a-a973-d94c7edf7115" width="300"> - VLESS (Reality OR Websocket)
- NaiveProxy
### VLESS (Reality OR Websocket) - OpenConnect
- change secret - Wireguard
- qr/config - Amnezia
- change fake domain - AdguardHome
- multiple users - MTProto
- subscriptions with routing (xray, sing-box, mihomo) - PAC
- routing templates per user - automatic ssl
- routing via rulesets (sing-box, mihomo)
- steal from yourself
- add domains to warp
### Main menu VLESS:
<img src="https://github.com/user-attachments/assets/80d2f671-fade-4819-a96a-efa253741ffd" width="300">
### User menu VLESS:
<img src="https://github.com/user-attachments/assets/5c3c5b5e-1931-4e98-a472-d303bac61a4e" width="300">
### NaiveProxy
- change login
- change password
<img src="https://github.com/mercurykd/vpnbot/assets/30900414/2127a4af-0436-452c-bfe2-c750dd5dbc06" width="300">
### OpenConnect
- change secret
- change password
- change dns
- add user
- add ip subnet
- expose-iroutes (lan between users)
<img src="https://github.com/user-attachments/assets/c3a8a78e-fe99-423c-a626-610b333a2a56" width="300">
### Wireguard / Amnezia
- create
- delete
- rename
- timer
- torrent blocking
- qr/config
- AmneziaVPN vpn:// link
- statistics
<img src="https://github.com/mercurykd/vpnbot/assets/30900414/51a79c93-8083-40ba-a14b-a6ef19f00531" width="300">
<img src="https://github.com/mercurykd/vpnbot/assets/30900414/fd6ffd9f-bd75-479c-8dca-ea6c0b938b6c" width="300">
### Shadowsocks + v2ray
- change password
- on/off v2ray
- qr
- short link
<img src="https://github.com/mercurykd/vpnbot/assets/30900414/fbe39617-63ae-4536-8ab0-e4269ed8784a" width="300">
### AdguardHome
- change password
- change upstream dns
- check dns
- check safesearch
- add custom clientID for DNSoverTLS (DOT)
- fill allowed clients (WG/AWG + OpenConnect + VLESS)
- custom ID for each user VLESS
<img src="https://github.com/user-attachments/assets/1dcdd9f9-f781-4ec2-8e32-01ce6095e0a3" width="300">
### PAC
- the ability to create your own PAC available by url with the ability to substitute the final ip and port
- Shadowsocks Android PAC
- add [antifilter-community](https://community.antifilter.download/) or [ru-bundle](https://github.com/legiz-ru/sb-rule-sets/blob/main/ru-bundle.lst) domain lists
<img src="https://github.com/user-attachments/assets/8d039dbb-6478-43a8-811a-4279e766c884" width="300">
### MTProto
- change secret
- qr/config
<img src="https://github.com/user-attachments/assets/d37b2e1c-f991-4e1c-8060-1b547eea8fe2" width="300">
### Settings
- add/change admin
- change language (en/ru)
- import/export all settings
- domain binding
- obtain ssl for domain
- fake html for domain
- ports block
<img src="https://github.com/user-attachments/assets/82b78014-eaa2-4b4c-bc90-77f58d03d57c" width="300">
--- ---
environment: ubuntu 22.04/24.04, debian 11/12 environment: ubuntu 22.04/24.04, debian 11/12
@@ -89,12 +16,5 @@ environment: ubuntu 22.04/24.04, debian 11/12
### Install: ### Install:
```shell ```shell
wget -O- https://raw.githubusercontent.com/mercurykd/vpnbot/master/scripts/init.sh | sh -s YOUR_TELEGRAM_BOT_KEY wget -O- https://raw.githubusercontent.com/mercurykd/vpnbot/master/scripts/init.sh | sh -s YOUR_TELEGRAM_BOT_KEY master
```
### Install as service (autoload on start):
```shell
cd /root/vpnbot
bash scripts/install_as_service.sh
``` ```
+2
View File
@@ -1,3 +1,4 @@
TAG="${2:-master}"
apt update apt update
apt install -y \ apt install -y \
ca-certificates \ ca-certificates \
@@ -13,6 +14,7 @@ apt install -y \
curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
git clone https://github.com/mercurykd/vpnbot.git git clone https://github.com/mercurykd/vpnbot.git
cd ./vpnbot cd ./vpnbot
git checkout $TAG
echo "<?php echo "<?php
\$c = ['key' => '$1'];" > ./app/config.php \$c = ['key' => '$1'];" > ./app/config.php
Binary file not shown.
+11 -2
View File
@@ -1,5 +1,14 @@
#!/bin/bash #!/bin/bash
pwd=`pwd` pwd=`pwd`
process_name="$pwd/update/update.sh"
current_pid=$$
pids=$(pgrep -f $process_name)
for pid in $pids; do
if [ $pid -ne $current_pid ]; then
kill -9 $pid
fi
done
> $pwd/update/pipe > $pwd/update/pipe
echo "$$" > $pwd/update/update_pid echo "$$" > $pwd/update/update_pid
@@ -27,10 +36,10 @@ do
git pull > ./update/message git pull > ./update/message
fi fi
curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "launching the bot"/')" curl -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$key/editMessageText -d "$(cat $pwd/update/curl | sed 's/"text":"~t~"/"text": "launching the bot"/')"
IP=$(curl ipinfo.io/ip) VER=$(git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
bash $pwd/update/update.sh &
> $pwd/update/key > $pwd/update/key
> $pwd/update/curl > $pwd/update/curl
IP=$(curl -s -t 1 2ip.io || curl -s -t 1 ipinfo.io/ip || curl -s -t 1 ifconfig.me) VER=$(git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
bash $pwd/update/update.sh &
exit 0 exit 0
fi fi
sleep 1 sleep 1
+8
View File
@@ -1,3 +1,11 @@
04.01.2025
- возможность установить нужную версию с нуля
- корректировка автосканера под новую версию
- улучшение основного меню
26.12.2024 v2.2
- возможность менять поддомен для naive/openconnect
26.12.2024 v2.1
- обновление версии singbox и конфига под него
22.12.2024 v2.0 22.12.2024 v2.0
!!! версия не совместима с предыдущими, возможно прийдется накатывать руками. старые конфиги (кроме вг) не будут работать! перед обновлением: !!! версия не совместима с предыдущими, возможно прийдется накатывать руками. старые конфиги (кроме вг) не будут работать! перед обновлением:
- включить все порты или удалить docker-compose.override.yml - включить все порты или удалить docker-compose.override.yml