1 Star 2 Fork 0

大漠孤烟 / go-mitm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

go-mitm

中间人代理。可以方便地查看请求/响应,可以将响应替换成本地文件或远程地址,可以将请求转化成常用语言的请求代码。

go-mitm

Contents

  1. Feature
  2. Usage
    1. Run
    2. Open the link
    3. Install certificate
    4. Set the proxy
    5. Include & Exclude
    6. Replace
    7. Tips
  3. Dev
  4. TODO

Feature

  • 支持启动/关闭中间人代理
  • 支持设置包含/排除名单
  • 支持设置上游代理
  • 支持导出
  • 支持清除/筛选/排序
  • 支持请求转为各语言代码
  • 支持响应以raw/html/json/hex等方式显示
  • 支持请求重放

Usage

Run

下载相应平台的可执行文件并执行 releases

./mitm_darwin_arm64

参数:

  • -mid-port 指定中间人端口
  • -web-port 指定网页端口
  • -include 指定包含规则,多条规则用";"分割(使用中间人,页面能看到记录)
  • -exclude 指定排除规则,多条规则用";"分割(使用直连,页面看不到记录)
  • -proxy proxy 指定上游代理

过滤规则仅对hostname过滤。如

  • a.com
  • a.com.cn
  • a.*.cn
  • *.com
  • a.*
  • a.com.*
  • *.*

Open the link

访问链接,如 http://localhost:8083

image image image image image

Install certificate

当前设备下载安装并信任CA证书 image

mac:

image

windows:

image image image image

Set the proxy

设置代理为 http://localhost:8082

mac:

image

windows:

image image

Include & Exclude

按行进行分割,其他请参考-include-exclude参数定义

image

Replace

替换成指定网址(https://、http://),替换成本地文件(file://)

image

Tips

  • 如果设置了代理,直连的时候依然会使用代理。如果不需要代理,请清空代理。
  • permission denied 解决办法:
chmod +x mitm_darwin_arm64

Dev

Test

go run ./cmd/mitm-web/*.go

# http://localhost:5173/
npm run --prefix ./web/ui dev

curl -X POST "https://httpbin.org/post" -H "accept: application/json" --data '{"a":"xyz","b":"123"}' -x http://localhost:8082 --cacert ./static/tls/ca.crt

curl "https://httpbin.org/get" -x http://192.168.31.171:8082 --cacert ./static/tls/ca.crt

Build

make

TODO

  • python http.client
  • node https/request
  • java
  • middleware tmpdir save image/video
  • https proxy
  • replace

空文件

简介

中间人代理。可以方便地查看请求/响应,可以将响应替换成本地文件或远程地址,可以将请求转化成常用语言的请求代码。 展开 收起
JavaScript 等 6 种语言
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/lizongying/go-mitm.git
git@gitee.com:lizongying/go-mitm.git
lizongying
go-mitm
go-mitm
main

搜索帮助

53164aa7 5694891 3bd8fe86 5694891