Skip to main content

Xepor fork with mitmproxy 12.x support and wildcard host routing (ccproxy interim).

Project description

Unit Tests PyPI-Server PyPI - Status Documentation Status Project generated with PyScaffold 996.icu

Xepor

Xepor (pronounced /ˈzɛfə/, zephyr) is a web routing framework for reverse engineers and security researchers. It provides a Flask-like API for hackers to intercept and modify HTTP requests and/or HTTP responses in a human-friendly coding style.

This project is meant to be used with mitmproxy. Users write scripts with xepor, and run the script inside mitmproxy with mitmproxy -s your-script.py.

If you want to step from PoC to production, from demo(e.g. http-reply-from-proxy.py, http-trailers.py, http-stream-modify.py) to something you could take out with your WiFi Pineapple, then Xepor is for you!

Features

  1. Code everything with @api.route(), just like Flask! Write everything in one script and no if..else any more.
  2. Handle multiple URL routes, even multiple hosts in one InterceptedAPI instance.
  3. For each route, you can choose to modify the request before connecting to server (or even return a fake response without connection to upstream), or modify the response before forwarding to user.
  4. Blacklist mode or whitelist mode. Only allow URL endpoints defined in scripts to connect to upstream, blocking everything else (in specific domains) with HTTP 404. Suitable for transparent proxying.
  5. Human readable URL path definition and matching powered by parse
  6. Host remapping. define rules to redirect to genuine upstream from your fake hosts. Regex matching is supported. Best for SSL stripping and server-side license cracking!
  7. Plus all the bests from mitmproxy! ALL operation modes ( mitmproxy / mitmweb + regular / transparent / socks5 / reverse:SPEC / upstream:SPEC) are fully supported.

Use Case

  1. Evil AP and phishing through MITM.
  2. Sniffing traffic from target device by iptables + transparent proxy, modify the payload with xepor on the fly.
  3. Cracking cloud-based software license. See examples/krisp/ as an example.
  4. Write a complicated web crawler in ~100 lines of code. See examples/polyv_scrapper/ as an example.
  5. ... and many more.

SSL stripping is NOT provided by this project.

Installation

pip install xepor

Quick start

Take the script from examples/httpbin as an example.

mitmweb -s example/httpbin/httpbin.py

Set your Browser HTTP Proxy to http://127.0.0.1:8080, and access the web interface at http://127.0.0.1:8081/.

Send a GET request from http://httpbin.org/#/HTTP_Methods/get_get , Then you could see the modification made by Xepor in mitmweb interface, browser dev tools or Wireshark.

The httpbin.py do two things.

  1. When user access http://httpbin.org/get, inject a query string parameter payload=evil_param inside HTTP request.
  2. When user access http://httpbin.org/basic-auth/xx/xx/ (we just pretend we don't know the password), sniff Authorization headers from HTTP requests and print the password to the attacker.

Just what mitmproxy always does, but with code written in xepor way.

# https://github.com/xepor/xepor-examples/tree/main/httpbin/httpbin.py
from mitmproxy.http import HTTPFlow
from xepor import InterceptedAPI, RouteType


HOST_HTTPBIN = "httpbin.org"

api = InterceptedAPI(HOST_HTTPBIN)


@api.route("/get")
def change_your_request(flow: HTTPFlow):
    """
    Modify URL query param.
    Test at:
    http://httpbin.org/#/HTTP_Methods/get_get
    """
    flow.request.query["payload"] = "evil_param"


@api.route("/basic-auth/{usr}/{pwd}", rtype=RouteType.RESPONSE)
def capture_auth(flow: HTTPFlow, usr=None, pwd=None):
    """
    Sniffing password.
    Test at:
    http://httpbin.org/#/Auth/get_basic_auth__user___passwd_
    """
    print(
        f"auth @ {usr} + {pwd}:",
        f"Captured {'successful' if flow.response.status_code < 300 else 'unsuccessful'} login:",
        flow.request.headers.get("Authorization", ""),
    )


addons = [api]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xepor_ccproxy-0.7.0.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xepor_ccproxy-0.7.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file xepor_ccproxy-0.7.0.tar.gz.

File metadata

  • Download URL: xepor_ccproxy-0.7.0.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for xepor_ccproxy-0.7.0.tar.gz
Algorithm Hash digest
SHA256 546fa914d417644f141cc3dc37d46c7d775da86207db1db0b0ca137b3747040b
MD5 01fd751cdabf71faaf4207317bb95e78
BLAKE2b-256 3ccc9f3581a4a86672abafe4459db930327c59f236455dae65594de74c606899

See more details on using hashes here.

File details

Details for the file xepor_ccproxy-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: xepor_ccproxy-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for xepor_ccproxy-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96ceb904252e3551115abc63fd0f54b846a7b248920890b959605af8d069bb5a
MD5 ab46c76cd07212bd2a2fa907d5489ed9
BLAKE2b-256 04d9332467de7585adda6fe89d6a8451c9c6cba274c0991e64a6b02e06d52ee8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page