python live data tracing similar to wireshark

INSTALLATION

>> pip install pyshark

import pyshark
capture = pyshark.LiveCapture(interface='eth0')
capture.sniff(timeout=50)
print(capture)
f = ("layers.txt", "w")
if len(capture) > 0:
for packet in capture:
val = packet.__dict__['layers']
print(str(val)
f.writelines(val)
eg. example for traced data

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store