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

46 lines
1.1 KiB
Bash

#!/bin/bash
# List of DNS servers from different locations
DNS_SERVERS=("8.8.8.8" "1.1.1.1" "9.9.9.9" "208.67.222.222")
get_tool_name() {
echo "DNS Propagation Check"
}
get_tool_description() {
echo "Check DNS propagation across various DNS servers worldwide"
}
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
response=$(dig "@$dns_server" "$single_domain" +short)
if [ -n "$response" ]; then
result+="\e[1mDNS Server ($dns_server):\e[0m $response\n"
else
result+="\e[1mDNS Server ($dns_server):\e[0m \e[31mFailed\e[0m\n"
fi
done
}