Created
April 30, 2017 11:04
-
-
Save Leandros/67e4714b3a8666d7223df8357cad9b92 to your computer and use it in GitHub Desktop.
probe.sh
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/bash | |
WORDS=$(cat /usr/share/dict/words) | |
IFS=$'\n' | |
LC_ALL=C | |
echo "" > domains.txt | |
for word in $WORDS; do | |
if [[ $word =~ ^[A-Za-z]{4,12}$ ]]; then | |
domain="$word.com" | |
echo "checking $domain ..." | |
host_result=$(timeout 3 host "$domain") | |
host_retcode=$? | |
whois_result=$(timeout 2 whois "$domain" | egrep -q '^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri') | |
whois_retcode=$? | |
# TimeOut'ed | |
if [ $host_retcode -eq 0 ] && [ $whois_retcode -eq 124 ]; then | |
echo "add $domain (timeout)" | |
echo "$domain" >> domains.txt | |
elif [ $host_retcode -eq 0 ] && [ $whois_retcode -eq 0 ]; then | |
echo "add $domain" | |
echo "$domain" >> domains.txt | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment