mitmΒΆ
from mitm import MITM
Man-in-the-middle.
- class MITM[source]ΒΆ
Man-in-the-middle server.
- __init__(host, port, protocols, middlewares, certificate_authority, run)[source]ΒΆ
Initializes the MITM class.
- Parameters:
host (
str) β Host to listen on. Defaults to127.0.0.1.port (
int) β Port to listen on. Defaults to8888.protocols (
Optional[List[Protocol]]) β List of protocols to use. Defaults to[protocol.HTTP].middlewares (
Optional[List[Middleware]]) β List of middlewares to use. Defaults to[middleware.Log].certificate_authority (
Optional[CertificateAuthority]) β Certificate authority to use. Defaults toCertificateAuthority().run (
bool) β Whether to start the server immediately. Defaults toFalse.
Example
from mitm import MITM mitm = MITM() mitm.run()
- async entry()[source]ΒΆ
Entry point for the MITM class.
The server is started by using asyncio.start_server function like so:
... server = await asyncio.start_server( lambda reader, writer: self.mitm( Connection( client=Host(reader=reader, writer=writer), server=Host(), ) ), host=self.host, port=self.port, ) ...