Skip to content

Instantly share code, notes, and snippets.

@Troll338cz
Troll338cz / tcp_proxy.py
Last active January 14, 2025 08:39 — forked from grantjenks/tcp_proxy.py
Simple TCP Proxy
"""Simple TCP Proxy
Receive connections on one port and forward them to another port.
Example:
$ python3 -m http.server 8080 # Start an http server on port 8080
$ python3 tcp_proxy.py 192.168.1.100 5000 127.0.0.1 8080 # Proxy port 5000 to localhost:8080
Open http://192.168.1.100:5000/ in Chrome
"""
import argparse
import asyncio