#!/bin/bash # List of DNS servers to compare DNS_SERVERS=("8.8.8.8" "1.1.1.1" "9.9.9.9" "208.67.222.222") get_tool_name() { echo "DNS Server Comparison" } get_tool_description() { echo "Compare DNS server performance in terms of speed and reliability" } 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[0m $single_domain\n" for dns_server in "${DNS_SERVERS[@]}"; do response_time=$(dig "@$dns_server" "$single_domain" +stats +time=1 | grep "Query time:" | awk '{print $4}') if [ -n "$response_time" ]; then result+="\e[1mDNS Server:\e[0m $dns_server \e[1mResponse Time:\e[0m ${response_time}ms\n" else result+="\e[1mDNS Server:\e[0m $dns_server \e[1mResponse Time:\e[0m \e[31mFailed\e[0m\n" fi done }