Skip to content

Instantly share code, notes, and snippets.

@davexpro
Created May 2, 2015 05:13
Show Gist options
  • Save davexpro/a70383f3e7c21f82d32e to your computer and use it in GitHub Desktop.
Save davexpro/a70383f3e7c21f82d32e to your computer and use it in GitHub Desktop.
#!/user/bom/env python
# coding=utf8
# author=davex@vip.qq.com
# create=20150502
__author__ = 'Dave'
import dns.resolver
def get_dns_a(domain):
print "[+] A Records"
A = dns.resolver.query(domain, 'A')
for i in A.response.answer:
for j in i.items:
if j.rdtype == 1:
print j.address
else:
pass
def get_dns_ns(domain):
print "[+] NS Records"
NS = dns.resolver.query(domain, 'NS')
for i in NS.response.answer:
for j in i.items:
print j
if __name__ == '__main__':
domain = raw_input('please input an domain:')
get_dns_a(domain)
get_dns_ns(domain)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment