Skip to content

Instantly share code, notes, and snippets.

@giwa
Last active August 29, 2015 14:23
Show Gist options
  • Save giwa/532a9f8342f7eba1ffb3 to your computer and use it in GitHub Desktop.
Save giwa/532a9f8342f7eba1ffb3 to your computer and use it in GitHub Desktop.
お手軽DeepPacketInspection ref: http://qiita.com/giwa/items/795f56d2137254d7bcdc
$ git clone https://github.com/KimiNewt/pyshark.git
$ cd pyshark/src
$ python setup.py install
import pyshark
for p in pyshark.FileCapture(pcap_file, display_filter='http'):
try:
if p.http.request_method == 'GET':
print(p.eth.src)
print(p.eth.dst)
print(p.ip.src)
print(p.ip.dst)
print(p.tcp.srcport)
print(p.tcp.dstport)
print(p.http.host)
print(p.http.request_full_uri)
print(p.sniff_time)
except AttributeError as e:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment