Created
July 17, 2018 09:10
-
-
Save metebalci/0348c514901b8d465140fd491373d988 to your computer and use it in GitHub Desktop.
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 | |
import dns.message | |
import dns.name | |
import dns.query | |
import dns.rdatatype | |
ns = "8.8.8.8" | |
q = dns.message.make_query( | |
dns.name.from_text("www.metebalci.com"), | |
dns.rdatatype.A) | |
# enable EDNS and set DO bit | |
q.want_dnssec() | |
ans = dns.query.udp(q, ns) | |
for rrset in ans.answer: | |
for rr in rrset: | |
# lets print also the qtype of each rr | |
print('%s %s' % ( | |
dns.rdatatype.to_text(rrset.rdtype), | |
rr.to_text())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment