1.MX
#!/usr/bin/env python
import dns.resolver
domain = raw_input(‘please input an domain: ‘)
MX = dns.resolver.query(domain, ‘MX‘)
for i in MX:
print ‘MX preference =‘, i.preference, ‘mail exchanger =‘, i.exchange
2.NS
#/usr/bin/env python
import dns.resolver
domain = raw_input(‘please input an domain: ‘)
ns = dns.resolver.query(domain, ‘NS‘)
for i in ns.response.answer:
for j in i.items:
print j.to_text()
3.A记录
#!/usr/bin/env python
import dns.resolver
domain = raw_input(‘please input an domain: ‘)
A = dns.resolver.query(domain, ‘A‘)
for i in A.response.answer:
for j in i.items:
print j.address
4.CNAME
#!/usr/bin/env python
import dns.resolver
domain = raw_input(‘please input an domain: ‘)
cname = dns.resolver.query(domain, ‘CNAME‘)
for i in cname.response.answer:
for j in i.items:
print j.to_text()
原文地址:http://yzg784534398.blog.51cto.com/9719002/1684039