How can I check for short domains containing a word?
I need to check for all short domains containing the word "hello". It could be something like "hellohi", "aahellokk", or "hellowhello". I know there are services like http://www.bluehost.com/cgi-bin/signup where you have to enter domains one by one. However, I want to test them in bulk. Then I need to generate a list of words. I tested wrongly in Zsh:
echo {1..10}hello{A..Z}{5} > test
I don't know what is the simplest way to generate a list of words. How can you check availability?
a source to share
Here is my Python solution. Use something like this to create domains:
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)]
It will take a long time and will use a lot of memory if l
more than 2 or 3. Also, itertools
you will need Python 2.6 for some functions .
To check if 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 can use whois streams.
a source to share
If you really want a solution zsh, use, for example host
, dig
or nslookup
to perform the DNS query, and assume that the rejection means that the domain is still available. Watch for efficiency: some of these utilities may be faster than others.
If I may ask: why do you need this? Are you a domain name squatter?
a source to share
For all but the shortest names and big words, the number of possible domains is extremely large; to create a list of them. For example, for a potential 11-letter domain name that you want to validate a 4-letter word for, you're looking at a combination of at least 2 billion (rough estimate). Of course, if you want to check that 11 letter domain name for a 10 letter word, you're only looking at 72 options.
a source to share