SSHZ is a lightweight SSH tunnel server that creates temporary SSH access points. It allows you to establish SSH connections through a custom control protocol, making it easy to create on-demand SSH tunnels.
- Dynamic SSH tunnel creation
- Real PTY support with shell execution
- Multiple simultaneous connections
- Automatic credential generation
- Terminal resize support
- Low latency I/O forwarding
- Python 3.8 or higher
- paramiko library
git clone https://github.com/Mytai20100/sshz-python.git
cd sshz-python
pip3 install -r requirements.txtpython3 server.pyThe server will start on:
- SSH Port: 2223
- Control Port: 7777
python3 index.py <server_ip> <control_port>Example:
python3 index.py 127.0.0.1 7777The client will display SSH credentials:
Tunnel ready: ssh t4f95e427ca@127.0.0.1 -p 2223
Password: d0a198975098
Use any SSH client to connect:
ssh <username>@<server_ip> -p 2223Or use PuTTY, SecureCRT, or any other SSH client.
Edit the TUNNEL_CONFIG dictionary in server.py:
TUNNEL_CONFIG = {
'host': '0.0.0.0',
'ssh_port': 2223,
'control_port': 7777,
'buffer_size': 65536,
'enable_logging': True,
'select_timeout': 0.01,
'keepalive_interval': 30,
'idle_timeout': 3600,
}┌─────────────────┐ ┌──────────────────┐
│ Control Client │ │ SSHZ Server │
│ (index.py) │◄───────►│ - SSH Server │
│ │ Socket │ - PTY Manager │
└─────────────────┘ │ - Shell Fork │
└────────┬─────────┘
│
┌────────▼─────────┐
│ SSH Clients │
│ (PuTTY, etc.) │
└──────────────────┘
- Control client connects to the server
- Server generates temporary credentials
- Server creates PTY and forks shell process
- SSH clients can connect using generated credentials
- All I/O is forwarded between SSH client, PTY, and control client
- Multiple clients can interact with the same shell session
This is an alpha version intended for development and testing purposes. For production use:
- Use strong authentication
- Enable firewall rules
- Use encrypted connections
- Implement rate limiting
- Add access control lists
Contributions are welcome. Please open an issue or submit a pull request.
For issues and questions, please open an issue on GitHub.
