Skip to content

Instantly share code, notes, and snippets.

@oogali
Created January 13, 2011 23:31
Show Gist options
  • Save oogali/778840 to your computer and use it in GitHub Desktop.
Save oogali/778840 to your computer and use it in GitHub Desktop.
A way to search for "cute" domains, without blowing through WHOIS usage limits
#!/bin/sh
# "Cute" domain search -- < oogali AT gmail.com >
#
# Example:
# [oogali@illusion ~]$ ./cute-domain-search am 2
# IL.AM IS AVAILABLE
# LE.AM IS AVAILABLE
# LY.AM IS AVAILABLE
# OG.AM IS AVAILABLE
# OL.AM IS AVAILABLE
# QT.AM IS AVAILABLE
# ST.AM IS AVAILABLE
# TI.AM IS AVAILABLE
#
# And yes, it pains me that the documentation is more lines than the
# actual script itself
if [ $# -ne 2 ]; then
echo "$0 <tld> <# of letters>"
exit 1
fi
tld=${1}
letters=${2}
rs=`dig ${tld} @a.root-servers.net ns +noadditional +noquestion +nostats +nocomments | grep "^${tld}" | awk '{ print $5 }' | head -1`
for domain in `egrep "^[A-Za-z]{${letters}}${tld}\$" /usr/share/dict/words | tr '[A-Z]' '[a-z]' | sort | uniq | sed "s/${tld}\$//"` ; do
dig ${domain}.${tld} ns @${rs} | grep -q 'NXDOMAIN' && echo "${domain}.${tld} is available" | tr '[a-z]' '[A-Z]'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment