Skip to content

Instantly share code, notes, and snippets.

@kbandla
Created July 23, 2015 02:05
Show Gist options
  • Save kbandla/1f842398c1a329eb3c50 to your computer and use it in GitHub Desktop.
Save kbandla/1f842398c1a329eb3c50 to your computer and use it in GitHub Desktop.
( 32c3b3810d26dfeb83bf4d6eb3271f4b )
import dpkt
f = open('dns.pcap')
pcap = dpkt.pcap.Reader(f)
for ts, buf in pcap:
eth = dpkt.ethernet.Ethernet(buf)
ip = eth.data
udp = ip.data
dns = dpkt.dns.DNS(udp.data)
print (dns.qd)
for x in dns.qd:
print (x.name)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment