Skip to content

Instantly share code, notes, and snippets.

@rinti
Created September 15, 2014 07:12
Show Gist options
  • Save rinti/93d88878c5243e3c32b3 to your computer and use it in GitHub Desktop.
Save rinti/93d88878c5243e3c32b3 to your computer and use it in GitHub Desktop.
"""
Check all possible permutations with a given length.
Dependencies: python-whois
Usage:
./domains.py <length> <timeout> <tld>
* Length: How many characters the domain name should be
* Timeout: How fast between checkups to whois (recommended: 2, to not get throttled)
* tld: tld.
"""
import whois
import itertools
import time
import sys
permutations = list(itertools.product(list("abcdefghijklmnopqrstuwxyz"), repeat=int(sys.argv[1])))
available = []
for p in permutations:
domain = "".join(p) + str(sys.argv[3])
w = whois.whois(domain)
if not w.registrar:
available.append(domain)
print available
else:
print "Not available", domain, w.registrar
time.sleep(float(sys.argv[2]))
print available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment