All Projects → synchronizing → mitm

synchronizing / mitm

Licence: MIT License
👨🏼‍💻 ‎‎‎‏‏ A customizable man-in-the-middle TCP proxy.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to mitm

sanic-url-shortener
Example of how to use Sanic and asyncpg (PostgreSQL)
Stars: ✭ 16 (-63.64%)
Mutual labels:  asyncio
Sharingan
We will try to find your visible basic footprint from social media as much as possible - 😤 more sites is comming soon
Stars: ✭ 13 (-70.45%)
Mutual labels:  asyncio
python-libmaas
Official python client library for MAAS
Stars: ✭ 45 (+2.27%)
Mutual labels:  asyncio
aiodogstatsd
An asyncio-based client for sending metrics to StatsD with support of DogStatsD extension
Stars: ✭ 26 (-40.91%)
Mutual labels:  asyncio
aiolimiter
An efficient implementation of a rate limiter for asyncio.
Stars: ✭ 121 (+175%)
Mutual labels:  asyncio
wot-py
WoTPy is an experimental implementation of a W3C Web of Things runtime
Stars: ✭ 22 (-50%)
Mutual labels:  asyncio
aiohttp-jwt
aiohttp middleware and helper utils for working with JSON web token.
Stars: ✭ 70 (+59.09%)
Mutual labels:  asyncio
hypercorn-fastapi-docker
Docker image with Hypercorn for FastAPI apps in Python 3.7, 3.8, 3.9. Ready for HTTP2 and HTTPS
Stars: ✭ 18 (-59.09%)
Mutual labels:  asyncio
rigor
HTTP-based DSL for for validating RESTful APIs
Stars: ✭ 65 (+47.73%)
Mutual labels:  asyncio
aiorabbit
An AsyncIO RabbitMQ client for Python 3
Stars: ✭ 18 (-59.09%)
Mutual labels:  asyncio
fastapi-boilerplate
FastAPI boilerplate for real world production
Stars: ✭ 145 (+229.55%)
Mutual labels:  asyncio
aiosqlite3
sqlite3 on asyncio use loop.run_in_executor proxy
Stars: ✭ 21 (-52.27%)
Mutual labels:  asyncio
aioimaplib
Python asyncio IMAP4rev1 client library
Stars: ✭ 77 (+75%)
Mutual labels:  asyncio
service-identity
Service Identity Verification for Python
Stars: ✭ 78 (+77.27%)
Mutual labels:  mitm
fastapi-sqlalchemy-1.4-async
https://rogulski.it/blog/sqlalchemy-14-async-orm-with-fastapi/
Stars: ✭ 17 (-61.36%)
Mutual labels:  asyncio
waio
Is a pretty simple and fully asynchronous framework for WhatsApp Business API written in Python 3.7 with asyncio and aiohttp.
Stars: ✭ 18 (-59.09%)
Mutual labels:  asyncio
mitm-python
A simple as possible man in the middle written in python using scapy
Stars: ✭ 6 (-86.36%)
Mutual labels:  mitm
AmimeWatch
Telegram bot made in Python 3 using the @pyrogram framework.
Stars: ✭ 19 (-56.82%)
Mutual labels:  asyncio
PepperBot
An intuitive multi-platform bot framework, write once, run everywhere. 一个符合直觉的跨社交平台机器人框架,轻松地在平台间传递消息,支持QQ、微信
Stars: ✭ 21 (-52.27%)
Mutual labels:  asyncio
findssh
Asyncio concurrent Python finds SSH servers (or other services with open ports) on an IPv4 subnet, WITHOUT NMAP
Stars: ✭ 36 (-18.18%)
Mutual labels:  asyncio

👨‍💻 mitm

A customizable man-in-the-middle TCP proxy with out-of-the-box support for HTTP & HTTPS¹.

Installing

pip install mitm

Note that OpenSSL 1.1.1 or greater is required.

Documentation

Documentation can be found here.

Using

Using the default values for the MITM class:

from mitm import MITM, protocol, middleware, crypto

mitm = MITM(
    host="127.0.0.1",
    port=8888,
    protocols=[protocol.HTTP],
    middlewares=[middleware.Log],
    buffer_size=8192,
    timeout=5,
    keep_alive=True,
    ssl_context=crypto.mitm_ssl_default_context(),
)
mitm.run()

This will start a proxy on port 8888 that is capable of intercepting all HTTP traffic (with support for CONNECT), and log all activity.

Protocols

mitm comes with a set of built-in protocols, and a way to add your own. Protocols and are used to implement custom application-layer protocols that interpret and route traffic. Out-of-the-box HTTP is available.

Middlewares

Middleware are used to implement event-driven behavior as it relates to the client and server connection. Out-of-the-box Log is available.

Example

Using the example above we can send a request to the server via another script:

import requests

proxies = {"http": "http://127.0.0.1:8888", "https": "http://127.0.0.1:8888"}
requests.get("https://httpbin.org/anything", proxies=proxies, verify=False)

Which will lead to the following being logged where mitm is running in:

2022-02-27 12:19:40 INFO     MITM server started on 127.0.0.1:8080.
2022-02-27 12:19:42 INFO     Client 127.0.0.1:53033 has connected.
2022-02-27 12:19:42 INFO     Client 127.0.0.1:53033 to mitm:

	b'CONNECT httpbin.org:443 HTTP/1.0\r\n\r\n'

2022-02-27 12:19:42 INFO     Connected to server 52.55.211.119:443.
2022-02-27 12:19:42 INFO     Client 127.0.0.1:53033 to server 52.55.211.119:443:

	b'GET /anything HTTP/1.1\r\nHost: httpbin.org\r\nUser-Agent: python-requests/2.26.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n'

2022-02-27 12:19:42 INFO     Server 52.55.211.119:443 to client 127.0.0.1:53033:

	b'HTTP/1.1 200 OK\r\nDate: Sun, 27 Feb 2022 17:19:42 GMT\r\nContent-Type: application/json\r\nContent-Length: 396\r\nConnection: keep-alive\r\nServer: gunicorn/19.9.0\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Credentials: true\r\n\r\n{\n  "args": {}, \n  "data": "", \n  "files": {}, \n  "form": {}, \n  "headers": {\n    "Accept": "*/*", \n    "Accept-Encoding": "gzip, deflate", \n    "Host": "httpbin.org", \n    "User-Agent": "python-requests/2.26.0", \n    "X-Amzn-Trace-Id": "Root=1-621bb2ae-38b24f564e3a026c13e948b6"\n  }, \n  "json": null, \n  "method": "GET", \n  "origin": "xx.xxx.xxx.xxx", \n  "url": "https://httpbin.org/anything"\n}\n'

2022-02-27 12:19:47 INFO     Server 52.55.211.119:443 has disconnected.
2022-02-27 12:19:47 INFO     Client 127.0.0.1:53033 has disconnected.

[1] Note that by "HTTPS" we mean a proxy that supports the CONNECT statement and not one that instantly performs a TLS handshake on connection with the client (before a valid HTTP/1.1 exchange). mitm is flexible enough that this can be added if needed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].