pythonscapyreverse-dns

Reverse dns lookup with scapy in python


How can I do reverse DNS lookup using scapy in Python? I look for it in Google but I couldn't find related to this topic.


Solution

  • Ok. I have found my answerm and I want to share it in here, because someone could look for same thing. One line of code is enough to make a reverse dns query in scapy, which is:

    sr1(IP(dst="8.8.8.8")/UDP()/DNS(rd=1,qd=DNSQR(qname="211.196.59.69.in-addr.arpa", qtype='PTR')))