Skip to content

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

lizongying/go-mitm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published