Skip to content

Instantly share code, notes, and snippets.

@remyleone
Created July 25, 2017 17:15
Show Gist options
  • Select an option

  • Save remyleone/7cfd5514a4f7ad73ca8c7a371551e36a to your computer and use it in GitHub Desktop.

Select an option

Save remyleone/7cfd5514a4f7ad73ca8c7a371551e36a to your computer and use it in GitHub Desktop.
import subprocess
import sys
import json
your_command = ["tshark", "-T", "ek", "-x", "-i", "tun0"]
process = subprocess.Popen(your_command, stdout=subprocess.PIPE)
for line in iter(process.stdout.readline, ''):
# We remove blank lines with strip
if line.strip():
d = json.loads(line)
if not "index" in d.keys():
print(d)
print("----------------")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment