bash-dns/tools/domain_blacklist_check.sh
2023-08-17 22:43:59 -05:00

44 lines
992 B
Bash

#!/bin/bash
get_tool_name() {
echo "Domain Blacklist Check"
}
get_tool_description() {
echo "Check domains against well-known blacklists"
}
execute_tool() {
result=""
if [ -n "$domain" ]; then
if [[ "$domain" == *$'\n'* ]]; then
for single_domain in $domain; do
process_domain "$single_domain"
done
else
process_domain "$domain"
fi
else
result="No domains specified."
fi
echo -e "$result"
}
process_domain() {
local single_domain="$1"
blacklists=("zen.spamhaus.org" "bl.spamcop.net" "b.barracudacentral.org")
result+="\e[1mDomain:\e[93m $single_domain\e[0m\n"
for blacklist in "${blacklists[@]}"; do
if nslookup "$single_domain.$blacklist" > /dev/null; then
result+="\e[1m$blacklist:\e[0m \e[31mFailed\e[0m\n"
else
result+="\e[1m$blacklist:\e[0m \e[32mPass\e[0m\n"
fi
done
result+="\n"
}