Skip to content

Instantly share code, notes, and snippets.

@russellbeattie
Created May 10, 2013 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save russellbeattie/5553420 to your computer and use it in GitHub Desktop.
Save russellbeattie/5553420 to your computer and use it in GitHub Desktop.
Cranks up the number of simultaneous requests, but nic.io just barfs at you after a short while.
# works on my machine... OS X 10.8.2, Python v2.7.3
import sys
import subprocess
import multiprocessing
def checkName(q):
proc_name = multiprocessing.current_process().name
print 'Starting process', proc_name
while True:
domain = q.get()
try:
out = subprocess.check_output(['whois', domain])
if 'Not' not in out:
print domain
except Exception as e:
print "Other Exception", e
except KeyboardInterrupt:
return
if __name__ == '__main__':
print 'Starting'
wordlist = 'words.txt'
if len(sys.argv) > 1:
wordlist = sys.argv[1]
procs = 10
queue = multiprocessing.Queue(procs)
p = multiprocessing.Pool(procs, initializer=checkName, initargs=(queue,))
try:
for line in open(wordlist, 'r'):
domain = line.strip() + '.io'
queue.put(domain)
except KeyboardInterrupt:
sys.exit()
finally:
p.terminate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment