[Python] Python. Socket vs Scapy

Discussão em 'Python' iniciado por Stack, Março 4, 2025.

  1. Stack

    Stack Membro Participativo

    I want to do a script for get all hostnames from IP addresses of my internal DNS. I have used socket.gethostbyaddr(ip) and I got always the correct answer but when I try to do it with Scapy with PTR requests I got wrong values:

    res = scapy.sr1(scapy.IP(dst=dns)/scapy.UDP()/scapy.DNS(rd=1,qd=scapy.DNSQR(qname=str(ipaddress.ip_address(ip).reverse_pointer), qtype='PTR')), verbose=0)


    what it is the difference between two methods?

    regards,

    Continue reading...

Compartilhe esta Página