Skip to main content

pr0cks

python script to transparently forward all TCP traffic through a socks (like ssh -D option) or HTTPS (CONNECT) proxy using iptables -j REDIRECT target. Only works on linux for now.

Features :

  • set up a local transparent proxy compatible with socks4 socks5 and HTTP CONNECT proxies allowing to forward any TCP traffic transparently using iptables

Usage example: let's rock

As an example we will use the socks5 proxy of openssh (the option -D)

$ ssh -D 1080 user@sshserver

then you can add some iptables rules :

$ iptables -t nat -A OUTPUT ! -d <my_ssh_server_IP>/32 -o eth0 -p tcp -m tcp -j REDIRECT --to-ports 10080

then start pr0cks :

$ pr0cks --proxy SOCKS5:127.0.0.1:1080

All your TCP traffic and DNS traffic should now pass through the ssh server kinda like if you had setup a tun VPN through ssh but without admin rights on the server ! #help

pr0cks -h
usage: procks [-h] [--type {HTTP,SOCKS4,SOCKS5}] [-p PORT] [-n] [-v] [-c]
              [--username USERNAME] [--password PASSWORD]
              proxy_addr proxy_port

Transparent SOCKS5/SOCKS4/HTTP_CONNECT Proxy

positional arguments:
  proxy_addr
  proxy_port

optional arguments:
  -h, --help            show this help message and exit
  --type {HTTP,SOCKS4,SOCKS5}
                        The type of proxy to forward the traffic to
  -p PORT, --port PORT  port to bind the transparent proxy on the local socket
                        (default 10080)
  -n, --nat             set bind address to 0.0.0.0 to make pr0cks work from a
                        netfilter FORWARD rule instead of OUTPUT
  -v, --verbose         print all the connections requested through the proxy
  -c, --no-cache        don't cache dns requests
  --username USERNAME   Username to authenticate with to the server. The
                        default is no authentication.
  --password PASSWORD   Only relevant when a username has been provided

Dependencies

  • tested with Python 3.6

TODO

  • support UDP (with socks5)
  • support proxy chaining

Don't hesitate to send me your feedback or any issue you may find

I hope it will be useful to someone ! Have fun :)

Metadata

Release files for pr0cks 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pr0cks 0.2.1
File Size Uploaded Provenance Actions
pr0cks-0.2.1.tar.gz 18.2 kB Without provenance Details for pr0cks-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pr0cks 0.2.1
File Interpreter ABI Platform Actions
pr0cks-0.2.1-py3-none-any.whl Python 3 none any Details for pr0cks-0.2.1-py3-none-any.whl

Total release size: 38.1 kB

Release files / pr0cks-0.2.1.tar.gz

Download URL pr0cks-0.2.1.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0d31e11297709f2e17b71c08212bccb89a7f51bd5e575976bd36c5b256230357
BLAKE2b-256 checksum
How to use checksums
aa45cbbdceee11cf5cb709a40627e0712a0dc954841aed9b3ad2a1e198123d98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.6.9 Linux/4.15.0-102-generic

Release files / pr0cks-0.2.1-py3-none-any.whl

Download URL pr0cks-0.2.1-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
319daa4e8330b18070bff3dc3a66ce2c1458db10e369367fd3e4122b4997e7ab
BLAKE2b-256 checksum
How to use checksums
e967a2c69460e3b977bd8f88feb792a942f8b86afaba74c890e2d71fa43dd887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.6.9 Linux/4.15.0-102-generic

Security for pr0cks 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page