diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-02-04 19:10:55 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-02-04 19:10:55 +0100 |
commit | 6d9b28f2ea07d61a856cf6fddf0bbe0b61e0bdb2 (patch) | |
tree | 02c741fb5ceef5f20a463d65137da1dcdaaf66ba /examples | |
parent | fd828bf95981780f5cce300e389c18ca43bfddce (diff) | |
download | mitmproxy-6d9b28f2ea07d61a856cf6fddf0bbe0b61e0bdb2.tar.gz mitmproxy-6d9b28f2ea07d61a856cf6fddf0bbe0b61e0bdb2.tar.bz2 mitmproxy-6d9b28f2ea07d61a856cf6fddf0bbe0b61e0bdb2.zip |
add example to show how to read mitmproxy dump files, refs #207
Diffstat (limited to 'examples')
-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 |