-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathglobe-noload.sh
73 lines (69 loc) · 1.99 KB
/
globe-noload.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
## Copyright ©UDPTeam
## 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: ./globe-civ3.sh l
## Your DNSTT Nameserver & your Domain `A` Record
NS='b2.dns.slowdns.online'
A='b1.dns.slowdns.online'
## Repeat dig cmd loop time (seconds) (positive interger only)
LOOP_DELAY=5
## Add your DNS here
declare -a HOSTS=('112.198.126.124' '112.198.126.116' '112.198.126.44')
## 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 " \
"\$DIG_EXEC & \$CUSTOM_DIG variable inside $( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/$(basename "$0") file.\n" && exit 1
fi
endscript() {
unset NS 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}"; do
T="${HOSTS[$i]}"
[[ -z $(timeout -k 3 3 ${_DIG} @${T} ${R}) ]] && M=31 || M=32;
echo -e "\e[1;${M}m\$ R:${R} D:${T}\e[0m"
unset T R M
done
done
}
echo "DNSTT Keep-Alive script <Dexter Eskalarte>"
echo -e "DNS List: [\e[1;34m${HOSTS[*]}\e[0m]"
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