Go to file
lqqyt2423 6bb96b85ff web addon frontend fix breakpoint and fix send message
addon web addon frontend fix breakpoint and fix send message
cert fix Race conditions
cmd optimize web addon content-length showing
flow chore: message protocol backend
proxy chore: CloseWrite
.gitignore testserver
LICENSE Create LICENSE
Makefile web addon config
README.md readme
go.mod use net.Pipe()
go.sum use net.Pipe()

README.md

go-mitmproxy

mitmproxy implemented with golang.

用 Golang 实现的中间人攻击(Man-in-the-middle),解析、监测、篡改 HTTP/HTTPS 流量。

特点

  • HTTPS 证书相关逻辑参考 mitmproxy 且与之兼容,根证书也保存在 ~/.mitmproxy 文件夹中,如果之前用过 mitmproxy 且根证书已经安装信任,则此 go-mitmproxy 可以直接使用
  • 支持插件机制,很方便扩展自己需要的功能,可参考 addon/addon.go
  • 性能优势
    • Golang 天生的性能优势
    • 在进程内存中转发解析 HTTPS 流量,不需通过 tcp端口 或 unix socket 等进程间通信
    • 生成不同域名证书时使用 LRU 缓存,避免重复计算
  • 通过环境变量 SSLKEYLOGFILE 支持 Wireshark 解析分析流量
  • 上传/下载大文件时支持流式传输
  • WEB 界面:http://localhost:9081

安装

GO111MODULE=on go get -u github.com/lqqyt2423/go-mitmproxy/cmd/mitmproxy

命令行使用

mitmproxy --help

Usage of mitmproxy:
  -addr string
    	proxy listen addr (default ":9080")
  -dump string
    	dump filename
  -dump_level int
    	dump level: 0 - header, 1 - header + body
  -web_addr string
    	web interface listen addr (default ":9081")

作为包引入

参考 cmd/mitmproxy/main.go,可通过自己实现 AddAddon 方法添加自己实现的插件。

TODO

  • http handler
  • http connect
  • cert
  • https handler
  • logger
  • 经内存转发 https 流量
  • 忽略某些错误例如broken pipe, reset by peer, timeout
  • websocket 透明转发
  • 插件机制
  • 命令行参数控制 dump 至文件
  • dump level
  • 文档
  • web 界面
  • Content-Encoding 相关
  • http2
  • websocket 解析

License

MIT License