Regular use of Mitmproxy
Install the certificate
Just start mitmproxy and configure your target device with the correct proxy settings. Now start a browser on the device, and visit the magic domain mitm.it. Click on the relevant icon to install the certificate.
Note: You should go to the system settings->security->certificates to import the ca. for some android devices.
Mitmproxy’s interception functionality lets you pause an HTTP request or response, inspect and modify it, and then accept it to send it on to the server or client.
ito set an interception filter.eg “~q”. Intercepted connections are indicated with orange text
- View and modify the request:
viewed the request by selecting it, pressed
ato accept the modified request, which is then sent on to the server
Use your own scripts to get the response.
def response(context, flow): flow.response.headers["newheader"] = "foo" if flow.request.host == "eg.com": flow.request.scheme = "http" flow.request.port = 8080 flow.request.path = flow.request.path.replace( "v1/", "v2/")
>>> mitmdump -s test.py
>>> mitmproxy -s test.py