A forward and reverse socks over websocket server and client implementation in Python.
Project description
Pywssocks
Pywssocks is a SOCKS proxy implementation over WebSocket protocol.
Overview
This tool allows you to securely expose SOCKS proxy services under Web Application Firewall (WAF) protection (forward socks), or enable clients to connect and serve as SOCKS proxy servers when they don't have public network access (reverse socks).
Features
- Both client and server modes, supporting command-line usage or library integration.
- Forward and reverse proxy capabilities.
- Round-robin load balancing for reverse proxy.
- SOCKS proxy authentication support.
- IPv6 over SOCKS5 support.
- UDP over SOCKS5 support.
Potential Applications
- Distributed HTTP backend.
- Bypassing CAPTCHA using client-side proxies.
- Secure intranet penetration, using CDN network.
Usage
As a tool
Forward Proxy:
# Server (WebSockets at port 8765, as network connector)
pywssocks server -t example_token
# Client (SOCKS5 at port 1080)
pywssocks client -t example_token -u ws://localhost:8765 -p 1080
Reverse Proxy:
# Server (WebSockets at port 8765, SOCKS at port 1080)
pywssocks server -t example_token -p 1080 -r
# Client (as network connector)
pywssocks client -t example_token -u ws://localhost:8765 -r
As a library
Forward Proxy:
import asyncio
from pywssocks import WSSocksServer, WSSocksClient
# Server
server = WSSocksServer(
ws_host="0.0.0.0",
ws_port=8765,
)
token = server.add_forward_token()
print(f"Token: {token}")
asyncio.run(server.start())
# Client
client = WSSocksClient(
token="<token>",
ws_url="ws://localhost:8765",
socks_host="127.0.0.1",
socks_port=1080,
)
asyncio.run(client.start())
Reverse Proxy:
import asyncio
from pywssocks import WSSocksServer, WSSocksClient
# Server
server = WSSocksServer(
ws_host="0.0.0.0",
ws_port=8765,
socks_host="127.0.0.1",
socks_port_pool=range(1024, 10240),
)
token, port = server.add_reverse_token()
print(f"Token: {token}\nPort: {port}")
asyncio.run(server.start())
# Client
client = WSSocksClient(
token="<token>",
ws_url="ws://localhost:8765",
reverse=True,
)
asyncio.run(client.start())
Installation
Pywssocks requires python >= 3.8, and can be installed by:
pip install pywssocks
Pywssocks is also available via docker:
docker run --rm -it jackzzs/pywssocks --help
Documentation
Visit the documentation: https://pywssocks.zetx.tech
License
Pywssocks is open source under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pywssocks-1.1.0.tar.gz.
File metadata
- Download URL: pywssocks-1.1.0.tar.gz
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed970f33b44963a5a281ac3468fa919f933e9c69b7842c3ff27bc765b31cb252
|
|
| MD5 |
f736b916d92a03406e4ad3d12d161af7
|
|
| BLAKE2b-256 |
150b7623e6c106d512927eaf409b3d780534db413f4b9001d3d936173c4d3289
|
Provenance
The following attestation bundles were made for pywssocks-1.1.0.tar.gz:
Publisher:
pypi.yml on zetxtech/pywssocks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pywssocks-1.1.0.tar.gz -
Subject digest:
ed970f33b44963a5a281ac3468fa919f933e9c69b7842c3ff27bc765b31cb252 - Sigstore transparency entry: 169773192
- Sigstore integration time:
-
Permalink:
zetxtech/pywssocks@b2806172ee375f008465968ba6e0b124105155a1 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/zetxtech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@b2806172ee375f008465968ba6e0b124105155a1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pywssocks-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pywssocks-1.1.0-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfeaa927bf748636d7d4ee8df17c9aa9308d92cca90307393079f455e46381bf
|
|
| MD5 |
b7d95f525e8ea8cd17b35fc74a599b5d
|
|
| BLAKE2b-256 |
1c4b8dada405db7cea6f6351768eaef341d575452d84e9dcca246f5ff4d709d3
|
Provenance
The following attestation bundles were made for pywssocks-1.1.0-py3-none-any.whl:
Publisher:
pypi.yml on zetxtech/pywssocks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pywssocks-1.1.0-py3-none-any.whl -
Subject digest:
dfeaa927bf748636d7d4ee8df17c9aa9308d92cca90307393079f455e46381bf - Sigstore transparency entry: 169773193
- Sigstore integration time:
-
Permalink:
zetxtech/pywssocks@b2806172ee375f008465968ba6e0b124105155a1 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/zetxtech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@b2806172ee375f008465968ba6e0b124105155a1 -
Trigger Event:
release
-
Statement type: