[Python] Python - dig ANY equivalent with scapy module

Discussão em 'Python' iniciado por Stack, Fevereiro 3, 2025.

  1. Stack

    Stack Membro Participativo

    I want to use the Python module scapy to perform an equivalent command of

    dig ANY google.com @8.8.4.4 +notcp


    I've made a simple example code:

    from scapy.all import *

    a = sr(IP(dst="8.8.4.4")/UDP(sport=RandShort(),dport=53)/DNS(qd=DNSQR(qname="google.com",qtype="ALL",qclass="IN")))

    print str(a[0])


    And it sends and receives a packet, but when I sniffed the packet the response says Server failure.

    Wireshark Screenshot - scapy

    Wireshark Screenshot - dig

    Sniffing the dig command itself, looks nearly the same but it gives me a correct response and also it does not send another ICMP - Destination unreachable Packet.. this only comes up when sending it with scapy.

    If you need more information, feel free to ask. Maybe someone can help me with this..

    EDIT:

    Maybe the ICMP - Destination unreachable packet were send because 8.8.4.4 tries to send the response to my sport, which is closed? But why should dig then work?!

    Continue reading...

Compartilhe esta Página