GithubHelp home page GithubHelp logo

rikyiso01 / laproxy Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 2.0 43 KB

An easy to use proxy for A/D CTFs

Home Page: https://rikyiso01.github.io/LaProxy/

License: MIT License

Python 96.23% Dockerfile 0.97% Nix 2.81%
attack-defense-ctf ctf-tools proxy

laproxy's Introduction

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

laproxy's People

Contributors

rikyiso01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.