From 9286f5b5b4d9483d0d8e7fa0fb4c27961cd236be Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 17 Aug 2015 11:29:24 +1200 Subject: Small tweaks to read_dumpfile example. --- examples/read_dumpfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 examples/read_dumpfile (limited to 'examples') diff --git a/examples/read_dumpfile b/examples/read_dumpfile old mode 100644 new mode 100755 index 2238d2d2..ecddc65d --- a/examples/read_dumpfile +++ b/examples/read_dumpfile @@ -7,7 +7,7 @@ from libmproxy import flow import json import sys -with open("logfile", "rb") as logfile: +with open(sys.argv[1], "rb") as logfile: freader = flow.FlowReader(logfile) try: for f in freader.stream(): -- cgit v1.2.3 From 4d9bf45e822396a1d43a2e7712046681f5d433ac Mon Sep 17 00:00:00 2001 From: FreeArtMan <=> Date: Wed, 19 Aug 2015 09:05:33 +0100 Subject: Fixing issue #710. Prety printing in read_dumpfile --- examples/read_dumpfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/read_dumpfile b/examples/read_dumpfile index ecddc65d..eb1c93bb 100755 --- a/examples/read_dumpfile +++ b/examples/read_dumpfile @@ -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." -- cgit v1.2.3