aboutsummaryrefslogtreecommitdiffstats
path: root/examples/read_dumpfile.py
blob: 547f3c17f99ba52459e9bcf3e185fa7a6cb3cebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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."