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 send and recieve a packet,
but when I sniffed the packet the response says Server failure
.
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
, wich is closed? But why should dig
then work?!