diff --git a/examples/read_dumpfile.py b/examples/read_dumpfile.py new file mode 100644 index 000000000..547f3c17f --- /dev/null +++ b/examples/read_dumpfile.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# +# Simple script showing how to read a mitmproxy dump file +# + +from libmproxy import flow +import json, sys + +with open("logfile", "rb") as f: + freader = flow.FlowReader(f) + try: + for i in freader.stream(): + print i.request.host + json.dump(i._get_state(), sys.stdout, indent=4) + print "" + except flow.FlowReadError, v: + print "Flow file corrupted. Stopped loading." \ No newline at end of file diff --git a/libmproxy/dump.py b/libmproxy/dump.py index 7b54f7c1c..6cf5e688e 100644 --- a/libmproxy/dump.py +++ b/libmproxy/dump.py @@ -223,8 +223,7 @@ class DumpMaster(flow.FlowMaster): def run(self): # pragma: no cover if self.o.rfile and not self.o.keepserving: - for script in self.scripts: - self.unload_script(script) + self.shutdown() return try: return flow.FlowMaster.run(self)