#!/bin/bash

## Copyright ©UDPTeam

## #forbidden#: https://#forbidden#.gg/civ3

## Script to keep-alive your DNSTT server domain record query from target resolver/local dns server

## Run this script excluded to your VPN tunnel (split vpn tunneling mode)

## run command: ./versus1.sh l



## Your DNSTT Nameserver & your Domain A Record

NS='dns.ssh-sg-3.vpnsvr.net'
NS1='sg3dns.mainssh.com'
NS2='dns.frs-2.optnl.com'
NS3='sg2ray-dns.mainssh.com'
NS4='ns-sg3dns.srvdns.us'
A='dns.ssh-sg-3.vpnsvr.net'

## Repeat dig cmd loop time (seconds) (positive interger only)

LOOP_DELAY=5



## Add your DNS here

declare -a HOSTS=('124.6.181.12' '124.6.181.36' '124.6.181.20')



## Linux' dig command executable filepath

## Select value: "CUSTOM|C" or "DEFAULT|D"

DIG_EXEC="DEFAULT"

## if set to CUSTOM, enter your custom dig executable path here

CUSTOM_DIG=/data/data/com.termux/files/home/go/bin/fastdig



######################################

######################################

######################################

######################################

######################################

VER=0.1

case "${DIG_EXEC}" in

DEFAULT|D)

_DIG="$(command -v dig)"

;;

CUSTOM|C)

_DIG="${CUSTOM_DIG}"

;;

esac

if [ ! $(command -v ${_DIG}) ]; then

printf "%b" "Dig command failed to run, " \"please install dig(dnsutils) or check " \"\G_EXEC & \STOM_DIG variable inside $( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/$(basename "$0") file.\&& exit 1

fi

endscript() {

unset NS NS1 NS2 NS3 NS4 NS5 NS6 NS7 NS8 NS9 NS10 NS11 NS12 NS13 NS14 NS15 NS16 NS17 NS18 NS19 NS20 NS21 NS22 NS23 NS24 A LOOP_DELAY HOSTS _DIG DIG_EXEC CUSTOM_DIG T R M

exit 1

}

trap endscript 2 15

check(){

for ((i=0; i<"${#HOSTS[*]}"; i++)); do

for R in "${A}" "${NS}" "${NS1}" "${NS2}" "${NS3}" "${NS4}" "${NS5}" "${NS6}" "${NS7}" "${NS8}" "${NS9}" "${NS10}" "${NS11}" "${NS12}" "${NS13}" "${NS14}" "${NS15}" "${NS16}" "${NS17}" "${NS18}" "${NS19}" "${NS20}" "${NS21}" "${NS22}" "${NS23}" "${NS24}"; do

T="${HOSTS[$i]}"
-z $(timeout -k 3 3 ${_DIG} @${T} ${R}) && M=31 || M=32;
echo -e "\;${M}m\:${R} D:${T}\m"
unset T R M
done
done
}


echo "DNSTT Keep-Alive script <#forbidden# @civ3>"

echo -e "DNS List: [\;34m${HOSTS[*]}\m]"

echo "CTRL + C to close script"

"${LOOP_DELAY}" -eq 1 && let "LOOP_DELAY++";

case "${@}" in

loop|l)

echo "Script loop: ${LOOP_DELAY} seconds"

while true; do

check

echo '.--. .-.. . .- ... . .-- .- .. -'

sleep ${LOOP_DELAY}

done

;;

*)

check

;;

esac

exit 0