use custom dns

This commit is contained in:
Sándor 2024-02-26 00:30:38 +01:00
parent 202093d693
commit cd759e469d

View File

@ -10,14 +10,16 @@ if [[ $# -ne 1 ]]; then
exit 1 exit 1
fi fi
DNS="84.2.44.1"
# Get IPs # Get IPs
IPS="$(dig +short $1 A | sort -u) $(dig +short $1 AAAA | sort -u)" IPS="$(dig +short $1 A @$DNS | sort -u) $(dig +short $1 AAAA @$DNS | sort -u)"
# Loop through IPs # Loop through IPs
fails=0 fails=0
for IP in $IPS; do for IP in $IPS; do
# Performs the actual lookup against blacklists # Performs the actual lookup against blacklists
RESULT=$(host $IP | rev | cut -d" " -f1 | rev | sed 's/.$//') RESULT=$(host $IP $DNS | tail -1 | rev | cut -d" " -f1 | rev | sed 's/.$//')
if [ "$RESULT" != "$1" ]; then if [ "$RESULT" != "$1" ]; then
((fails++)) ((fails++))
fi fi