Retour au classement

lqqyt2423/go-mitmproxy

Go

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

mitmproxymitmhttpshttps-proxyhttphttp-proxy
Croissance des étoiles
Étoiles
1.5k
Forks
303
Croissance hebdomadaire
Issues
23
5001k1.5k
janv. 2023mars 2024mai 2025juil. 2026
ArtefactsGo Modulesgo get github.com/lqqyt2423/go-mitmproxy
README

go-mitmproxy

简体中文

go-mitmproxy is a Golang implementation of mitmproxy that supports man-in-the-middle attacks and parsing, monitoring, and tampering with HTTP/HTTPS traffic.

Key features

  • Parses HTTP/HTTPS traffic and displays traffic details via a web interface.
  • Supports a plugin mechanism for easily extending functionality. Various event hooks can be found in the examples directory.
  • HTTPS certificate handling is compatible with mitmproxy 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.
  • Map Remote and Map Local support.
  • HTTP/2 support.
  • WebSocket support.
  • Server-Sent Events (SSE) support.
  • Refer to the configuration documentation for more features.

Unsupported features

  • Only supports setting the proxy manually in the client, not transparent proxy mode.

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. go-mitmproxy currently supports "Explicit HTTP" and "Explicit HTTPS" as mentioned in the article.

Command Line Tool

Installation

go install github.com/lqqyt2423/go-mitmproxy/cmd/go-mitmproxy@latest

Usage

Use the following command to start the go-mitmproxy proxy server:

go-mitmproxy

After starting, the HTTP proxy address is set to port 9080 by default, and the web interface is set to port 9081 by default.

The 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.

Additional Parameters

ou can use the following command to view more parameters of go-mitmproxy:

go-mitmproxy -h
Usage of go-mitmproxy:
  -addr string
    	proxy listen addr (default ":9080")
  -allow_hosts value
    	a list of allow hosts
  -cert_path string
    	path of generate cert files
  -debug int
    	debug mode: 1 - print debug log, 2 - show debug from
  -f string
    	Read configuration from file by passing in the file path of a JSON configuration file.
  -ignore_hosts value
    	a list of ignore hosts
  -map_local string
    	map local config filename
  -map_remote string
    	map remote config filename
  -proxyauth string
        enable proxy authentication. Format: "username:pass", "user1:pass1|user2:pass2","any" to accept any user/pass combination
  -ssl_insecure
    	not verify upstream server SSL/TLS certificates.
  -upstream string
    	upstream proxy
  -upstream_cert
    	connect to upstream server to look up certificate details (default true)
  -version
    	show go-mitmproxy version
  -web_addr string
    	web interface listen addr (default ":9081")

Importing as a package for developing functionalities

Simple Example

package main

import (
	"log"

	"github.com/lqqyt2423/go-mitmproxy/proxy"
)

func main() {
	opts := &proxy.Options{
		Addr:              ":9080",
		StreamLargeBodies: 1024 * 1024 * 5,
	}

	p, err := proxy.NewProxy(opts)
	if err != nil {
		log.Fatal(err)
	}

	log.Fatal(p.Start())
}

Adding Functionality by Developing Plugins

Refer to the examples for adding your own plugins by implementing the AddAddon method.

The following are the currently supported event nodes:

type Addon interface {
	// A client has connected to mitmproxy. Note that a connection can correspond to multiple HTTP requests.
	ClientConnected(*ClientConn)

	// A client connection has been closed (either by us or the client).
	ClientDisconnected(*ClientConn)

	// Mitmproxy has connected to a server.
	ServerConnected(*ConnContext)

	// A server connection has been closed (either by us or the server).
	ServerDisconnected(*ConnContext)

	// The TLS handshake with the server has been completed successfully.
	TlsEstablishedServer(*ConnContext)

	// HTTP request headers were successfully read. At this point, the body is empty.
	Requestheaders(*Flow)

	// The full HTTP request has been read.
	Request(*Flow)

	// HTTP response headers were successfully read. At this point, the body is empty.
	Responseheaders(*Flow)

	// The full HTTP response has been read.
	Response(*Flow)

	// Stream request body modifier
	StreamRequestModifier(*Flow, io.Reader) io.Reader

	// Stream response body modifier
	StreamResponseModifier(*Flow, io.Reader) io.Reader

	// WebSocket connection established
	WebSocketStart(*Flow)

	// WebSocket message received
	WebSocketMessage(*Flow)

	// WebSocket connection closed
	WebSocketEnd(*Flow)

	// SSE connection established
	SSEStart(*Flow)

	// SSE message received
	SSEMessage(*Flow)

	// SSE connection closed
	SSEEnd(*Flow)

	// HTTP request failed with error
	RequestError(*Flow, error)

	// HTTP CONNECT request failed with error
	HTTPConnectError(*Flow, error)
}

WEB Interface

You can access the web interface at http://localhost:9081/ using a web browser.

Features

  • View detailed information of HTTP/HTTPS requests
  • Supports formatted preview of JSON requests/responses
  • Supports binary mode to view response body
  • Supports advanced filtering rules
  • Supports request breakpoint function

Screenshot Examples

If you find this project helpful, consider buying me a cup of coffee. Feel free to reach out for any technical inquiries.

The 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.

WeChat QR Code for Sponsorship
WeChat QR Code for Sponsorship
Contact Me
Contact Me

License

MIT License

Dépôts similaires
mitmproxy/mitmproxy

An interactive TLS-capable intercepting HTTP proxy for penetration testers and software developers.

PythonPyPIMIT Licensepythonsecurity
mitmproxy.org
44.4k4.6k
docmirror/dev-sidecar

开发者边车,github打不开,github加速,git clone加速,git release下载加速,stackoverflow加速

JavaScriptnpmMozilla Public License 2.0dev-sidecarfastgit
23.3k2.9k
alufers/mitmproxy2swagger

Automagically reverse-engineer REST APIs via capturing traffic

HTMLmitmproxyopenapi
9.6k368
coyove/goflyway

An encrypted HTTP server

GoGo ModulesMIT Licensegolangsocks
4.3k639
abhinavsingh/proxy.py

💫 Ngrok FRP Alternative • ⚡ Fast • 🪶 Lightweight • 0️⃣ Dependency • 🔌 Pluggable • 😈 TLS interception • 🔒 DNS-over-HTTPS • 🔥 Poor Man's VPN • ⏪ Reverse & ⏩ Forward • 👮🏿 "Proxy Server" framework • 🌐 "Web Server" framework • ➵ ➶ ➷ ➠ "PubSub" framework • 👷 "Work" acceptor & executor framework

PythonPyPIBSD 3-Clause "New" or "Revised" Licensehttp-proxypython3
abhinavsingh.com/proxy-py-a-lightweight-single-file-http-proxy-server-in-python/
3.5k631
projectdiscovery/proxify

A versatile and portable proxy for capturing, manipulating, and replaying HTTP/HTTPS traffic on the go.

GoGo ModulesMIT Licensemitmproxymitm
projectdiscovery.io
3.1k266
DanOps-1/Gpt-Agreement-Payment

ChatGPT Plus/Team/Pro 订阅协议端到端重放工具集 · hCaptcha 视觉求解器 · 反欺诈机制实证研究 / End-to-end protocol replay toolkit for ChatGPT Plus/Team/Pro subscription with from-scratch hCaptcha solver and empirical anti-fraud research

PythonPyPIMIT Licenseadversarial-mlanti-fraud
2.2k13
summitt/Nope-Proxy

TCP/UDP Non-HTTP Proxy Extension (NoPE) for Burp Suite.

JavaMavenappsecappsecurity
1.7k240
monkeyWie/proxyee

HTTP proxy server,support HTTPS&websocket.MITM impl,intercept and tamper HTTPS traffic.

JavaMavenMIT Licensehttphttps
1.6k577
ssh-mitm/ssh-mitm

SSH-MITM - ssh audits made simple

PythonPyPIGNU General Public License v3.0sshssh-server
docs.ssh-mitm.at
1.5k155
secretsquirrel/BDFProxy

Patch Binaries via MITM: BackdoorFactory + mitmProxy.

PythonPyPIbdfpython
1k199
mitmproxy/android-unpinner

Remove Certificate Pinning from APKs

PythonPyPIandroidreverse-engineering
1k81