{"id":13600305,"url":"https://github.com/lqqyt2423/go-mitmproxy","last_synced_at":"2025-04-10T23:27:22.659Z","repository":{"id":40358388,"uuid":"315916763","full_name":"lqqyt2423/go-mitmproxy","owner":"lqqyt2423","description":"mitmproxy implemented with golang. 用 Golang 实现的中间人攻击（Man-in-the-middle），解析、监测、篡改 HTTP/HTTPS 流量。","archived":false,"fork":false,"pushed_at":"2025-02-19T10:49:22.000Z","size":6402,"stargazers_count":1316,"open_issues_count":25,"forks_count":236,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-04-03T17:04:50.574Z","etag":null,"topics":["http","http-proxy","https","https-proxy","mitm","mitmproxy"],"latest_commit_sha":null,"homepage":"","language":"Go","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/lqqyt2423.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":"2020-11-25T11:21:17.000Z","updated_at":"2025-04-03T02:46:00.000Z","dependencies_parsed_at":"2024-02-23T10:28:56.244Z","dependency_job_id":"bcb622b9-c534-4581-9f7b-8e6d78fd7c88","html_url":"https://github.com/lqqyt2423/go-mitmproxy","commit_stats":{"total_commits":325,"total_committers":11,"mean_commits":"29.545454545454547","dds":0.08307692307692305,"last_synced_commit":"3fa3915558208266faad738188cf94fb1d0c6bd1"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqqyt2423%2Fgo-mitmproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqqyt2423%2Fgo-mitmproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqqyt2423%2Fgo-mitmproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqqyt2423%2Fgo-mitmproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lqqyt2423","download_url":"https://codeload.github.com/lqqyt2423/go-mitmproxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248314079,"owners_count":21082977,"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":["http","http-proxy","https","https-proxy","mitm","mitmproxy"],"created_at":"2024-08-01T18:00:35.651Z","updated_at":"2025-04-10T23:27:22.625Z","avatar_url":"https://github.com/lqqyt2423.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# go-mitmproxy\n\n[简体中文](./README_CN.md)\n\n`go-mitmproxy` is a Golang implementation of [mitmproxy](https://mitmproxy.org/) that supports man-in-the-middle attacks and parsing, monitoring, and tampering with HTTP/HTTPS traffic.\n\n## Key features\n\n- Parses HTTP/HTTPS traffic and displays traffic details via a [web interface](#web-interface).\n- Supports a [plugin mechanism](#adding-functionality-by-developing-plugins) for easily extending functionality. Various event hooks can be found in the [examples](./examples) directory.\n- HTTPS certificate handling is compatible with [mitmproxy](https://mitmproxy.org/) and stored in the `~/.mitmproxy` folder. If the root certificate is already trusted from a previous use of `mitmproxy`, `go-mitmproxy` can use it directly.\n- Map Remote and Map Local support.\n- HTTP/2 support.\n- Refer to the [configuration documentation](#additional-parameters) for more features.\n\n## Unsupported features\n\n- Only supports setting the proxy manually in the client, not transparent proxy mode.\n- Currently does not support WebSocket protocol parsing.\n\n\u003e For more information on the difference between manually setting a proxy and transparent proxy mode, please refer to the mitmproxy documentation for the Python version: [How mitmproxy works](https://docs.mitmproxy.org/stable/concepts-howmitmproxyworks/). go-mitmproxy currently supports \"Explicit HTTP\" and \"Explicit HTTPS\" as mentioned in the article.\n\n## Command Line Tool\n\n### Installation\n\n```bash\ngo install github.com/lqqyt2423/go-mitmproxy/cmd/go-mitmproxy@latest\n```\n\n### Usage\n\nUse the following command to start the go-mitmproxy proxy server:\n\n```bash\ngo-mitmproxy\n```\n\nAfter starting, the HTTP proxy address is set to port 9080 by default, and the web interface is set to port 9081 by default.\n\nThe certificate needs to be installed after the first startup to parse HTTPS traffic. The certificate will be automatically generated after the first startup command and stored in `~/.mitmproxy/mitmproxy-ca-cert.pem`. Installation steps can be found in the Python mitmproxy documentation: [About Certificates](https://docs.mitmproxy.org/stable/concepts-certificates/).\n\n### Additional Parameters\n\nou can use the following command to view more parameters of go-mitmproxy:\n\n```bash\ngo-mitmproxy -h\n```\n\n```txt\nUsage of go-mitmproxy:\n  -addr string\n    \tproxy listen addr (default \":9080\")\n  -allow_hosts value\n    \ta list of allow hosts\n  -cert_path string\n    \tpath of generate cert files\n  -debug int\n    \tdebug mode: 1 - print debug log, 2 - show debug from\n  -f string\n    \tRead configuration from file by passing in the file path of a JSON configuration file.\n  -ignore_hosts value\n    \ta list of ignore hosts\n  -map_local string\n    \tmap local config filename\n  -map_remote string\n    \tmap remote config filename\n  -proxyauth string\n        enable proxy authentication. Format: \"username:pass\", \"user1:pass1|user2:pass2\",\"any\" to accept any user/pass combination\n  -ssl_insecure\n    \tnot verify upstream server SSL/TLS certificates.\n  -upstream string\n    \tupstream proxy\n  -upstream_cert\n    \tconnect to upstream server to look up certificate details (default true)\n  -version\n    \tshow go-mitmproxy version\n  -web_addr string\n    \tweb interface listen addr (default \":9081\")\n```\n\n## Importing as a package for developing functionalities\n\n### Simple Example\n\n```golang\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/lqqyt2423/go-mitmproxy/proxy\"\n)\n\nfunc main() {\n\topts := \u0026proxy.Options{\n\t\tAddr:              \":9080\",\n\t\tStreamLargeBodies: 1024 * 1024 * 5,\n\t}\n\n\tp, err := proxy.NewProxy(opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Fatal(p.Start())\n}\n```\n\n### Adding Functionality by Developing Plugins\n\nRefer to the [examples](./examples) for adding your own plugins by implementing the `AddAddon` method.\n\nThe following are the currently supported event nodes:\n\n```golang\ntype Addon interface {\n\t// A client has connected to mitmproxy. Note that a connection can correspond to multiple HTTP requests.\n\tClientConnected(*ClientConn)\n\n\t// A client connection has been closed (either by us or the client).\n\tClientDisconnected(*ClientConn)\n\n\t// Mitmproxy has connected to a server.\n\tServerConnected(*ConnContext)\n\n\t// A server connection has been closed (either by us or the server).\n\tServerDisconnected(*ConnContext)\n\n\t// The TLS handshake with the server has been completed successfully.\n\tTlsEstablishedServer(*ConnContext)\n\n\t// HTTP request headers were successfully read. At this point, the body is empty.\n\tRequestheaders(*Flow)\n\n\t// The full HTTP request has been read.\n\tRequest(*Flow)\n\n\t// HTTP response headers were successfully read. At this point, the body is empty.\n\tResponseheaders(*Flow)\n\n\t// The full HTTP response has been read.\n\tResponse(*Flow)\n\n\t// Stream request body modifier\n\tStreamRequestModifier(*Flow, io.Reader) io.Reader\n\n\t// Stream response body modifier\n\tStreamResponseModifier(*Flow, io.Reader) io.Reader\n}\n```\n\n## WEB Interface\n\nYou can access the web interface at http://localhost:9081/ using a web browser.\n\n### Features\n\n- View detailed information of HTTP/HTTPS requests\n- Supports formatted preview of JSON requests/responses\n- Supports binary mode to view response body\n- Supports advanced filtering rules\n- Supports request breakpoint function\n\n### Screenshot Examples\n\n![](./assets/web-1.png)\n\n![](./assets/web-2.png)\n\n![](./assets/web-3.png)\n\n### Sponsor Me\n\nIf you find this project helpful, consider buying me a cup of coffee. Feel free to reach out for any technical inquiries.\n\nThe author is currently unemployed. If you have any full-time or part-time job opportunities, feel free to scan the QR code to add me on WeChat for further discussion.\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth align=\"center\" style=\"width: 240px;\"\u003e\n        \u003cdiv\u003e\n          \u003cimg src=\"./assets/sponsor-me.jpeg\" height=\"200px\" alt=\"WeChat QR Code for Sponsorship\"\u003e\u003cbr\u003e\n          \u003csub\u003eWeChat QR Code for Sponsorship\u003c/sub\u003e\n        \u003c/div\u003e\n      \u003c/th\u003e\n      \u003cth align=\"center\" style=\"width: 240px;\"\u003e\n        \u003cdiv\u003e\n          \u003cimg src=\"./assets/wx.jpg\" height=\"200px\" alt=\"Contact Me\"\u003e\u003cbr\u003e\n          \u003csub\u003eContact Me\u003c/sub\u003e\n        \u003c/div\u003e\n      \u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n\u003c/table\u003e\n\n## License\n\n[MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flqqyt2423%2Fgo-mitmproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flqqyt2423%2Fgo-mitmproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flqqyt2423%2Fgo-mitmproxy/lists"}