{"id":21508558,"url":"https://github.com/jawstar/port-forwarder","last_synced_at":"2026-04-29T07:34:56.899Z","repository":{"id":263226767,"uuid":"889614795","full_name":"JawStar/port-forwarder","owner":"JawStar","description":"Simple port forwarding script using python   ","archived":false,"fork":false,"pushed_at":"2024-11-22T15:13:59.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T14:51:30.277Z","etag":null,"topics":["github","portforwarding","python3","ssh"],"latest_commit_sha":null,"homepage":"https://jawstar.medium.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JawStar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-16T19:19:39.000Z","updated_at":"2024-11-22T15:14:03.000Z","dependencies_parsed_at":"2024-11-17T05:26:33.690Z","dependency_job_id":"e7ea6822-ccc4-4948-bbdb-fa0df592e463","html_url":"https://github.com/JawStar/port-forwarder","commit_stats":null,"previous_names":["jawstar/port-forwarder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JawStar/port-forwarder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawStar%2Fport-forwarder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawStar%2Fport-forwarder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawStar%2Fport-forwarder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawStar%2Fport-forwarder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JawStar","download_url":"https://codeload.github.com/JawStar/port-forwarder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawStar%2Fport-forwarder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263296487,"owners_count":23444493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","portforwarding","python3","ssh"],"created_at":"2024-11-23T21:06:35.965Z","updated_at":"2026-04-29T07:34:56.870Z","avatar_url":"https://github.com/JawStar.png","language":"Python","funding_links":["https://buymeacoffee.com/jawstar_9999"],"categories":[],"sub_categories":[],"readme":"How it works:\n\n1) Local Server: The script starts a local server that listens on LOCAL_HOST:LOCAL_PORT. This can be any IP and port that you want to use.\n\n2) Remote Forwarding: When a client connects to the local server, the script opens a connection to the remote server (REMOTE_HOST:REMOTE_PORT) and forwards any data received from the local client to the remote server, and vice versa.\n3) Multithreading: Two threads are used per connection: one for forwarding data from the client to the remote server and another for forwarding data back from the remote server to the client.\n\nTo run:\nReplace REMOTE_HOST with the address of the server you want to forward data to (e.g., an external IP or domain).\nAdjust the port numbers (LOCAL_PORT and REMOTE_PORT) as necessary.\nSave the script to a .py file, and run it using Python:\n\npython pf.py\n\n or\n\n python3 pf.py\n\nHow to run the code :\n1) Edit the Code (Optional):\nModify the REMOTE_HOST, REMOTE_PORT, and LOCAL_PORT values in the script according to your use case:\n\nLOCAL_PORT: The port on your local machine that you want to listen on.\nREMOTE_HOST: The remote server (IP or domain name) you want to forward traffic to.\nREMOTE_PORT: The port on the remote server where you want to forward traffic.\nExample:\nIf you want to forward traffic from your local machine's port 8080 to the remote server example.com on port 80, your variables should look like this:\n\n\nLOCAL_HOST = '0.0.0.0'  # Listens on all interfaces\nLOCAL_PORT = 8080        # Port to listen on your local machine\nREMOTE_HOST = 'example.com'  # Remote server\nREMOTE_PORT = 80            # Port on the remote server\n\n\nRun the Script:\n\nOpen a terminal or command prompt and navigate to the directory where the port_forwarder.py script is located.\n\nExample:\nIf you saved it in a folder called my_port_forwarder on your desktop:\n\nOn Windows: Open Command Prompt and run:\n\npython3 pf.py\n\nOn macOS/Linux: Open a Terminal and run:\n\npython3 pf.py\n\nThe script should now be running and listening on the local port (LOCAL_PORT). Any connection that hits that port will be forwarded to the remote server (REMOTE_HOST and REMOTE_PORT).\n\n\n *Test the Port Forwarding*:\nTo test the port forwarding, open a new terminal or command prompt and try to connect to your local server. For example, if you're forwarding to example.com on port 80, you can use a web browser or curl to connect:\n\nCommand :--\u003e\n\ncurl http://localhost:8080\n\nTroubleshooting:\nPermission Issues:\nIf you get an error like PermissionError: [Errno 13] Permission denied when trying to listen on ports below 1024 (like port 80), you may need to run the script with elevated privileges (admin rights). You can do this by:\n\nWindows: Right-click on Command Prompt and choose \"Run as Administrator\".\nmacOS/Linux: Use sudo:\n\nsudo python3 pf.py\n\n## Connect ME 🥷\n\n \u003ca href=\"https://jawstar.medium.com\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Medium-FFA116?style=for-the-badge\u0026logo=medium\u0026logoColor=Black\" alt=\"Medium\" /\u003e\n  \u003c/a\u003e\n\n\n\n## $$ 🤑 DONATE ME 🤑 $$\n\n\u003ca href=\"https://buymeacoffee.com/jawstar_9999\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/buymeacoffee-FFA116?style=for-the-badge\u0026logo=buymeacoffee\u0026logoColor=Yellow\" alt=\"buymeacoffee\" /\u003e\n  \u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawstar%2Fport-forwarder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjawstar%2Fport-forwarder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawstar%2Fport-forwarder/lists"}