Skip to content

Instantly share code, notes, and snippets.

@flashlab
Forked from westh/dtjek
Last active February 6, 2024 06:48
Show Gist options
  • Save flashlab/4020c8d3b00bf589264b0c145f49f2d3 to your computer and use it in GitHub Desktop.
Save flashlab/4020c8d3b00bf589264b0c145f49f2d3 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"
"DNSpod:119.29.29.29"
"Aliyun:223.5.5.5"
"114:114.114.114.114"
"baidu:180.76.76.76"
"CNNIC:1.2.4.8"
)
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment