Created
August 22, 2020 13:11
-
-
Save bonnee/6780118526e589dd77b798a5975bcfbe to your computer and use it in GitHub Desktop.
dnsbench.sh: DNS resolver benchmark utility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
RANK_URL="https://moz.com/top-500/download/?table=top500Domains" | |
echo "Downloading domain list..." | |
list=$(curl -fsSL "$RANK_URL" | awk -F, '{if (NR!=1) print $2}') | |
sum=0 | |
while read line; | |
do | |
ms=$(drill @"$1" TXT "$line" | grep msec | awk '{print $4}') | |
i=$((i+1)) | |
sum=$((ms+sum)) | |
echo -e "\e[1A\e[K$i" | |
done < <(echo $list) | |
echo "Average resolving time: "$((sum/i))"ms" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment