Skip to content

Instantly share code, notes, and snippets.

@russellbeattie
Created February 20, 2013 07:22
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/4993614 to your computer and use it in GitHub Desktop.
Save russellbeattie/4993614 to your computer and use it in GitHub Desktop.
Script to check .io domains to see if they're being used for anything... Works through a word list, checks to see if it's just being redirected or not, then if not, prints out the domain and title of the page (which could give a clue to what it's used for).
# works on my machine... OS X 10.8.2, Python v2.7.3
# use the wordlist here: https://gist.github.com/russellbeattie/4982393#file-words-txt
import sys
import subprocess
import re
import urllib2
wordlist = 'words.txt'
if len(sys.argv) > 1:
wordlist = sys.argv[1]
for line in open(wordlist, 'r'):
domain = line.strip() + '.io'
out = subprocess.check_output(['whois', domain])
if 'Not' in out:
url = 'http://' + domain
try:
usock = urllib2.urlopen(url, timeout=5)
except:
continue
data = usock.read()
newurl = usock.geturl()
usock.close()
if domain in newurl:
try:
title = re.search('<title>(.*)</title>', data, re.IGNORECASE).group(1)
print domain + ' - ' + newurl + ' - ' + title
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment