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

@@ -6,7 +6,7 @@ function createautostart()
global $db_host, $db_port, $db_name, $db_user, $db_pass;
$conn = pg_connect("host=localhost dbname=dragoncore user=$db_user password=$db_pass");
$conn = pg_connect("host=localhost dbname=dragoncore user=$db_user password=$db_pass");
if (!$conn) {
echo "Failed to connect to PostgreSQL";
@@ -38,7 +38,7 @@ function incone($cone, $porta, $banner, $token, $tipo)
global $db_host, $db_port, $db_name, $db_user, $db_pass;
$conn = pg_connect("host=localhost dbname=dragoncore user=$db_user password=$db_pass");
$conn = pg_connect("host=localhost dbname=dragoncore user=$db_user password=$db_pass");
if (!$conn) {
die("Connection failed: " . pg_last_error());
}
@@ -60,7 +60,7 @@ function autostart()
global $db_host, $db_port, $db_name, $db_user, $db_pass;
$conn = pg_connect("host=localhost dbname=dragoncore user=$db_user password=$db_pass");
$conn = pg_connect("host=localhost dbname=dragoncore user=$db_user password=$db_pass");
if (!$conn) {
die("Connection failed: " . pg_last_error());
}
@@ -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'");
} elseif ($cone == "botulek") {
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);
}
}
@@ -107,7 +134,7 @@ function deletecone($cone)
global $db_host, $db_port, $db_name, $db_user, $db_pass;
$conn = pg_connect("host=localhost dbname=dragoncore user=$db_user password=$db_pass");
$conn = pg_connect("host=localhost dbname=dragoncore user=$db_user password=$db_pass");
if (!$conn) {
die("Connection failed: " . pg_last_error());
}
@@ -121,4 +148,4 @@ $conn = pg_connect("host=localhost dbname=dragoncore user=$db_user password=$db_
die("Execution failed: " . pg_last_error());
}
pg_close($conn);
}
}

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
sudo apt update
sudo apt upgrade -y
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg curl wget
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)
@@ -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/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/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

1583
menu

File diff suppressed because it is too large Load Diff

View File

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