-
-
Save abhishekbhardwaj/eb19786c3c9b179ca66f8e71b93b4e8c to your computer and use it in GitHub Desktop.
Get list of all active TLD's w/whois server
This file contains 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/bash | |
# 1 | |
wget -qO root.zone http://www.internic.net/domain/root.zone | |
# 2 | |
cat root.zone | grep "IN\sNS" | awk '{print $1}' | uniq | sort | sed -r 's/\.//g' | sed '/^$/d' > zone.list 2> /dev/null | |
# 3 | |
mkdir zones | |
# Generating whois.iana.db.php | |
echo "<?php" > whois.iana.db.php | |
echo "\$ianawhois = Array (" >> whois.iana.db.php | |
for zn in `cat zone.list`; do | |
whois -h whois.iana.org $zn > zones/$zn.whois | |
echo " \"$zn\" => \"`cat zones/$zn.whois | grep "whois:\s" | awk '{print $2}'`\"," >> whois.iana.db.php | |
sleep 2 | |
done | |
echo ");" >> whois.iana.db.php | |
echo "?>" >> whois.iana.db.php | |
# Yaiks | |
rm -rf zones | |
rm -f root.zone | |
rm -f zone.list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment