rsc-dev / pyproxy

Very Simple TCP/UDP Proxy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyProxy - Very Simple TCP/UDP Proxy

About

PyProxy is a very simple TCP/UDP pure Python proxy. It can be easily extended for custom data handling logic.

Usage

>pyproxy.py -h
usage: pyproxy.py [-h] (--tcp | --udp) -s SRC -d DST [-q | -v]

TCP/UPD proxy.

optional arguments:
  -h, --help         show this help message and exit
  --tcp              TCP proxy
  --udp              UDP proxy
  -s SRC, --src SRC  Source IP and port, i.e.: 127.0.0.1:8000
  -d DST, --dst DST  Destination IP and port, i.e.: 127.0.0.1:8888
  -q, --quiet        Be quiet
  -v, --verbose      Be loud

Custom data handlers

Proxy uses two data handlers for incoming and outgoing data. By default both are set to identity function.

LOCAL_DATA_HANDLER = lambda x:x
REMOTE_DATA_HANDLER = lambda x:x

One can easily implement own rules. It might be very useful while testing network applications.

def custom_data_handler(data):
    # code goes here
    pass
    
LOCAL_DATA_HANDLER = custom_data_handler
REMOTE_DATA_HANDLER = lambda x:'constant_value'

License

Code is released under MIT license © Radoslaw '[rsc]' Matusiak.

About

Very Simple TCP/UDP Proxy.

License:MIT License


Languages

Language:Python 100.0%