Skip to main content

Uncomplicated Port Forwarder (UPF)

Project description

Uncomplicated Port Forwarder (UPF)

Uncomplicated Port Forwarder (UPF) is a simple command-line tool to manage port forwarding rules using iptables. It supports both TCP and UDP protocols, making it easy to set up port forwarding for specific ports or ranges of ports.

Installation

pip install upf

Run the script with sudo for administrative privileges (required to modify iptables).

Usage

Add a Single Port Forwarding Rule

Add a port forwarding rule from a host to a remote IP and port.

TCP (default)

sudo upf add <remote-ip> <host-port>:<remote-port>

Example:

sudo upf add 192.168.0.2 2200:22

UDP

sudo upf add <remote-ip> <host-port>:<remote-port> --udp

Example:

sudo upf add 192.168.0.2 2200:22 --udp

Add a Range of Port Forwarding Rules

Add a range of port forwarding rules for a subnet starting from a specified port.

TCP (default)

sudo upf add-range <gateway>/<subnet> <starting-port>

Example:

sudo upf add-range 192.168.0.1/24 2200

UDP

sudo upf add-range <gateway>/<subnet> <starting-port> --udp

Example:

sudo upf add-range 192.168.0.1/24 2200 --udp

List All Managed Port Forwarding Rules

List all the port forwarding rules that have been added using UPF.

sudo upf list

Delete a Specific Port Forwarding Rule

Delete a specific port forwarding rule by host port.

TCP (default)

sudo upf delete <host-port>

Example:

sudo upf delete 2200

UDP

sudo upf delete <host-port> --udp

Example:

sudo upf delete 2200 --udp

Notes

  • Persistence: By default, changes made using iptables are not persistent after reboot. To make them persistent, you can save the rules using iptables-save and restore them with iptables-restore.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

upf-0.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

upf-0.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file upf-0.1.0.tar.gz.

File metadata

  • Download URL: upf-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.10 Darwin/24.1.0

File hashes

Hashes for upf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9a5ed479e85897c4a0f39077453d12311ed59e01a80ac1f567b00a55f1d27c4c
MD5 9cda4eac55eb8d3a7e84ef713638174f
BLAKE2b-256 f9f5e0abce8a798543eb3a73cb303199f7a037a3b2807452c8185ecb45aabc51

See more details on using hashes here.

File details

Details for the file upf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: upf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.10 Darwin/24.1.0

File hashes

Hashes for upf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a5b77ab0a7532d9ea48d370e15d458927fd60174941ed2d4d3a05f9256379b2
MD5 f6d208fd298c5f0da482d28445a64b7d
BLAKE2b-256 f03f8fb9a10e3a0e6fb0458d2ea2f71d40083224cb35521c983effd9f2202389

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page