Skip to content

Instantly share code, notes, and snippets.

@b4ldr
Last active June 9, 2026 16:36
Show Gist options
  • Select an option

  • Save b4ldr/2adaddebd803a3b74635ffb3ff55eb19 to your computer and use it in GitHub Desktop.

Select an option

Save b4ldr/2adaddebd803a3b74635ffb3ff55eb19 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from scapy.all import IP, UDP, DNS, DNSQR, DNSRR, RandShort, send
dns_resp = DNS(
id=0x1234,
qr=1,
opcode=15,
rcode=7,
aa=0,
rd=1,
ra=1,
qdcount=1,
ancount=1,
nscount=0,
arcount=0,
)
packet = IP(
src="104.152.52.205",
dst="199.7.83.42"
) / UDP(
sport=34324,
dport=53
) / dns_resp
packet.show()
# wrpcap("dns_forged.pcap", packet) # Save to pcap for analysis
send(packet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment