Skip to main content

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.
  • No manual password entry: Provide credentials via command-line arguments for automation or scripting.
  • 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 ssh behavior).
    • If nothing is piped, remote stdin is closed immediately.

⚡️ 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 \
  --user youruser \
  --password 'yourpassword' \
  --command 'ls -lh /tmp'

Pipe something into the remote process:

echo "Hello remote world!" | ssheval --host foo --user bar --password baz --command 'cat -'

Download a remote file (binary-safe):

ssheval --host foo --user bar --password baz --command 'cat /usr/bin/ls' > local_ls_copy

Arguments

Argument Description
--host Hostname or IP of the remote server
--user SSH username
--password SSH password (as a command line argument!)
--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 cat will finish (not hang).

Examples:

ssheval ... --command 'cat -'         # stdin closed immediately
echo foo | ssheval ... --command 'cat -'   # 'foo' is sent

⚠️ Limitations

  • SSH key authentication not included (password-only; see paramiko docs for keys).
  • 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


Download files

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

Source Distribution

ssheval-0.1.0a1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

ssheval-0.1.0a1-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ssheval-0.1.0a1.tar.gz.

File metadata

  • Download URL: ssheval-0.1.0a1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for ssheval-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 18250f5dea68ed5b2a6707a674788d69e16b590dc3bd9ed2f2c768658ffbb852
MD5 7ce54503e62a110363757c5202e0a52f
BLAKE2b-256 0c4972d9532f57ecf1aa12382bd36883d143bfda0344a822f79d02ef89746687

See more details on using hashes here.

File details

Details for the file ssheval-0.1.0a1-py2.py3-none-any.whl.

File metadata

  • Download URL: ssheval-0.1.0a1-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for ssheval-0.1.0a1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 af6cd22973994f0273ac352fd5dc1637dde40e8bad5f6e99e444cb9586ef3348
MD5 a30e4cce29cf5b5e270d4ea969ec16d6
BLAKE2b-256 d5b94524ae9864c52b74f0c5b1839f5ecc7bc13ca6cad2a2b68a86b3bc1b461e

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