Skip to content

Mytai20100/sshz-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sshz-python

SSHZ Logo

Python Version Version Build Status Tests License

Overview

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.

Features

  • Dynamic SSH tunnel creation
  • Real PTY support with shell execution
  • Multiple simultaneous connections
  • Automatic credential generation
  • Terminal resize support
  • Low latency I/O forwarding

Requirements

  • Python 3.8 or higher
  • paramiko library

Installation

git clone https://github.com/Mytai20100/sshz-python.git
cd sshz-python
pip3 install -r requirements.txt

Usage

Start the Server

python3 server.py

The server will start on:

  • SSH Port: 2223
  • Control Port: 7777

Connect with Client

python3 index.py <server_ip> <control_port>

Example:

python3 index.py 127.0.0.1 7777

The client will display SSH credentials:

Tunnel ready: ssh t4f95e427ca@127.0.0.1 -p 2223
Password: d0a198975098

Connect via SSH

Use any SSH client to connect:

ssh <username>@<server_ip> -p 2223

Or use PuTTY, SecureCRT, or any other SSH client.

Configuration

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,
}

Architecture

┌─────────────────┐         ┌──────────────────┐
│  Control Client │         │   SSHZ Server    │
│   (index.py)    │◄───────►│   - SSH Server   │
│                 │  Socket │   - PTY Manager  │
└─────────────────┘         │   - Shell Fork   │
                            └────────┬─────────┘
                                     │
                            ┌────────▼─────────┐
                            │   SSH Clients    │
                            │  (PuTTY, etc.)   │
                            └──────────────────┘

How It Works

  1. Control client connects to the server
  2. Server generates temporary credentials
  3. Server creates PTY and forks shell process
  4. SSH clients can connect using generated credentials
  5. All I/O is forwarded between SSH client, PTY, and control client
  6. Multiple clients can interact with the same shell session

Security Notes

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

License

MIT License

Contributing

Contributions are welcome. Please open an issue or submit a pull request.

Author

mytai20100

Support

For issues and questions, please open an issue on GitHub.

About

sshx with python :)) ( work in eviroment not root )

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages