Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import subprocess
  2.  
  3. good_dns = []
  4. with open('/home/qs/utils/massdns/lists/public-dns.resolvers') as f:
  5. servers = f.read().splitlines()
  6. i = 0
  7. for dns in servers:
  8. # print 'server:'+dns
  9. res = '1'
  10. try:
  11. res = subprocess.check_output(["dig", "+short", "@"+dns,"googleewewwewewewewe.com"], timeout=1)
  12. # print (res)
  13. except Exception as e:
  14. print (dns +"\t\t" +str(e))
  15. continue
  16. # print (res)
  17. if res == b'':
  18. good_dns.append(dns)
  19. print (dns)
  20. print (good_dns)
  21. with open('/tmp/good_dns.txt', mode='wt', encoding='utf-8') as myfile:
  22. myfile.write('\n'.join(good_dns))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement