A cross-platform pure Python script for executing remote commands over SSH and streaming raw stdout/stderr.
Project description
ssheval
A cross-platform pure Python script for executing remote commands over SSH and streaming raw stdout/stderr.
🚀 Features
- Works on NT & POSIX: Requires only Python 2+ and
paramiko- no OpenSSH or PuTTY needed. - Flexible authentication: Supports password, Ed25519 key, or RSA key via command-line arguments.
- Faithfully streams stdout & stderr: Outputs both streams in real time, preserving all bytes (works for text and binary data!).
- Remote exit codes: Exits with the same code as the remote command.
- SSH-like stdin behavior:
- Pipes stdin from your console or parent process only if input is provided (matches
sshbehavior). - If nothing is piped, remote stdin is closed immediately.
- Pipes stdin from your console or parent process only if input is provided (matches
⚡️ Why use this instead of plain ssh?
- No SSH client required on Windows: Works even where ssh is missing (ex: vanilla Windows).
- Great for automation: Integrates seamlessly with scripts and tools that need to provide credentials non-interactively.
- Binary-safe: Most SSH client wrappers mishandle binary data or don't stream both stdout and stderr in real time.
- Stdin-pipes like ssh: Remote command's stdin is hooked up only when data is piped in - just like the real
ssh.
🛠️ Installation
pip install ssheval
After installation, run it as ssheval.
paramiko required.
💻 Usage
Basic example:
ssheval \
--host example.com \
--username youruser \
--password 'yourpassword' \
--command 'ls -lh /tmp'
With an Ed25519 or RSA key:
ssheval \
--host example.com \
--username youruser \
--ed25519-key ~/.ssh/id_ed25519 \
--command 'ls -lh /tmp'
ssheval \
--host example.com \
--username youruser \
--rsa-key ~/.ssh/id_rsa \
--command 'ls -lh /tmp'
Pipe something into the remote process:
echo "Hello remote world!" | ssheval --host foo --username bar --password baz --command 'cat -'
Download a remote file (binary-safe):
ssheval --host foo --username bar --password baz --command 'cat /usr/bin/ls' > local_ls_copy
Arguments
| Argument | Description |
|---|---|
--host |
Hostname or IP of the remote server |
--username |
SSH username |
--password |
SSH password |
--ed25519-key |
Path to an Ed25519 private key for SSH authentication |
--rsa-key |
Path to an RSA private key for SSH authentication |
--port |
SSH port (default: 22) |
--command |
The remote command to execute |
🔄 Stdin Handling
This script matches SSH's behavior:
- If you pipe input in, local stdin is streamed to the remote command.
- If not, remote stdin is immediately closed - remote commands like
catwill finish (not hang).
Examples:
ssheval ... --command 'cat -' # stdin closed immediately
echo foo | ssheval ... --command 'cat -' # 'foo' is sent
⚠️ Limitations
- No PTY/interactive shell allocation.
- Basic error handling and no advanced SSH features (X11, port forwarding).
🛠️ Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
📄 License
This project is licensed 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 ssheval-0.1.0a2.tar.gz.
File metadata
- Download URL: ssheval-0.1.0a2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4917d6c172b291c2f817106347539ef5d4be1023078568251bb531c4b7681327
|
|
| MD5 |
c34f0c1c7eecd02bb835a34023488f69
|
|
| BLAKE2b-256 |
8b0e2594fdfd8008189c25f5e69e7ecf4880c64e50f2cc12afea23cac80c8e56
|
File details
Details for the file ssheval-0.1.0a2-py2.py3-none-any.whl.
File metadata
- Download URL: ssheval-0.1.0a2-py2.py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb7fc5479665b4452e5c14a94fe9983e83dc7e62ab9999f8294d8efe268e3938
|
|
| MD5 |
fe0857df082877c6b544050b4e333aa9
|
|
| BLAKE2b-256 |
abba2a8b35217b9dd3c96185f3fa7cd3e387f90dee43982546b30eab95826b78
|