diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-02-05 14:33:44 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-02-05 14:33:44 +0100 |
commit | 9a55cd733268ff66c19ff6fead18291ec8342d8c (patch) | |
tree | 9e9c3ad1e88f0e5a34a4a5b705c88b5a697ab7d2 /examples/read_dumpfile.py | |
parent | d864a326d25815a240aa5ac34171e48687311f29 (diff) | |
parent | 6d9b28f2ea07d61a856cf6fddf0bbe0b61e0bdb2 (diff) | |
download | mitmproxy-9a55cd733268ff66c19ff6fead18291ec8342d8c.tar.gz mitmproxy-9a55cd733268ff66c19ff6fead18291ec8342d8c.tar.bz2 mitmproxy-9a55cd733268ff66c19ff6fead18291ec8342d8c.zip |
Merge branch 'master' into tcp_proxy
Diffstat (limited to 'examples/read_dumpfile.py')
-rw-r--r-- | examples/read_dumpfile.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/read_dumpfile.py b/examples/read_dumpfile.py new file mode 100644 index 00000000..547f3c17 --- /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 |