Skip to content

Instantly share code, notes, and snippets.

@zPrototype
Last active February 14, 2020 10:32
Show Gist options
  • Save zPrototype/a4f2d326c2c2963d407f74953a3b3586 to your computer and use it in GitHub Desktop.
Save zPrototype/a4f2d326c2c2963d407f74953a3b3586 to your computer and use it in GitHub Desktop.
Fun with scapy
from scapy.all import *
def emptyLine():
print("****************************************")
Url = input("Enter domain name: ")
emptyLine()
dnsResponse = sr1(IP(dst="8.8.8.8") / UDP(dport=53) / DNS(rd=1, qd=DNSQR(qname=Url)))
emptyLine()
print(dnsResponse.summary())
emptyLine()
print("Name:", dnsResponse[DNS].name)
emptyLine()
print(repr(dnsResponse[DNS]))
emptyLine()
print("Layers:", dnsResponse[DNS].ancount)
emptyLine()
for i in range(dnsResponse[DNS].ancount):
print(dnsResponse[DNSRR][i].rdata)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment