#!/bin/sh
#===================================================================
#
# FILE: whois_check.sh
#
# USAGE: ./whois_check.sh filename.txt
#
# DESCRIPTION: Checks for the availaility of a domain name using the most
# popular domain name suffixes.
# OPTIONS: -
# REQUIREMENTS: whois installed in /usr/bin, write permissions to current
# directory
# BUGS: -
# NOTES: Should work in linux or cygwin
# Checks for .com .net .org .info .blogspot.com, and .wordpress.com
# Additional domains may be added to the SUFFIX line
# AUTHOR: Scott McClelland (ScottM), systemnotesorg AT yahoo DOT com
# COMPANY: systemnotes.org
# VERSION: 1.0
# CREATED: 2008-11-28
# REVISION: -
#===================================================================
# check for availability of domain names in a list
# Sleeps for a minute after checking four times
# writes output to the screen and to the output file defined by OUTPUT (default = available.txt)
if [ "$1" == "" ]
then
# display help
echo "Enter filename containing one host per line"
echo ""
echo " e.g. %0 test.txt"
exit
fi
INPUT_FILE=
$1
OUTPUT=available.txt
SCORE=
0
NQUERIES=
0
# Check for each domain in the list with all the suffixes
# if [ "`whois a.com | grep \"No match\"`" ]; then echo "yes,
for PREFIX
in `cat ${INPUT_FILE}`
do
echo "==============================="
for SUFFIX
in .com .net .org .info .blogspot.com .wordpress.com
do
if [ "`/usr/bin/whois ${PREFIX}${SUFFIX} | grep -E \"No match|NOT FOUND\"`" ]
then
echo ${PREFIX}${SUFFIX}
SCORE=`expr ${SCORE} + 1`
fi
done
echo "====== ${SCORE} ${PREFIX} ====="
SCORE=0
# sleep, if we queried too frequently
# http://pir.org/ now limits .org queries to four per minute.
NQUERIES=`expr ${NQUERIES} + 1`
[ $NQUERIES -ge 4 ] && NQUERIES=0 && echo "sleeping 60 seconds…" && sleep 60
done | tee -a $OUTPUT
| |
| downloads