Last active
June 8, 2016 00:13
-
-
Save csabatini/ef84edaa7b8f041c80b17991cc45d10d to your computer and use it in GitHub Desktop.
This file contains hidden or 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/python2 | |
import subprocess, re | |
import sys | |
from collections import Counter | |
urls = [] | |
with open('hosts.txt', 'r') as f: | |
for line in f: | |
urls.append('%s.blob.core.windows.net' % line.strip()) | |
cnames = [] | |
for url in urls: | |
process = subprocess.Popen(["nslookup", url], stdout=subprocess.PIPE) | |
out = process.communicate()[0].split('\n') | |
for row in out: | |
if 'Name' in row: | |
fqdn = re.sub('\s+(?!$)','',row.replace('Name:','')) | |
print url + ' : ' + fqdn | |
cnames.append(fqdn) | |
c = Counter(cnames) | |
print '\nNon-unique Storage Stamps\n===========' | |
for k, v in c.iteritems(): | |
if (v > 1): | |
print k + ' was found %s times' % v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment