Created
April 29, 2016 11:13
-
-
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
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
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