2014-02-04 18:10:55 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
|
|
|
# Simple script showing how to read a mitmproxy dump file
|
|
|
|
#
|
|
|
|
|
|
|
|
from libmproxy import flow
|
2015-05-30 00:03:28 +00:00
|
|
|
import json
|
|
|
|
import sys
|
2014-02-04 18:10:55 +00:00
|
|
|
|
2015-08-16 23:29:24 +00:00
|
|
|
with open(sys.argv[1], "rb") as logfile:
|
2014-09-08 14:02:31 +00:00
|
|
|
freader = flow.FlowReader(logfile)
|
2014-02-04 18:10:55 +00:00
|
|
|
try:
|
2014-09-08 14:02:31 +00:00
|
|
|
for f in freader.stream():
|
|
|
|
print(f)
|
|
|
|
print(f.request.host)
|
2014-09-16 23:35:14 +00:00
|
|
|
json.dump(f.get_state(), sys.stdout, indent=4)
|
2015-05-30 03:17:48 +00:00
|
|
|
print("")
|
2015-05-30 00:03:28 +00:00
|
|
|
except flow.FlowReadError as v:
|
2014-09-16 23:35:14 +00:00
|
|
|
print "Flow file corrupted. Stopped loading."
|