Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- good_dns = []
- with open('/home/qs/utils/massdns/lists/public-dns.resolvers') as f:
- servers = f.read().splitlines()
- i = 0
- for dns in servers:
- # print 'server:'+dns
- res = '1'
- try:
- res = subprocess.check_output(["dig", "+short", "@"+dns,"googleewewwewewewewe.com"], timeout=1)
- # print (res)
- except Exception as e:
- print (dns +"\t\t" +str(e))
- continue
- # print (res)
- if res == b'':
- good_dns.append(dns)
- print (dns)
- print (good_dns)
- with open('/tmp/good_dns.txt', mode='wt', encoding='utf-8') as myfile:
- myfile.write('\n'.join(good_dns))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement