]> git.megabrutal.com Git - mgsautils.git/commitdiff
check-blacklist.sh: Another fix for false positives master
authorMegaBrutal <code+git@megabrutal.com>
Tue, 30 Sep 2025 23:00:00 +0000 (01:00 +0200)
committerMegaBrutal <code+git@megabrutal.com>
Tue, 30 Sep 2025 23:00:00 +0000 (01:00 +0200)
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

host/check-blacklist.sh

index a00e0181593ab37faadabbb16e94adfb856b5403..0be8ad73c43d9a3b55ebab44c3bb2095a6016b99 100755 (executable)
@@ -12,7 +12,7 @@ fi
 
 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!"