I wrote a code that creates a dns packet and sends it. The packet simulates the nslookup -type=soa facebook.com 8.8.8.8
command for example.
But for some reason I get a different answer from what the 'nslookup' command returns.
my code dns server output: "a.ns.c10r.facebook.com"
the dns server from nslookup -type=soa facebook.com 8.8.8.8
command: "a.ns.facebook.com"
- my final goal is to get a site dns server so I would be able to get an authoritative answer for the site ip address with a dns packet.
this is my code:
from scapy.all import *
from scapy.layers.dns import DNS, DNSQR
from scapy.layers.inet import IP, UDP
def main():
dns_server_request = IP(dst='8.8.8.8') / UDP(dport=53) / DNS(rd=1, qd=DNSQR(qname='www.facebook.com', qtype='SOA'))
ans = sr1(dns_server_request, verbose=0)
ans.show()
if __name__ == "__main__":
main()
someone know what am I doing wrong and how can I fix it?
- (the dns server that my code is giving not working by the way)