5 Usage $0 <hostname> <blacklist>
7 hostname - host to check on blacklist
8 blacklist - DNSBL blacklist (e.g. "zen.spamhaus.org")
13 if ip
=$
(dig a
"$1" +short
) && [ -n "$ip" ]
15 bl
=$
(dig a
"$(printf "%s.
" "$ip" | tac -s.)$2" +short
) \
16 && [ -n "$bl" ] && { echo "$ip is blacklisted ($bl)."; exit 1; } ||
echo "$ip is not blacklisted."
18 echo "Could not resolve $1!"