SSH WebSocket Proxy - A simple Python proxy server that enables SSH connections over WebSocket protocol, perfect for HTTP Injector Custom Payload mode.
Install and configure everything with a single command:
bash <(curl -sL https://raw.githubusercontent.com/Codexxxa/wspros/main/install.sh)This automated installer will:
- β Install all required dependencies (Python3, OpenSSH, UFW)
- β Let you choose your preferred port (80, 8080, 443, or custom)
- β Handle port conflicts automatically (stops Apache/Nginx if needed)
- β Create and configure the WebSocket proxy service
- β Set up auto-start on boot with systemd
- β Configure firewall rules
- β Provide you with ready-to-use HTTP Injector payloads
The install.sh script automates the entire setup process:
- Checks for root privileges - Ensures you have the necessary permissions
- Interactive port selection - Choose from:
- Port 80 (default HTTP)
- Port 8080 (recommended)
- Port 443 (HTTPS)
- Custom port (1024-65535)
- Installs dependencies - Python3, OpenSSH server, curl, and UFW firewall
- Enables SSH service - Configures SSH to start on boot
- Handles conflicts - Automatically stops Apache/Nginx if they're using your selected port
- Creates the proxy - Installs the WebSocket proxy script at
/usr/local/bin/ws-proxy.py - Systemd service - Creates auto-restart service that starts on boot
- Configures firewall - Opens SSH (22) and your selected WebSocket port
- Shows configuration - Displays your server IP, port, and ready-to-use HTTP Injector payloads
After installation, you'll see:
- Your server's IP address and WebSocket port
- HTTP Injector configuration settings
- Multiple payload examples for different scenarios
- Useful management commands
Example payloads provided:
- WebSocket upgrade payload
- Payload with bug host support
- CONNECT method payload
- Direct connection (200 OK) payload
Management commands:
# Check service status
sudo systemctl status ws-proxy
# View live logs
sudo journalctl -u ws-proxy -f
# Restart service
sudo systemctl restart ws-proxy
# Stop service
sudo systemctl stop ws-proxy- A VPS or server with root access
- HTTP Injector app installed on your Android device
- Basic SSH credentials (username and password)
-
Run the installer on your VPS (see Quick Installation above)
-
Open HTTP Injector on your Android device
-
Configure SSH Settings:
- Tap on SSH Settings
- SSH Host: Your server IP (shown after installation)
- SSH Port: 22
- Username: Your SSH username
- Password: Your SSH password
-
Set up Custom Payload:
- Select Custom Payload mode
- Use one of the payloads provided after installation
- Example (WebSocket):
GET / HTTP/1.1[crlf]Host: YOUR_IP:YOUR_PORT[crlf]Upgrade: websocket[crlf][crlf]
-
Connect:
- Tap Start to establish the connection
- Your SSH tunnel over WebSocket is now active!
The installer provides 4 different payload types:
1. WebSocket Payload (Recommended for most scenarios)
GET / HTTP/1.1[crlf]Host: YOUR_IP:PORT[crlf]Upgrade: websocket[crlf][crlf]
2. WebSocket with Bug Host (For ISP bug hosts)
GET / HTTP/1.1[crlf]Host: [host][crlf]Upgrade: websocket[crlf]Connection: Upgrade[crlf][crlf]
3. CONNECT Method (HTTP proxy style)
CONNECT [host_port] HTTP/1.1[crlf]Host: YOUR_IP:PORT[crlf][crlf]
4. Direct Connection (Simple 200 OK)
GET / HTTP/1.1[crlf]Host: YOUR_IP:PORT[crlf]Connection: keep-alive[crlf][crlf]
Note: Replace
YOUR_IPandPORTwith the actual values shown after installation. In HTTP Injector, use[crlf]for line breaks and[host]for dynamic host injection.
If you prefer to install manually or the automated installer doesn't work for your system:
- Python 3.6 or higher
- No additional dependencies required (uses only standard library)
-
Download the script:
wget https://raw.githubusercontent.com/Codexxxa/wspros/main/main.py
-
Run the proxy:
On Windows (Run as Administrator):
python main.py
On Linux/macOS (requires root for port 80):
sudo python3 main.py
When the proxy starts, you will see:
2024-01-25 10:00:00 - INFO - SSH WebSocket Proxy started on 0.0.0.0:80
2024-01-25 10:00:00 - INFO - Forwarding traffic to 127.0.0.1:22
2024-01-25 10:00:00 - INFO - Press Ctrl+C to stop the proxy
When a client connects:
2024-01-25 10:01:00 - INFO - Client connected: 192.168.1.100:54321
2024-01-25 10:01:00 - INFO - WebSocket upgrade request detected from ('192.168.1.100', 54321)
2024-01-25 10:01:00 - INFO - Sent 101 Switching Protocols to ('192.168.1.100', 54321)
2024-01-25 10:01:00 - INFO - Connected to SSH server at 127.0.0.1:22
The following parameters can be modified in the script:
| Parameter | Default | Description |
|---|---|---|
LISTEN_HOST |
0.0.0.0 |
Address to listen on |
LISTEN_PORT |
80 |
Port to listen on |
SSH_HOST |
127.0.0.1 |
SSH server address to forward to |
SSH_PORT |
22 |
SSH server port to forward to |
BUFFER_SIZE |
4096 |
Buffer size for data transfer |
- The proxy listens on your selected port for incoming connections
- When a client connects, it reads the initial HTTP request
- It supports multiple connection types:
- WebSocket Upgrade: Responds with 'HTTP/1.1 101 Switching Protocols'
- CONNECT Method: Responds with 'HTTP/1.1 200 Connection Established'
- Direct Connection: Responds with 'HTTP/1.1 200 OK'
- A bidirectional tunnel is established between the client and the local SSH server
- All traffic is forwarded transparently between the client and SSH server
- β Multiple connection methods (WebSocket, CONNECT, direct)
- β Automatic service management with systemd
- β Auto-restart on failure
- β Firewall configuration
- β Port conflict resolution
- β Comprehensive logging
- β Uses only Python standard libraries (socket, threading)
- β No C++ build tools required
- β Works on Linux distributions (Ubuntu, Debian, CentOS, RHEL, Fedora)
- β Optimized for HTTP Injector Custom Payload mode
# Check the service status
sudo systemctl status ws-proxy
# Check the logs
sudo journalctl -u ws-proxy -n 50The installer automatically handles Apache/Nginx conflicts. If you still have issues:
# Find what's using the port
sudo lsof -i :PORT_NUMBER
# Stop the conflicting service
sudo systemctl stop SERVICE_NAME- Verify the proxy is running:
sudo systemctl status ws-proxy - Check firewall rules:
sudo ufw statusorsudo firewall-cmd --list-all - Verify SSH credentials are correct
- Ensure your VPS's security group/firewall allows the WebSocket port
- Test SSH connection directly:
ssh username@your_server_ip
# Real-time logs
sudo journalctl -u ws-proxy -f
# Last 100 lines
sudo journalctl -u ws-proxy -n 100
# Logs from today
sudo journalctl -u ws-proxy --since todayTo completely remove the WebSocket SSH Proxy:
# Stop and disable the service
sudo systemctl stop ws-proxy
sudo systemctl disable ws-proxy
# Remove the service file
sudo rm /etc/systemd/system/ws-proxy.service
# Remove the proxy script
sudo rm /usr/local/bin/ws-proxy.py
# Reload systemd
sudo systemctl daemon-reload
# Optional: Remove firewall rules
sudo ufw delete allow YOUR_PORT/tcp- Network Binding: By default, the proxy binds to
0.0.0.0(all network interfaces), allowing connections from external machines. This is intentional for a VPS setup. - Firewall: The installer configures UFW/firewalld to only allow SSH and the WebSocket port.
- SSH Authentication: The proxy relies on SSH server's authentication. Always use strong passwords or SSH keys.
- VPS Security: Ensure your VPS has proper security measures (fail2ban, regular updates, etc.)
- Monitor Logs: Regularly check logs for suspicious activity
Q: Which port should I choose? A: Port 8080 is recommended as it's commonly open and doesn't require special privileges. Port 80 might conflict with web servers. Port 443 works well if you're not running HTTPS services.
Q: Can I run this on shared hosting? A: No, you need a VPS or dedicated server with root access.
Q: Does this work with all ISPs? A: The WebSocket method works with most ISPs. Try different payload options if one doesn't work.
Q: Can I change the port after installation?
A: Yes. Edit /etc/systemd/system/ws-proxy.service, change the WS_PROXY_PORT value, then run:
sudo systemctl daemon-reload
sudo systemctl restart ws-proxy
sudo ufw allow NEW_PORT/tcpQ: Is this legal? A: This tool is for legitimate SSH tunneling. Ensure you comply with your ISP's terms of service and local laws.
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT License