extension#

from mitm import extension

Built-in extensions for mitm.


Middlewares#

class Log[source]#

Middleware that logs all events to the console.

class HTTPLog(Log)[source]#

Middlewares that logs all HTTP events to the console with pretty-print.

Notes

Do not use this middleware if there is a chance that the request or response will not be HTTP. This should only be used if you have control of all the requests coming into the proxy. If you are setting your computer’s proxy settings to mitm you should not use this middleware as things will not work.


Protocols#

class HTTP[source]#

Adds support for HTTP protocol (with TLS support).

This protocol adds HTTP and HTTPS proxy support to the mitm. Note that by “HTTPS proxy” we mean a proxy that supports the CONNECT statement, and not one that instantly performs a TLS handshake on connection with the client (though this can be added if needed).

bytes_needed is set to 8192 to ensure we can read the first line of the request. The HTTP/1.1 protocol does not define a minimum length for the first line, so we use the largest number found in other projects.