Fixing issue #710. Prety printing in read_dumpfile

This commit is contained in:
FreeArtMan 2015-08-19 09:05:33 +01:00 committed by FreeArtMan
parent cd419300a9
commit 4d9bf45e82
1 changed files with 3 additions and 1 deletions

View File

@ -5,15 +5,17 @@
from libmproxy import flow
import json
import pprint
import sys
with open(sys.argv[1], "rb") as logfile:
freader = flow.FlowReader(logfile)
pp = pprint.PrettyPrinter(indent=4)
try:
for f in freader.stream():
print(f)
print(f.request.host)
json.dump(f.get_state(), sys.stdout, indent=4)
pp.pprint(f.get_state())
print("")
except flow.FlowReadError as v:
print "Flow file corrupted. Stopped loading."