Skip to content

rikyiso01/LaProxy

Repository files navigation

LaProxy

Introduction

An easy to use proxy for A/D CTFs
You can read the documentation at rikyiso01.github.io/LaProxy

Code Samples

TCP

from laproxy import TCPProxy, TCPHandler


class Handler(TCPHandler):
    def process(self, packet: bytes, inbound: bool, /) -> bytes | None:
        if b"ciao" in packet and not inbound:
            return None
        return packet


if __name__ == "__main__":
    TCPProxy("0.0.0.0", 1234, "127.0.0.1", 5005, Handler).run()

HTTP

from laproxy import TCPProxy, HTTPHandler, HTTPRequest, HTTPResponse


class Handler(HTTPHandler):
    def request(self, request: HTTPRequest, /) -> HTTPRequest | None:
        return request

    def response(self, response: HTTPResponse, /) -> HTTPResponse | None:
        if b"flag" in response.body:
            return None
        return response

if __name__ == "__main__":
    TCPProxy("0.0.0.0", 1234, "127.0.0.1", 5005, Handler).run()

You can find more examples in the samples folder

Installation

Install locally with:

python3 -m pip install laproxy

Or use it in a docker compose:

version: "3.9"
services:
    proxy:
        image: ghcr.io/rikyiso01/laproxy:latest
        ports:
            - "1234:1234"
        volumes:
            - ./proxy.py:/app/proxy.py