RepositoryJava
hudaming1

hudaming1/jmitm

Java版本的mitmproxy,对本地浏览器所有的Http(s)请求和响应进行拦截并「重制」;也可充当轻量级B/S版抓包软件;

51stars
18forks
5issues
2views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: dynamic-gateway

#1 Repository of the month

1
TINIX TRENDING·Topic: charles

#1 Repository of the month

1
TINIX TRENDING·Topic: https-proxy

#1 Repository of the month

概述

简单说就是你可以对自己浏览器的所有「请求」和「响应」进行拦截,并通过「Java代码方式」进行「重制」。 基于jmitm,你可以:

根据Request重制Request
例如将「wiredog.com」重定向到「localhost:8080」,等效于配置浏览器级别的host: wiredog.com 127.0.0.1:8080

// 将wiredog.com重定向到localhost:8080
proxy.add(new CatchRequest().eval(request -> {
    // 判断请求域名是wiredog.com
    return "wiredog.com".equals(request.host());
}).rebuildRequest(request -> {
    // 如果命中Request,则将请求实际转发到localhost:8080
    return request.header("Host", "localhost:8080");
}).mock());

根据Request重制Response
对百度首页注入一段JS代码(根据请求拦截响应报文,并追加一段代码)

proxy.add(new CatchRequest().eval(request -> {
    // 如果访问的是百度首页
    return "www.baidu.com".equals(request.host()) && "/".equals(request.uri());
}).rebuildResponse(response -> {
    // 如果命中百度首页,则将以下JS代码追加到网页HTML的末尾,通过查看浏览器网页源代码也会发现在末尾处多了一段JS
    // 注入的JS代码
    String json = "<!--add by wiretigher-->";
    // 因为响应头是gzip进行压缩,因此无法直接将ASCII串追加到内容末尾,需要先将原响应报文解压,在将JS追加到末尾
    String outBody = new String(CodecFactory.create("gzip").decompress(response.body())) + json;
    // 解压后为了省事,就不再进行压缩
    return response.removeHeader("Content-Encoding").body(outBody.getBytes());
}).mock());

根据Request Mock Response
拦截百度首页Logo,不做真实转发,直接读取本地GoogleLogo文件作为Response,百度首页的Logo变为本地Google的图片

proxy.add(new CatchRequest().eval(request -> {
    // 如果域名是baidu,访问的图片是百度的Logo(第一个图片是PC上的,后两个路径是移动端的Logo)
    return "www.baidu.com".equals(request.host()) &&("/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png".equals(request.uri()) || "/img/flexible/logo/pc/result.png".equals(request.uri()) || "/img/flexible/logo/pc/result@2.png".equals(request.uri()));
}).mockResponse(httpRequest -> {
    // 如果命中请求,则不会将请求转发到百度服务器,而直接读取本地Google图片作为Response返回。
    HttpResponse response = new HttpResponse();
    byte[] googleLogo = readFile("/mock/google.png");
    return response.body(googleLogo).header("Content-Type", "image/gif");
}).mock());

根据Response重制Response
暂时No Case...

Quick Start

1.git clone https://github.com/hudaming1/wiredog.git
2.启动 WiredogServerRun.java (默认端口52007)
3.访问localhost:8080进入控制台
4.点击控制台单「Download Cert」按钮下载并安装CA(如果需要卸载,在证书库中搜索Wiredog删除即可)
🌟Mac系统导入后,还需要手动将CA进行授信。
5.访问HTTPS网页,当控制台显示出HTTPS请求时,即可对HTTP请求响应进行重制

其他

内置PostMan

请求重访功能:对于抓到的HTTP请求,在控制台中不仅可以查看请求和响应结果,也可以实时进行修改并进行再次发送,等效于实现集成Fillder和PostMan。
<补充示例>

Similar Projects

Discover other similar projects and AI models.

RepositoryGo
mintfog/sniffy

开源跨平台抓包调试工具,支持 HTTPS / WebSocket / gRPC / SSE,断点、Mock、JS 插件与 Headless API · Open-source cross-platform HTTP(S) debugging proxy

165
Nov 26, 2026
RepositoryJava
iamyours/ApkCrack

A tool that make your apk debuggable for Charles/Fiddler in Android 7.0

167
Jul 23, 2020
RepositoryGo
caddyserver/caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

79.8k
Nov 24, 2026
RepositoryC
curl/curl

A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, MQTTS, POP3, POP3S, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET, TFTP, WS and WSS. libcurl offers a myriad of powerful features

43.7k
Nov 28, 2026
RepositoryC
nginx/nginx

The official NGINX Open Source repository.

34.2k
Nov 27, 2026
RepositoryGo
GopeedLab/gopeed

A fast, modern download manager for HTTP, BitTorrent, Magnet, HlS(m3u8), FTP and ed2k. Cross-platform, built with Golang and Flutter.

28.5k
Dec 2, 2026
RepositoryC++
yhirose/cpp-httplib

A C++ header-only HTTP/HTTPS server and client library

17.0k
Nov 29, 2026
RepositoryJavaScript
avwo/whistle

HTTP, HTTP2, HTTPS, Websocket debugging proxy

15.8k
Dec 1, 2026
RepositoryTypeScript
sindresorhus/got

🌐 Human-friendly and powerful HTTP request library for Node.js

15.0k
Nov 20, 2026