tags:

views:

312

answers:

4

I need to check the availability of all short domains that contain a word "hello". It can be anything like "hellohi", "aahellokk" or "hellowhello". I know that there are services, like http://www.bluehost.com/cgi-bin/signup, where you need to type the domains one-by-one. However, I want to bulk-check them. Then, I need to generate a list of words. I mistakenly tested in Zsh:

echo {1..10}hello{A..Z}{5} > test

I don't know what is the easiest way to generate the list of words. How would you check the availability?

+2  A: 

Here is my Python solution. To generate the domains use something like this:

from itertools import product, permutations
import operator

chars = 'abcdefghijklmnopqrstuvwxyz0123456789'
l = 2    # Max prefix / suffix length
words = reduce(operator.add, [[''.join(p) for p in permutations(chars, i)] for i in range(1, l+1)])
domains = [w[0] + 'hello' + w[1] for w in product(words, words)]

This will take ages and use loads of memory if l is larger than 2 or 3. Also, you'll need Python 2.6 for some of the itertools functionality.

To check if the domains are available use this:

import commands

for domain in domains:
    output = commands.getoutput('whois %s.com' % domain).lower()
    if 'not found' in output or 'no match' in output:
        print domain + '.com'

To speed this up you could use threads for the whois check.

HarryM
+1  A: 

If you really want a zsh solution, use e.g. host, dig or nslookup to perform a DNS query, and assume that a failure means that a domain is still available. Keep an eye out for performance: some of these utilities may be faster than others.

If I may ask: what do you need this for? Are you a domain name squatter?

Stephan202
I am only interested.
Masi
Good to hear that.
Stephan202
A: 

For anything but the shortest names and large words, the number of possible domains is extremely large; infeasibly large to create a list of them. For example, for a potential 11-letter domain name that you want to check a 4-letter word for, you're looking at at least 2 BILLION combinations (rough estimate). Of course, if you wanted to check that 11-letter domain name for a 10-letter word, you're looking at just 72 possibilities.

McWafflestix
+1  A: 

you can use this domain search api to check domain name availability