|# Simple script showing how to read a mitmproxy dump file|
|### UPD: this feature is now avaiable in mitmproxy: https://github.com/mitmproxy/mitmproxy/pull/619|
|from libmproxy import flow|
|import json, sys|
|with open("mitmproxy_dump.txt", "rb") as logfile:|
|freader = flow.FlowReader(logfile)|
|for f in freader.stream():|
|request = f.request|
|curl = 'curl -X ' + request.method + ' -d \'' + request.content + '\' ' + ' '.join(['-H ' + '"' + header + ': ' + header + '"' for header in request.headers])|
|curl += " https://" + request.host + request.path|
|except flow.FlowReadError as v:|
|print("Flow file corrupted. Stopped loading.")|
I'm trying to get this script installed and I am not sure what I am doing wrong. I get the following error.
I have tried installing netlib with pip
and by cloning from the git repo and installing
neither are working. is there something else I need to do to get this script to work?