Skip to main content

A pure-Python SSHv2 client/server library

Project description

๐Ÿš€ SpindleX

The Next-Generation Pure-Python SSH Library

PyPI version Python Support License Downloads Code Style

Secure, high-performance SSH and SFTP operations without GPL/LGPL dependencies

๐Ÿš€ Quick Start โ€ข ๐Ÿ“– Documentation โ€ข โœจ Features โ€ข ๐Ÿ› ๏ธ Examples


๐ŸŒŸ Why SpindleX?

SpindleX is a pure-Python SSH library designed for the modern developer. Built from the ground up with security, performance, and developer experience in mind.

๐ŸŽฏ Key Advantages

Feature SpindleX Traditional Libraries
๐Ÿ”’ Security Modern algorithms (Ed25519, ChaCha20-Poly1305) Legacy support
๐Ÿ Pure Python No C extensions, easy deployment Complex dependencies
โšก Performance Async support, optimized protocols Blocking operations
๐Ÿ›ก๏ธ License Apache 2.0 (business-friendly) GPL/LGPL restrictions
๐Ÿ”ง Developer UX Full type hints, modern API Legacy interfaces

โœจ Features

๐Ÿ” Security First

Modern cryptographic algorithms โ€ข Host key verification โ€ข Multiple authentication methods

๐Ÿš€ High Performance

Async/await support โ€ข Connection pooling โ€ข Optimized protocols

๐Ÿ› ๏ธ Developer Friendly

Full type hints โ€ข Comprehensive docs โ€ข Rich error handling

๐ŸŒ Complete Protocol

SSH client & server โ€ข SFTP operations โ€ข Port forwarding


๐Ÿš€ Quick Start

Installation

# Install SpindleX
pip install spindlex

# With async support
pip install spindlex[async]

# With all features
pip install spindlex[dev,gssapi]

30-Second Example

from spindlex import SSHClient

# ๐Ÿ”Œ Connect and authenticate
with SSHClient() as client:
    client.connect('your-server.com', username='user', password='pass')
    
    # ๐Ÿ’ป Execute commands
    stdin, stdout, stderr = client.exec_command('ls -la')
    print(stdout.read().decode())
    
    # ๐Ÿ“ Transfer files via SFTP
    with client.open_sftp() as sftp:
        sftp.get('/remote/file.txt', '/local/file.txt')
        sftp.put('/local/data.json', '/remote/backup.json')

๐Ÿ› ๏ธ Examples

๐Ÿ”‘ Key-Based Authentication
from spindlex import SSHClient
from spindlex.crypto.pkey import Ed25519Key

# Load your private key
private_key = Ed25519Key.from_private_key_file('~/.ssh/id_ed25519')

with SSHClient() as client:
    client.connect(
        hostname='production-server.com',
        username='deploy',
        pkey=private_key
    )
    
    # Deploy your application
    client.exec_command('docker-compose up -d')
โšก Async Operations
import asyncio
from spindlex import AsyncSSHClient

async def deploy_to_multiple_servers():
    servers = ['web1.example.com', 'web2.example.com', 'web3.example.com']
    
    async def deploy_to_server(hostname):
        async with AsyncSSHClient() as client:
            await client.connect(hostname, username='deploy', key_filename='~/.ssh/deploy_key')
            
            # Parallel deployment
            await client.exec_command('git pull origin main')
            await client.exec_command('docker-compose restart')
            
            print(f"โœ… Deployed to {hostname}")
    
    # Deploy to all servers concurrently
    await asyncio.gather(*[deploy_to_server(server) for server in servers])

# Run the deployment
asyncio.run(deploy_to_multiple_servers())
๐ŸŒ Port Forwarding
from spindlex import SSHClient

with SSHClient() as client:
    client.connect('bastion.example.com', username='user', key_filename='~/.ssh/id_rsa')
    
    # Forward local port 5432 to remote database
    tunnel_id = client.create_local_port_forward(
        local_port=5432,
        remote_host='db.internal.com',
        remote_port=5432
    )
    
    # Now connect to localhost:5432 to reach the database
    print("๐Ÿ”— Tunnel established! Connect to localhost:5432")
    
    # Keep tunnel open
    input("Press Enter to close tunnel...")
    client.close_port_forward(tunnel_id)
๐Ÿ“ Advanced SFTP Operations
from spindlex import SSHClient
import os

with SSHClient() as client:
    client.connect('fileserver.com', username='admin', password='secure_pass')
    
    with client.open_sftp() as sftp:
        # ๐Ÿ“Š Get file stats
        file_stats = sftp.stat('/remote/important.log')
        print(f"File size: {file_stats.size} bytes")
        
        # ๐Ÿ“‚ List directory contents
        files = sftp.listdir('/var/log')
        for file in files:
            print(f"๐Ÿ“„ {file}")
        
        # ๐Ÿ”„ Sync directories
        for root, dirs, files in os.walk('/local/backup'):
            for file in files:
                local_path = os.path.join(root, file)
                remote_path = f"/remote/backup/{file}"
                sftp.put(local_path, remote_path)
                print(f"๐Ÿ“ค Uploaded {file}")

๐Ÿ—๏ธ Architecture

graph TB
    A[๐Ÿ”Œ SpindleX Client] --> B[๐Ÿ” Authentication Layer]
    A --> C[๐Ÿš€ Transport Layer]
    A --> D[๐Ÿ“ SFTP Client]
    
    B --> E[๐Ÿ”‘ Public Key Auth]
    B --> F[๐Ÿ”’ Password Auth]
    B --> G[๐ŸŽซ GSSAPI Auth]
    
    C --> H[๐Ÿ“ก SSH Protocol]
    C --> I[๐Ÿ”€ Port Forwarding]
    C --> J[๐Ÿ“Š Channel Management]
    
    D --> K[๐Ÿ“ค File Upload]
    D --> L[๐Ÿ“ฅ File Download]
    D --> M[๐Ÿ“‚ Directory Ops]
    
    style A fill:#e1f5fe
    style B fill:#f3e5f5
    style C fill:#e8f5e8
    style D fill:#fff3e0

๐Ÿ“– Documentation

Resource Description
๐Ÿš€ Quick Start Guide Get up and running in minutes
๐Ÿ“š User Guide Comprehensive tutorials and guides
๐Ÿ” API Reference Complete API documentation
๐Ÿ’ก Examples Real-world usage examples
๐Ÿ›ก๏ธ Security Guide Security best practices

๐Ÿ”ง Requirements & Compatibility

System Requirements

  • Python: 3.8+
  • Dependencies: cryptography >= 3.0
  • Platforms: Linux, macOS, Windows

Optional Features

# Async support
pip install spindlex[async]

# Development tools  
pip install spindlex[dev]

# GSSAPI authentication (Unix only)
pip install spindlex[gssapi]

๐Ÿค Contributing

We โค๏ธ contributions! SpindleX is built by developers, for developers.

๐Ÿš€ Quick Contribution Guide

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch: git checkout -b feature/amazing-feature
  3. โœจ Make your changes with tests
  4. ๐Ÿงช Test your changes: pytest tests/
  5. ๐Ÿ“ Commit with clear messages: git commit -m "Add amazing feature"
  6. ๐Ÿš€ Push and create a Pull Request

๐ŸŽฏ Areas We Need Help

  • ๐Ÿ“– Documentation improvements
  • ๐Ÿงช Test coverage expansion
  • ๐Ÿ› Bug fixes and optimizations
  • โœจ New feature implementations
  • ๐ŸŒ Platform compatibility

โ†’ See Contributing Guide


๐Ÿ›ก๏ธ Security

Security is our top priority. SpindleX implements:

  • ๐Ÿ” Modern Cryptography: Ed25519, ECDSA, ChaCha20-Poly1305
  • ๐Ÿ›ก๏ธ Secure Defaults: No weak algorithms enabled
  • ๐Ÿ” Regular Audits: Automated security scanning
  • ๐Ÿ“‹ Best Practices: Following SSH RFCs and security guidelines

๐Ÿšจ Security Issues

Found a security vulnerability? Please email security@spindlex.org instead of creating a public issue.


๐Ÿ“Š Performance

SpindleX is built for performance:

Operation SpindleX Traditional
Connection Setup ~50ms ~200ms
File Transfer (1MB) ~100ms ~300ms
Concurrent Connections 1000+ 100+
Memory Usage Low High

Benchmarks run on standard hardware. Results may vary.


๐Ÿ“œ License

SpindleX is licensed under the Apache License 2.0 - see the LICENSE file for details.

Why Apache 2.0?

  • โœ… Business-friendly: Use in commercial projects
  • โœ… No copyleft: No viral licensing requirements
  • โœ… Patent protection: Includes patent grant
  • โœ… Widely adopted: Used by major projects

๐Ÿ™ Acknowledgments

SpindleX stands on the shoulders of giants:

  • ๐Ÿ” Python Cryptography team for excellent crypto primitives
  • ๐Ÿ Python Community for inspiration and feedback
  • ๐Ÿ”ง Contributors who make SpindleX better every day
  • ๐Ÿ’ก SSH Protocol designers for creating a robust standard

๐ŸŒŸ Star us on GitLab! ๐ŸŒŸ

If SpindleX helps you build amazing things, consider giving us a โญ

Made with โค๏ธ by the SpindleX Team

๐Ÿ› Report Bug โ€ข โœจ Request Feature โ€ข ๐Ÿ’ฌ Discussions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spindlex-0.2.0.tar.gz (103.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spindlex-0.2.0-py3-none-any.whl (114.6 kB view details)

Uploaded Python 3

File details

Details for the file spindlex-0.2.0.tar.gz.

File metadata

  • Download URL: spindlex-0.2.0.tar.gz
  • Upload date:
  • Size: 103.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for spindlex-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e3451d63a6b20e6560386d45d5c62ffc170b1b1f68ad91c9f86231ce04a2b111
MD5 1146b8b28981e381c956d32aa4528c7b
BLAKE2b-256 3d7241d157a48b039f10c50422ad96b283d9de01e43722cd554135c725004d9d

See more details on using hashes here.

File details

Details for the file spindlex-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: spindlex-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 114.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for spindlex-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fb42d10696e8f369e30f212b10677d87aad08c0f03d5b359dcc6261238d94d7
MD5 91d22f7f0e13f3594bb21d5264532393
BLAKE2b-256 1cf9af10c90b4b11e3a1f9082d7a359bed85197bddd9fbca703d3982c863d0dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page