Created
April 7, 2012 03:12
-
-
Save elazar/2324770 to your computer and use it in GitHub Desktop.
Python domain checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import socket | |
import itertools | |
def filter_tlds(x): return x.startswith(".") | |
tlds = set(filter(filter_tlds, sys.argv[1:])) | |
non_tlds = set(sys.argv[1:]).difference(tlds) | |
for permutation in itertools.permutations(non_tlds): | |
domain = "".join(permutation) | |
for tld in tlds: | |
domain_tld = domain + tld | |
try: | |
socket.gethostbyname(domain_tld) | |
print(domain_tld + ": taken") | |
except: | |
print(domain_tld + ": available") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment