{"id":16544804,"url":"https://github.com/synchronizing/mitm","last_synced_at":"2025-04-13T02:10:39.075Z","repository":{"id":37645941,"uuid":"192709769","full_name":"synchronizing/mitm","owner":"synchronizing","description":"👨🏼‍💻‎‎‎‏‏ A customizable man-in-the-middle TCP intercepting proxy.","archived":false,"fork":false,"pushed_at":"2025-01-19T02:34:46.000Z","size":272,"stargazers_count":128,"open_issues_count":0,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-04T04:10:02.910Z","etag":null,"topics":["asyncio","mitm","proxy","python"],"latest_commit_sha":null,"homepage":"https://synchronizing.github.io/mitm/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/synchronizing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-19T10:20:02.000Z","updated_at":"2025-03-02T22:10:04.000Z","dependencies_parsed_at":"2023-01-22T04:04:09.574Z","dependency_job_id":"0ff60ce0-10e7-4c52-8eae-7b8ee5a0cfe8","html_url":"https://github.com/synchronizing/mitm","commit_stats":{"total_commits":96,"total_committers":1,"mean_commits":96.0,"dds":0.0,"last_synced_commit":"0af09b262db715a80be315502330c098068c5e66"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synchronizing%2Fmitm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synchronizing%2Fmitm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synchronizing%2Fmitm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synchronizing%2Fmitm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/synchronizing","download_url":"https://codeload.github.com/synchronizing/mitm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654090,"owners_count":21140236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","mitm","proxy","python"],"created_at":"2024-10-11T19:04:42.179Z","updated_at":"2025-04-13T02:10:39.017Z","avatar_url":"https://github.com/synchronizing.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 👨‍💻 mitm\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.pepy.tech/projects/mitm\"\u003e\n    \u003cimg src=\"https://static.pepy.tech/badge/mitm\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://github.com/synchronizing/mitm/actions?query=workflow%3ABuild\"\u003e\n    \u003cimg src=\"https://github.com/synchronizing/mitm/workflows/Build/badge.svg?branch=master\u0026event=push\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://synchronizing.github.io/mitm/\"\u003e\n    \u003cimg src=\"https://github.com/synchronizing/mitm/actions/workflows/docs-publish.yaml/badge.svg\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://coveralls.io/github/synchronizing/mitm?branch=master\"\u003e\n    \u003cimg src=\"https://coveralls.io/repos/github/synchronizing/mitm/badge.svg?branch=master\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nA customizable man-in-the-middle TCP proxy with support for HTTP \u0026 HTTPS.\n\n## Installing\n\n```\npip install mitm\n```\n\nNote that OpenSSL 1.1.1 or greater is required.\n\n## Documentation\n\nDocumentation can be found [**here**](https://synchronizing.github.io/mitm/). \n\n## Using\n\nUsing the default values for the `MITM` class:\n\n```python\nfrom mitm import MITM, protocol, middleware, crypto\n\nmitm = MITM(\n    host=\"127.0.0.1\",\n    port=8888,\n    protocols=[protocol.HTTP], \n    middlewares=[middleware.Log], # middleware.HTTPLog used for the example below.\n    certificate_authority = crypto.CertificateAuthority()\n)\nmitm.run()\n```\n\nThis will start a proxy on port `8888` that is capable of intercepting all HTTP traffic (with support for SSL/TLS) and log all activity.\n\n## Extensions\n\n`mitm` can be customized through the implementations of middlewares and protocols. \n\n[Middlewares](https://synchronizing.github.io/mitm/docs/internals.html#mitm.core.Middleware) are event-driven hooks that are called when connections are made, requests are sent, responses are received, and connections are closed. \n\n[Protocols](https://synchronizing.github.io/mitm/docs/internals.html#mitm.core.Protocol) are implementations on _how_ the data flows between the client and server, and is used to implement [application layer](https://en.wikipedia.org/wiki/Application_layer) protocols and/or more complex extensions.\n\n## Example\n\nUsing the example above we can send a request to the server via another script:\n\n```python\nimport requests\n\nproxies = {\"http\": \"http://127.0.0.1:8888\", \"https\": \"http://127.0.0.1:8888\"}\nrequests.get(\"https://httpbin.org/anything\", proxies=proxies, verify=False)\n```\n\nWhich will lead to the following being logged where `mitm` is running in:\n\n```\n2022-06-08 15:07:10 INFO     MITM server started on 127.0.0.1:8888.\n2022-06-08 15:07:11 INFO     Client 127.0.0.1:64638 has connected.\n2022-06-08 15:07:11 INFO     Client 127.0.0.1:64638 to mitm: \n\n→ CONNECT httpbin.org:443 HTTP/1.0\n\n2022-06-08 15:07:12 INFO     Client 127.0.0.1:64638 has connected to server 34.206.80.189:443.\n2022-06-08 15:07:12 INFO     Client 127.0.0.1:64638 to 34.206.80.189:443: \n\n→ GET /anything HTTP/1.1\n→ Host: httpbin.org\n→ User-Agent: python-requests/2.26.0\n→ Accept-Encoding: gzip, deflate\n→ Accept: */*\n→ Connection: keep-alive\n\n2022-06-08 15:07:12 INFO     Server 34.206.80.189:443 to client 127.0.0.1:64638: \n\n← HTTP/1.1 200 OK\n← Date: Wed, 08 Jun 2022 19:07:12 GMT\n← Content-Type: application/json\n← Content-Length: 396\n← Connection: keep-alive\n← Server: gunicorn/19.9.0\n← Access-Control-Allow-Origin: *\n← Access-Control-Allow-Credentials: true\n← \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-62a0f360-774052c80b60f4ea049f5665\"\n←   }, \n←   \"json\": null, \n←   \"method\": \"GET\", \n←   \"origin\": \"xxx.xxx.xxx.xxx\", \n←   \"url\": \"https://httpbin.org/anything\"\n← }\n\n2022-06-08 15:07:27 INFO     Server 34.206.80.189:443 has disconnected.\n2022-06-08 15:07:27 INFO     Client 127.0.0.1:64638 has disconnected.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynchronizing%2Fmitm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynchronizing%2Fmitm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynchronizing%2Fmitm/lists"}