Skip to content

A lightweight MITM proxy in Go for intercepting and modifying HTTP/HTTPS traffic. Features WebSocket support, dynamic TLS certificates, and rule-based traffic modification. Perfect for debugging and testing web applications.

License

Notifications You must be signed in to change notification settings

eugene-ivanov-hash/mitm-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MITM Proxy

A powerful Man-In-The-Middle proxy utility for intercepting, inspecting, and modifying HTTP/HTTPS traffic.

Features

  • Intercepts and modifies both HTTP and HTTPS traffic
  • Dynamic TLS certificate generation for HTTPS connections
  • Rule-based system for conditional traffic modification
  • Support for custom Go scripts to modify requests and responses
  • WebSocket connection handling
  • Environment variable integration

Quick Start

Prerequisites

  • Go 1.18 or higher
  • OpenSSL (for generating CA certificates)

Installation

  1. Clone the repository:

    git clone https://github.com/eugene-ivanov-hash/mitm-proxy.git
    cd mitm-proxy
  2. Generate CA certificate and key:

    openssl genrsa -out ca.key 2048
    openssl req -new -x509 -days 3650 -key ca.key -out ca.crt -subj "/CN=MITM Proxy CA"
  3. Build the application:

    go build -o mitm-proxy
  4. Add the CA certificate to your system's trusted certificates (see Installation Guide)

Usage

Start the proxy:

./mitm-proxy -cacertfile ca.crt -cakeyfile ca.key

Configure your client to use the proxy (default: 127.0.0.1:9999).

For more options:

./mitm-proxy -help

Creating Rules

Rules are defined in YAML files in the proxy_rules directory:

enabled: true
rules:
  - name: "Add Custom Header"
    enabled: true
    change: "request"
    rule: "req.URL.Host == 'example.com'"
    action: "script"
    script: |
      req.Header.Add("X-Custom-Header", "CustomValue")
      return nil

Documentation

For detailed documentation, see the docs directory:

License

See the LICENSE file for details.

About

A lightweight MITM proxy in Go for intercepting and modifying HTTP/HTTPS traffic. Features WebSocket support, dynamic TLS certificates, and rule-based traffic modification. Perfect for debugging and testing web applications.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages