V36 Slowdns

This commit is contained in:
2025-11-27 12:18:12 -03:00
parent 26fb8a222c
commit 3e0f942371
8 changed files with 962 additions and 777 deletions

BIN
aarch64/dnstt-server Normal file

Binary file not shown.

View File

@@ -99,6 +99,33 @@ function startsv($cone, $port, $banner, $token, $tipo)
shell_exec("/usr/bin/screen -dmS limitador bash -c 'while true; do php /opt/DragonCore/limiter.php; done'"); shell_exec("/usr/bin/screen -dmS limitador bash -c 'while true; do php /opt/DragonCore/limiter.php; done'");
} elseif ($cone == "botulek") { } elseif ($cone == "botulek") {
shell_exec("screen -dmS botulek bash -c 'while true; do ulimit -n 999999 && /opt/DragonCore/ulekbot --token $banner --id $token; done'"); shell_exec("screen -dmS botulek bash -c 'while true; do ulimit -n 999999 && /opt/DragonCore/ulekbot --token $banner --id $token; done'");
} elseif ($cone == "dnstt") {
$bin = '/opt/DragonCore/dnstt-server';
$confDir = '/opt/DragonCore/dnstt';
$privFile = $confDir . '/server.key';
if (!is_dir($confDir)) {
mkdir($confDir, 0700, true);
}
if (!file_exists($privFile)) {
return;
}
$cmd = "iptables -C INPUT -p udp --dport {$port} -j ACCEPT 2>/dev/null || iptables -I INPUT -p udp --dport {$port} -j ACCEPT";
shell_exec($cmd);
$cmd = "iptables -t nat -C PREROUTING -p udp --dport 53 -j REDIRECT --to-ports {$port} 2>/dev/null || iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports {$port}";
shell_exec($cmd);
$cmd = "/usr/bin/screen -dmS dnstt bash -c '"
. "while true; do "
. "ulimit -n 999999 && "
. escapeshellcmd($bin)
. " -udp 0.0.0.0:" . $port
. " -privkey-file " . escapeshellarg($privFile)
. " " . escapeshellarg($banner)
. " " . escapeshellarg($token)
. "; "
. "sleep 2; "
. "done'";
shell_exec($cmd);
} }
} }

113
dnstt.php Normal file
View File

@@ -0,0 +1,113 @@
<?php
function dnstt($port, $nsDomain, $target)
{
$port = preg_replace('/\D/', '', (string)$port);
if ($port === '') {
$port = '5300';
}
$nsDomain = trim($nsDomain);
$target = trim($target);
if ($nsDomain === '' || $target === '') {
echo "NS domain e destino nao podem estar vazios.\n";
return;
}
$bin = '/opt/DragonCore/dnstt-server';
$confDir = '/opt/DragonCore/dnstt';
$privFile = $confDir . '/server.key';
$pubFile = $confDir . '/server.pub';
if (!file_exists($bin)) {
echo "Binario DNSTT nao encontrado em {$bin}\n";
echo "Coloque o dnstt-server nesse caminho.\n";
return;
}
if (!is_dir($confDir)) {
mkdir($confDir, 0700, true);
}
if (!file_exists($privFile) || !file_exists($pubFile)) {
$cmdGen = escapeshellcmd($bin) .
' -gen-key -privkey-file ' . escapeshellarg($privFile) .
' -pubkey-file ' . escapeshellarg($pubFile) .
' 2>/dev/null';
shell_exec($cmdGen);
}
if (!file_exists($privFile) || !file_exists($pubFile)) {
echo "Falha ao gerar as chaves do DNSTT.\n";
return;
}
$cmd = "iptables -C INPUT -p udp --dport {$port} -j ACCEPT 2>/dev/null || iptables -I INPUT -p udp --dport {$port} -j ACCEPT";
shell_exec($cmd);
$cmd = "iptables -t nat -C PREROUTING -p udp --dport 53 -j REDIRECT --to-ports {$port} 2>/dev/null || iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports {$port}";
shell_exec($cmd);
if (function_exists('deletecone') && function_exists('incone')) {
deletecone('dnstt');
incone('dnstt', $port, $nsDomain, $target, 'udp');
}
$onoff = trim(shell_exec('screen -list | grep -q dnstt && echo 1 || echo 0'));
if ($onoff === '1') {
shell_exec('screen -X -S dnstt quit');
}
$cmd = "/usr/bin/screen -dmS dnstt bash -c '"
. "while true; do "
. "ulimit -n 999999 && "
. escapeshellcmd($bin)
. " -udp 0.0.0.0:" . $port
. " -privkey-file " . escapeshellarg($privFile)
. " " . escapeshellarg($nsDomain)
. " " . escapeshellarg($target)
. "; "
. "sleep 2; "
. "done'";
shell_exec($cmd);
echo "DNSTT ON | UDP :{$port} | NS: {$nsDomain} | Destino: {$target}\n";
}
function dnstton()
{
$onoff = trim(shell_exec('screen -list | grep -q dnstt && echo 1 || echo 0'));
if ($onoff === '1') {
echo 'ON';
} else {
echo 'OFF';
}
}
function dnsttstop()
{
if (function_exists('deletecone')) {
deletecone('dnstt');
}
shell_exec('screen -X -S dnstt quit');
echo "DNSTT OFF\n";
}
function dnsttpub()
{
$pubFile = '/opt/DragonCore/dnstt/server.pub';
if (!file_exists($pubFile)) {
echo "Pubkey nao encontrada em {$pubFile}. Inicie o DNSTT uma vez para gerar.\n";
return;
}
$content = trim(file_get_contents($pubFile));
if ($content === '') {
echo "Pubkey vazia em {$pubFile}\n";
} else {
echo "DNSTT PubKey:\n{$content}\n";
}
}

View File

@@ -10,6 +10,7 @@ if [ "$system" = "debian" ]; then
fi fi
sudo apt update sudo apt update
sudo apt upgrade -y
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg curl wget sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg curl wget
if [ "$system" = "debian" ]; then if [ "$system" = "debian" ]; then
repos=$(find /etc/apt/ -name '*.list' -exec cat {} + | grep ^[[:space:]]*deb | grep -q "packages.sury.org/php" && echo 1 || echo 0) repos=$(find /etc/apt/ -name '*.list' -exec cat {} + | grep ^[[:space:]]*deb | grep -q "packages.sury.org/php" && echo 1 || echo 0)
@@ -51,6 +52,7 @@ rm -rf /opt/DragonCore/install.sh
curl -s -L -o /opt/DragonCore/menu https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/menu curl -s -L -o /opt/DragonCore/menu https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/menu
curl -s -L -o /opt/DragonCore/dragon_go https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/$(uname -m)/dragon_go curl -s -L -o /opt/DragonCore/dragon_go https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/$(uname -m)/dragon_go
curl -s -L -o /opt/DragonCore/dnstt-server https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/$(uname -m)/dnstt-server
curl -s -L -o /opt/DragonCore/badvpn-udpgw https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/$(uname -m)/badvpn-udpgw curl -s -L -o /opt/DragonCore/badvpn-udpgw https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/$(uname -m)/badvpn-udpgw
curl -s -L -o /opt/DragonCore/libcrypto.so.3 https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/$(uname -m)/libcrypto.so.3 curl -s -L -o /opt/DragonCore/libcrypto.so.3 https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/$(uname -m)/libcrypto.so.3
curl -s -L -o /opt/DragonCore/libssl.so.3 https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/$(uname -m)/libssl.so.3 curl -s -L -o /opt/DragonCore/libssl.so.3 https://git.dr2.site/penguinehis/DragonCoreSSH-Beta/raw/branch/main/$(uname -m)/libssl.so.3

41
menu
View File

@@ -192,8 +192,49 @@ elif [ "$cake" == "4" ]; then
# Xray Core management # Xray Core management
clear clear
menuxray menuxray
elif [ "$cake" == "5" ]; then elif [ "$cake" == "5" ]; then
clear clear
dnon="$(php /opt/DragonCore/menu.php dnstton)"
if [ "$dnon" == "ON" ]; then
echo "DNSTT esta ON."
echo "1) Parar DNSTT"
echo "2) Mostrar PubKey"
echo "0) Voltar"
echo -ne "> "; read op
if [ "$op" == "1" ]; then
php /opt/DragonCore/menu.php dnsttstop
echo -ne "Pressione enter para continuar"; read enter
menucon
elif [ "$op" == "2" ]; then
php /opt/DragonCore/menu.php dnsttpub
echo -ne "Pressione enter para continuar"; read enter
menucon
else
menucon
fi
else
echo "Configurar DNSTT (SlowDNS)"
echo ""
echo -ne "Porta UDP (53/5300) [5300] > "; read port
[ -z "$port" ] && port=5300
echo -ne "NS Domain (ex: t.example.com) > "; read ns
if [ -z "$ns" ]; then
echo "NS Domain nao pode ficar vazio!"
echo -ne "Pressione enter para continuar"; read enter
menucon
fi
echo -ne "Destino (host:porta, ex: 127.0.0.1:8000) [127.0.0.1:8000] > "; read dest
[ -z "$dest" ] && dest="127.0.0.1:8000"
clear
php /opt/DragonCore/menu.php dnstt "$port" "$ns" "$dest"
echo ""
echo -ne "Pressione enter para continuar"; read enter
menucon
fi
elif [ "$cake" == "6" ]; then
clear
echo "Portas Ativas" echo "Portas Ativas"
echo "" echo ""
php /opt/DragonCore/menu.php infoport php /opt/DragonCore/menu.php infoport

View File

@@ -31,6 +31,7 @@ require "/opt/DragonCore/limiterstart.php";
require "/opt/DragonCore/statusvps.php"; require "/opt/DragonCore/statusvps.php";
require "/opt/DragonCore/bottg.php"; require "/opt/DragonCore/bottg.php";
require "/opt/DragonCore/xray.php"; require "/opt/DragonCore/xray.php";
require "/opt/DragonCore/dnstt.php";
function clearScreen() function clearScreen()
@@ -92,6 +93,7 @@ function menuconnect()
"Stunnel4" => "", "Stunnel4" => "",
"OpenVPN" => "", "OpenVPN" => "",
"Xray Core" => "", "Xray Core" => "",
"DNSTT (SlowDNS)" => "",
"Portas Ativas" => "", "Portas Ativas" => "",
]; ];

View File

@@ -1 +1 @@
35 Year Of the Tubular Dragon 36 Year Of the Noodle Dragon

BIN
x86_64/dnstt-server Normal file

Binary file not shown.