Skip to content

Instantly share code, notes, and snippets.

@zupo
Created April 29, 2016 11:13
Show Gist options
  • Save zupo/ac4d642ff2d27d2928e9459e3a7f9f41 to your computer and use it in GitHub Desktop.
Save zupo/ac4d642ff2d27d2928e9459e3a7f9f41 to your computer and use it in GitHub Desktop.
Count how many top 1 million Alexa sites do not have MX records set
import dns.resolver
from tomorrow import threads
@threads(100)
def mx(id_, domain):
try:
dns.resolver.query(domain, 'MX')
return False
except dns.resolver.NoAnswer:
print '[{}] Found domain without MX: {}'.format(id_, domain)
return True
if __name__ == "__main__":
with open('top.csv') as f:
results = [mx(line.strip('\n').split(',')[0], line.strip('\n').split(',')[1]) for line in f.readlines()]
print results.count(True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment