Skip to content

Instantly share code, notes, and snippets.

@jecsanb
Created October 2, 2019 03:51
Show Gist options
  • Save jecsanb/17d18684daa27f50d61a0449142f535f to your computer and use it in GitHub Desktop.
Save jecsanb/17d18684daa27f50d61a0449142f535f to your computer and use it in GitHub Desktop.
Program used to extract data from pcap file
#! /usr/bin/env python2.7
# -#- coding: utf-8 -#-
# vim:fenc=utf-8
# read.py
# Copyright (C) 2019 Jecsan Blanco <[email protected]>
# Distributed under terms of the MIT license.
from scapy.all import *
def main():
packets = packets = rdpcap('Week5.pcap')
data = ""
for packet in packets:
query = str(packet[DNSQR].qname)
if 'fakedns' in query:
data += query.split('.')[0]
print(data)
return
# end main
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment