Skip to content

Instantly share code, notes, and snippets.

@willfish
Created September 4, 2019 20:57
Show Gist options
  • Save willfish/79a36431d9a16f8e7e8f0df3f99b61d0 to your computer and use it in GitHub Desktop.
Save willfish/79a36431d9a16f8e7e8f0df3f99b61d0 to your computer and use it in GitHub Desktop.
if [ "$#" == "0" ]; then
echo "You need to supply at least one argument!"
exit 1
fi
DOMAINS=('.com' '.co.uk' '.net' '.info' '.mobi'
'.org' '.tel' '.biz' '.tv' '.cc' '.eu' '.ru'
'.in' '.it' '.sk' '.com.au' '.tech' '.io' '.systems' '.xxx')
ELEMENTS=${#DOMAINS[@]}
while (("$#")); do
for ((i = 0; i < $ELEMENTS; i++)); do
whois $1${DOMAINS[${i}]} | egrep -q \
'^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri'
if [ $? -eq 0 ]; then
echo "$1${DOMAINS[${i}]} : available"
fi
done
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment