Skip to content

Instantly share code, notes, and snippets.

@westh
Last active February 6, 2024 06:45
Show Gist options
  • Save westh/653121759ad9bfb7f821e735ea32b263 to your computer and use it in GitHub Desktop.
Save westh/653121759ad9bfb7f821e735ea32b263 to your computer and use it in GitHub Desktop.
πŸ₯ž a small distributed DNS checker – much like dnschecker.org but in your terminal, you could put it in /usr/local/bin or somewhere for easy access
#!/bin/bash
servers=(
"Cloudflare:1.1.1.1"
"Google:8.8.8.8"
"Quad9:9.9.9.9"
"Verisign:64.6.65.6"
)
if [[ $# -eq 0 ]] ; then
echo 'πŸ‘‹ no argument was provided, please provide a domain name'
exit 1
fi
for server in "${servers[@]}" ; do
DNS_PROVIDER="${server%%:*}"
PROVIDER_IP="${server##*:}"
printf "%s (%s):\t%s\n" "$DNS_PROVIDER" "$PROVIDER_IP" $(\
dig +short @"$PROVIDER_IP" $1 \
| sort -n \
| sed -e 'H;${x;s/\n/,/g;s/^,//;p;};d'\
) &
done
wait
@lwin04258
Copy link

happy new year

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment