h4cker/programming_and_scripting_for_cybersecurity/exploitation/pyshark_example.py

16 lines
572 B
Python
Raw Permalink Normal View History

2019-03-31 04:42:14 +00:00
#!/usr/bin/python
# Author: Omar Santos @santosomar
# version 1.0
# This is a quick demonstration on how to use the python pyshark library
# * Pre-requisite: pyshark python library.
# * Install it with pip install pyshark
# PyShark is a Python wrapper for tshark,
# allowing python packet parsing using wireshark dissectors.
#####################################################################
import pyshark
2019-03-31 17:39:20 +00:00
capture = pyshark.LiveCapture(interface='eth0')
2019-03-31 04:58:58 +00:00
for packet in capture.sniff_continuously(packet_count=5):
2019-03-31 04:59:47 +00:00
print ('You just captured a packet:', packet)