Compare commits

...

7 Commits

Author SHA1 Message Date
mercury 7d12e5c972 improve update script 2024-03-21 01:36:11 +04:00
mercury 2efcea9dbe improve update script 2024-03-21 01:27:06 +04:00
mercury 5b1bf2b3d5 switch branches after update 2024-03-21 01:19:19 +04:00
mercury 9f1b3d84f4 XTLS-Reality steal from yourself 2024-03-20 22:36:06 +04:00
mercury e81c6a5dfb update version 2024-03-18 10:03:57 +04:00
mercury c00dafa6d1 fix port mtproto 2024-03-18 01:59:12 +04:00
mercury cab00f4aed fake tls mtproto 2024-03-18 01:53:22 +04:00
12 changed files with 286 additions and 36 deletions
+115 -12
View File
@@ -140,6 +140,12 @@ class Bot
case preg_match('~^/updatebot$~', $this->input['callback'], $m):
$this->updatebot();
break;
case preg_match('~^/branches$~', $this->input['callback'], $m):
$this->branches();
break;
case preg_match('~^/changeBranch (\d+)$~', $this->input['callback'], $m):
$this->changeBranch($m[1]);
break;
case preg_match('~^/getMirror$~', $this->input['callback'], $m):
$this->getMirror();
break;
@@ -336,6 +342,12 @@ class Bot
case preg_match('~^/changeFakeDomain$~', $this->input['callback'], $m):
$this->changeFakeDomain();
break;
case preg_match('~^/selfFakeDomain$~', $this->input['callback'], $m):
$this->selfFakeDomain();
break;
case preg_match('~^/changeTGDomain$~', $this->input['callback'], $m):
$this->changeTGDomain();
break;
case preg_match('~^/include (\d+)$~', $this->input['callback'], $m):
$this->include($m[1]);
break;
@@ -401,17 +413,26 @@ class Bot
public function secretSet($secret)
{
$this->restartTG($secret);
file_put_contents('/config/mtprotosecret', $secret);
$this->restartTG();
$this->mtproto();
}
public function restartTG($secret)
public function setTelegramDomain($domain)
{
file_put_contents('/config/mtprotosecret', $secret ?: '');
file_put_contents('/config/mtprotodomain', $domain);
$this->restartTG();
$this->mtproto();
}
public function restartTG()
{
$secret = file_get_contents('/config/mtprotosecret');
$fakedomain = file_get_contents('/config/mtprotodomain') ?: 'vk.com';
$this->ssh('pkill mtproto-proxy', 'tg');
if (preg_match('~^\w{32}$~', $secret)) {
$p = getenv('TGPORT');
$this->ssh("mtproto-proxy -u nobody -H $p --nat-info 10.10.0.8:{$this->ip} -S $secret --aes-pwd /proxy-secret /proxy-multi.conf -M 1 >/dev/null 2>&1 &", 'tg');
$this->ssh("mtproto-proxy --domain $fakedomain -u nobody -H $p --nat-info 10.10.0.8:{$this->ip} -S $secret --aes-pwd /proxy-secret /proxy-multi.conf -M 1 >/dev/null 2>&1 &", 'tg');
}
}
@@ -426,18 +447,22 @@ class Bot
{
$s = file_get_contents('/config/mtprotosecret');
$p = getenv('TGPORT');
$d = trim(file_get_contents('/config/mtprotodomain') ?: 'vk.com');
$d = exec("echo $d | tr -d '\\n' | xxd -ps -c 200");
$ip = $this->getPacConf()['domain'] ?: $this->ip;
return "https://t.me/proxy?server=$ip&port=$p&secret=$s";
return "https://t.me/proxy?server=$ip&port=$p&secret=ee$s$d";
}
public function mtproto()
{
$s = file_get_contents('/config/mtprotosecret');
$d = file_get_contents('/config/mtprotodomain') ?: 'vk.com';
$p = getenv('TGPORT');
$ip = $this->getPacConf()['domain'] ?: $this->ip;
$st = $this->ssh('pgrep mtproto-proxy', 'tg') ? 'on' : 'off';
$text[] = "Menu -> MTProto\n";
$text[] = "status: $st\n";
$text[] = "fake domain: <code>$d</code>\n";
if ($st == 'on') {
$text[] = $this->linkMtproto();
}
@@ -453,6 +478,12 @@ class Bot
'callback_data' => "/setSecret",
],
];
$data[] = [
[
'text' => $this->i18n('changeFakeDomain'),
'callback_data' => "/changeTGDomain",
],
];
$data[] = [
[
'text' => $this->i18n('show QR'),
@@ -1006,10 +1037,11 @@ class Bot
'private' => file_get_contents('/certs/cert_private'),
'public' => file_get_contents('/certs/cert_public'),
] : false,
'mtproto' => file_get_contents('/config/mtprotosecret'),
'xray' => json_decode(file_get_contents('/config/xray.json'), true),
'oc' => file_get_contents('/config/ocserv.conf'),
'ocu' => file_get_contents('/config/ocserv.passwd'),
'mtproto' => file_get_contents('/config/mtprotosecret'),
'mtprotodomain' => file_get_contents('/config/mtprotodomain'),
'xray' => json_decode(file_get_contents('/config/xray.json'), true),
'oc' => file_get_contents('/config/ocserv.conf'),
'ocu' => file_get_contents('/config/ocserv.passwd'),
];
return json_encode($conf, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
@@ -1121,7 +1153,9 @@ class Bot
if (!empty($json['mtproto'])) {
$out[] = 'update mtproto';
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$this->restartTG($json['mtproto']);
file_put_contents('/config/mtprotosecret', $json['mtproto']);
file_put_contents('/config/mtprotodomain', $json['mtprotodomain'] ?: '');
$this->restartTG();
}
// xray
if (!empty($json['xray'])) {
@@ -3364,6 +3398,10 @@ DNS-over-HTTPS with IP:
'text' => $this->i18n('changeFakeDomain'),
'callback_data' => "/changeFakeDomain",
],
[
'text' => $this->i18n('selfFakeDomain'),
'callback_data' => "/selfFakeDomain",
],
];
if ($c['inbounds'][0]['settings']['clients'][0]['id']) {
$data[] = [
@@ -3751,7 +3789,13 @@ DNS-over-HTTPS with IP:
'callback_data' => "/debug",
],
];
exec('git -C / branch', $m);
$track = trim(file_get_contents('/update/branch'));
$data[] = [
[
'text' => "{$m[0]} => $track",
'callback_data' => "/branches",
],
[
'text' => $this->i18n('update bot'),
'callback_data' => "/updatebot",
@@ -3769,6 +3813,39 @@ DNS-over-HTTPS with IP:
];
}
public function branches()
{
exec('git -C / branch -r', $m);
array_shift($m);
foreach ($m as $k => $v) {
$data[] = [
[
'text' => $v,
'callback_data' => "/changeBranch $k",
]
];
}
$data[] = [
[
'text' => $this->i18n('back'),
'callback_data' => "/menu config",
]
];
$this->update($this->input['from'], $this->input['message_id'], 'branches', $data);
}
public function changeBranch($i)
{
exec('git -C / branch -r', $m);
array_shift($m);
foreach ($m as $k => $v) {
if ($i == $k) {
file_put_contents('/update/branch', trim(str_replace('origin/', '', $v)));
}
}
$this->menu('config');
}
public function logs()
{
foreach (scandir('/logs/') as $k => $v) {
@@ -3871,16 +3948,42 @@ DNS-over-HTTPS with IP:
];
}
public function setFakeDomain($domain)
public function changeTGDomain()
{
$r = $this->send(
$this->input['chat'],
"@{$this->input['username']} enter domain",
$this->input['message_id'],
reply: 'enter domain',
);
$_SESSION['reply'][$r['result']['message_id']] = [
'start_message' => $this->input['message_id'],
'start_callback' => $this->input['callback_id'],
'callback' => 'setTelegramDomain',
'args' => [],
];
}
public function setFakeDomain($domain, $self = false)
{
$c = $this->getXray();
$c['inbounds'][0]['streamSettings']['realitySettings']['serverNames'][0] = $domain;
$c['inbounds'][0]['streamSettings']['realitySettings']['dest'] = "$domain:443";
$c['inbounds'][0]['streamSettings']['realitySettings']['dest'] = $self ? "10.10.1.2:443" : "$domain:443";
$this->restartXray($c);
$this->setUpstreamDomain($domain);
$this->xray();
}
public function selfFakeDomain()
{
$c = $this->getPacConf();
if (!empty($c['domain'])) {
$this->setFakeDomain($c['domain'], 1);
} else{
$this->answer($this->input['callback_id'], 'empty domain', true);
}
}
public function setBackup($text)
{
$text = trim($text);
+9 -5
View File
@@ -263,7 +263,11 @@ $i = [
],
'changeFakeDomain' => [
'en' => 'changeFakeDomain',
'ru' => 'установить фейковый домен',
'ru' => 'фейковый домен',
],
'selfFakeDomain' => [
'en' => 'selfFakeDomain',
'ru' => 'домен бота',
],
'page' => [
'en' => 'pagination',
@@ -310,11 +314,11 @@ $i = [
'ru' => 'сторонний браузер',
],
'browser_notify_on' => [
'en' => 'the web panel can now be opened in any browser',
'ru' => 'веб панель теперь может быть открыта в любом браузере',
'en' => 'the web panel can be opened in any browser',
'ru' => 'веб панель может быть открыта в любом браузере',
],
'browser_notify_off' => [
'en' => 'the web panel can no longer be opened in any browser',
'ru' => 'веб панель теперь не может быть открыта в любом браузере',
'en' => 'web panel is only available from telegram',
'ru' => 'веб панель доступна только из телеграмма',
],
];
+1
View File
@@ -35,4 +35,5 @@ if (!empty($c['admin'])) {
}
file_put_contents('/update/message', '');
file_put_contents('/update/reload_message', '');
$bot->restartTG();
$bot->sslip();
+117
View File
@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<style>
/* Design based on Blue Login Field of Kevin Sleger https://codepen.io/MurmeltierS/pen/macKb */
body {
background: #44c4e7 url("https://photos-6.dropbox.com/t/2/AAC_bdqR8LMkjEe-HPIf4K1DhtseMLRHPklBSzJSuzglvA/12/5714737/jpeg/1024x768/3/1418346000/0/2/bkg-blur.jpg/CLHm3AIgASgBKAI/b7RrveA2022yJyfO9RyRvv7LjJQESukGHssHUxVThzw") no-repeat center center fixed;
background-size: cover;
font-family: "Roboto";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
&::before {
z-index: -1;
content: '';
position: fixed;
top: 0;
left: 0;
background: #44c4e7;
/* IE Fallback */
background: rgba(68, 196, 231, 0.8);
width: 100%;
height: 100%;
}
}
.form {
position: absolute;
top: 50%;
left: 50%;
background: #fff;
width: 285px;
margin: -140px 0 0 -182px;
padding: 40px;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
h2 {
margin: 0 0 20px;
line-height: 1;
color: #44c4e7;
font-size: 18px;
font-weight: 400;
}
input {
outline: none;
display: block;
width: 100%;
margin: 0 0 20px;
padding: 10px 15px;
border: 1px solid #ccc;
color: #ccc;
font-family: "Roboto";
box-sizing: border-box;
font-size: 14px;
font-wieght: 400;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transition: 0.2s linear;
&input:focus {
color: #333;
border: 1px solid #44c4e7;
}
}
button {
cursor: pointer;
background: #44c4e7;
width: 100%;
padding: 10px 15px;
border: 0;
color: #fff;
font-family: "Roboto";
font-size: 14px;
font-weight: 400;
&:hover {
background: #369cb8;
}
}
}
.error,
.valid {
display: none;
}
</style>
<script src="jquery-3.7.1.min.js"></script>
</head>
<body>
<section class="form animated flipInX">
<h2>Login To Your Account</h2>
<p class="valid">Valid. Please wait a moment.</p>
<p class="error">Error. Please enter correct Username &amp; password.</p>
<form class="loginbox" autocomplete="off">
<input placeholder="Username" type="text" id="username"></input>
<input placeholder="Password" type="password" id="password"></input>
<button id="submit">Login</button>
</form>
</section>
<script>
$(document).ready(function() {
$('#submit').click(function () {
event.preventDefault(); // prevent PageReLoad
$('.error').css('display', 'block'); // show error msg
});
});
</script>
</body>
</html>
View File
+11 -6
View File
@@ -22,15 +22,17 @@ http {
set_real_ip_from 10.10.0.10;
server {
listen 80 default_server;
listen 443 ssl http2 default_server proxy_protocol;
listen 10.10.0.2:80 default_server;
listen 10.10.0.2:443 ssl http2 default_server proxy_protocol;
ssl_certificate /certs/self_public;
ssl_certificate_key /certs/self_private;
access_log /logs/nginx_default_access;
location / {
return 444;
root /app;
index login.html;
try_files $uri $uri/ =404;
}
location /adguard/ {
access_log /logs/nginx_adguard_access;
@@ -73,11 +75,12 @@ http {
#-domain
# server {
# listen 80;
# listen 10.10.0.2:80;
# server_name ;
#-domain
#-ssl
# listen 443 ssl http2 proxy_protocol;
# listen 10.10.0.2:443 ssl http2 proxy_protocol;
# listen 10.10.1.2:443 ssl http2;
# ssl_certificate /certs/cert_public;
# ssl_certificate_key /certs/cert_private;
#-ssl
@@ -86,7 +89,9 @@ http {
# access_log /logs/nginx_domain_access;
# location / {
# return 444;
# root /app;
# index login.html;
# try_files $uri $uri/ =404;
# }
# location /adguard/ {
# access_log /logs/nginx_adguard_access;
+11 -6
View File
@@ -22,15 +22,17 @@ http {
set_real_ip_from 10.10.0.10;
server {
listen 80 default_server;
listen 443 ssl http2 default_server proxy_protocol;
listen 10.10.0.2:80 default_server;
listen 10.10.0.2:443 ssl http2 default_server proxy_protocol;
ssl_certificate /certs/self_public;
ssl_certificate_key /certs/self_private;
access_log /logs/nginx_default_access;
location / {
return 444;
root /app;
index login.html;
try_files $uri $uri/ =404;
}
location /adguard/ {
access_log /logs/nginx_adguard_access;
@@ -73,11 +75,12 @@ http {
#-domain
# server {
# listen 80;
# listen 10.10.0.2:80;
# server_name ;
#-domain
#-ssl
# listen 443 ssl http2 proxy_protocol;
# listen 10.10.0.2:443 ssl http2 proxy_protocol;
# listen 10.10.1.2:443 ssl http2;
# ssl_certificate /certs/cert_public;
# ssl_certificate_key /certs/cert_private;
#-ssl
@@ -86,7 +89,9 @@ http {
# access_log /logs/nginx_domain_access;
# location / {
# return 444;
# root /app;
# index login.html;
# try_files $uri $uri/ =404;
# }
# location /adguard/ {
# access_log /logs/nginx_adguard_access;
+10 -1
View File
@@ -12,6 +12,10 @@ networks:
ipam:
config:
- subnet: 10.10.0.0/24
xray:
ipam:
config:
- subnet: 10.10.1.0/24
volumes:
adguard:
@@ -87,9 +91,11 @@ services:
networks:
default:
ipv4_address: 10.10.0.2
xray:
ipv4_address: 10.10.1.2
logging: *default-logging
php:
image: mercurykd/vpnbot-php:1.2
image: mercurykd/vpnbot-php:1.3
build:
dockerfile: dockerfile/php.dockerfile
args:
@@ -110,6 +116,7 @@ services:
- ./mirror:/mirror
- ./.env:/mirror/.env
- ./update:/update
- ./.git:/.git
environment:
IP: ${IP}
VER: ${VER}
@@ -417,6 +424,8 @@ services:
networks:
default:
ipv4_address: 10.10.0.9
xray:
ipv4_address: 10.10.1.9
logging: *default-logging
oc:
image: mercurykd/vpnbot-oc:1.2
+1
View File
@@ -19,6 +19,7 @@ RUN apk add --no-cache --update php81 \
openssh \
openssl \
curl \
git \
py3-qt5 \
&& wget https://github.com/ameshkov/dnslookup/releases/download/v1.9.1/dnslookup-linux-amd64-v1.9.1.tar.gz \
&& tar -xf dnslookup-linux-amd64-v1.9.1.tar.gz \
-5
View File
@@ -4,9 +4,4 @@ ssh-keygen -A
exec /usr/sbin/sshd -D -e "$@" &
curl -s https://core.telegram.org/getProxySecret -o proxy-secret
curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf
if [ $(cat /mtprotosecret | wc -c) -gt 0 ]
then
SECRET=$(cat /mtprotosecret)
mtproto-proxy -u nobody -H $TGPORT --nat-info 10.10.0.8:$IP -S $SECRET --aes-pwd /proxy-secret /proxy-multi.conf -M 1
fi
tail -f /dev/null
+7 -1
View File
@@ -6,10 +6,16 @@ echo "$$" > $pwd/update/update_pid
while true
do
cmd=$(cat $pwd/update/pipe)
branch=$(cat $pwd/update/branch 2>/dev/null)
if [[ -n "$cmd" ]]
then
docker compose down --remove-orphans
git reset --hard
git reset --hard && git clean -fd
git fetch
if [[ -n "$branch" ]]
then
git checkout -t origin/$branch || git checkout $branch
fi
git pull > ./update/message
IP=$(curl https://ipinfo.io/ip) VER=$(git describe --tags) docker compose up -d --force-recreate
bash $pwd/update/update.sh &
+4
View File
@@ -1,3 +1,7 @@
20.03.2024 v1.11
- XTLS-Reality steal from yourself
18.03.2024 v1.10
- MTProto Fake-TLS
17.03.2024 v1.9
- автоматический технический домен sslip
13.03.2024 v1.8.10