Domain hunting in Python
Since last week, we've been looking for a new name for MadeToKill Design Studios for we think its too big a name and too funky to sound serious. Cool but ahem, int abundance of awesomeness, it lacks a little business sense. Soon we would be known by our new name W3Ninjas and our team expands to 4 looking forward to better and bigger projects :)
Even FOSS-shudaan people have a tough time choosing a domain! So taking inspiration from a post on HN, I set out to write a small python script to look for domains while I'm away from my desk. Its nothing more than two simple urllib2 calls. Here it is -
#!/usr/bin/env python
# Domain Hunter -- Abhishek Mishra <ideamonk at gmail.com>
# usage -
# $ python domainhunter.py < wordlist.txt
import urllib2
from sys import stdin
def domainSearch(domain):
baseurl = "http://www.google.com/a/cpanel/domain/selectDomain?domain="
try:
handle = urllib2.urlopen(baseurl + domain)
data = handle.read()
if (data.find("is available") != -1):
return True
else:
return False
except:
print " connection error ... ",
tlds = ['.com', '.net', '.org'];
# you can modify tlds to suit your needs,
# complete list of Google Apps supported tlds -
# tlds = ['.com', '.net', '.org', '.net', '.biz', '.info'];
if __name__ == '__main__':
search = stdin.readline()
while (search):
for word in search.split():
print (word + ":").ljust(30,' '),
for tld in tlds:
if ( domainSearch(word + tld) ):
print "[+]" + tld + "\t",
else:
print "[X]" + tld + "\t",
search = stdin.readline()
$ python domainhunter.py < list.txt
bluebells: [X].com [X].net [X].org
itchyscratchy: [X].com [+].net [+].org
muffintops: [X].com [X].net [X].org
smokinjoes: [X].com [X].net [X].org
pizzahut: [X].com [X].net [X].org
I tried it over a list of adjectives, the output was as expected, most of the words were taken, apart from agonizing.org and ossified :)
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home