Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Measure DNS speed by query Alexa top 50 sites NS and A record
#!/bin/bash
TEMP=/tmp/alexa.html
if [ -z $1 ] ; then
echo "`basename $0` {dns}"
else
DNS=$1
[ -f $TEMP ] || curl -s https://www.alexa.com/topsites > $TEMP
T1=`date +%s.%N`
for HOST in `awk -F[\"\/] '/href=..siteinfo\// {print $4}' $TEMP`
do
echo $HOST
dig NS $HOST @$DNS
dig A $HOST @$DNS
done
T2=`date +%s.%N`
echo -n "Total time "`echo $T2-$T1 | bc -l`
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment