Seems like the previous attempt was not enough to fix all cases of
false positives. Now ignore DiG comment lines (errors) altogether.
modified: host/check-blacklist.sh
if ip=$(dig a "$1" +short) && [ -n "$ip" ]
then
if ip=$(dig a "$1" +short) && [ -n "$ip" ]
then
- bl=$(dig a "$(printf "%s." "$ip" | tac -s.)$2" +short) \
+ bl=$(dig a "$(printf "%s." "$ip" | tac -s.)$2" +short | grep -v "^;; ") \
&& [ -n "$bl" ] && { echo "$ip is blacklisted ($bl)."; exit 1; } || echo "$ip is not blacklisted."
else
echo "Could not resolve $1!"
&& [ -n "$bl" ] && { echo "$ip is blacklisted ($bl)."; exit 1; } || echo "$ip is not blacklisted."
else
echo "Could not resolve $1!"