Skip to content

Instantly share code, notes, and snippets.

@akirayou
Created Jul 26, 2021
Embed
What would you like to do?
from scapy.all import *
def r(a):
if(a[3].qd is None):return
if( not 1 == a[3].qd.qtype):return
qname=a[3].qd.qname
print(qname.decode('utf-8'))
an=DNSRR(rrname=qname,type="A",rclass=0x8001,rdata="192.168.1.107",ttl=120)
d=DNS(id=0,qr=1,aa=1,ancount=1,rd=0,an=an)
print(d)
send(IP(dst="224.0.0.251",ttl=255)/UDP(dport=5353, sport=5353)/d)
sniff(filter="udp and port 5353",prn=r,count=10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment