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

46 lines
1.1 KiB
Bash

#!/bin/bash
# List of open DNS servers for testing
DNS_SERVERS=("8.8.8.8" "1.1.1.1" "9.9.9.9" "208.67.222.222")
get_tool_name() {
echo "DNSSEC Validation"
}
get_tool_description() {
echo "Verify DNSSEC signatures for a domain"
}
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"
result+="\e[1mDomain:\e[93m $single_domain\e[0m\n"
for dns_server in "${DNS_SERVERS[@]}"; do
dnssec_status=$(delv @"$dns_server" +dnssec +nocomments +nocl "$single_domain" 2>&1 | head -n 1)
if echo "$dnssec_status" | grep -q "; fully validated"; then
result+="\e[1mDNS Server ($dns_server):\e[0m \e[32mFully Validated\e[0m\n"
else
result+="\e[1mDNS Server ($dns_server):\e[0m \e[31mNot Fully Validated\e[0m\n"
fi
done
}