Skip to main content

GitHub release (latest SemVer) Code style: black Pypi_Version

Please note that the project is in beta phase. Please report any issues you encounter or suggestions you have. We will do our best to address them quickly. Contributions are very welcome!

PySSHHelper

PySSHHelper is a Python library for simplifying SSH connections and interactions with remote servers.

Installation

You can install PySSHHelper using pip:

pip install PySSHHelper

If you would like the most up-to-date version, you can instead install directly from GitHub:

git clone <copied link from github>
cd PySSHHelper
pip install .

Example of usage

from PySSHHelper import SSHConnection

After importing the package, you can use SSHConnection in your code:

# Create an SSH connection object
ssh = SSHConnection(
    host='your_host',
    port=22,
    username_ssh='your_ssh_username',
    password_ssh='your_ssh_password',
    username_sudo='your_sudo_username',
    password_sudo='your_sudo_password',
    verbose=True  # Set verbose to True for debugging information
)

# Connect to the SSH server
ssh.connect()

# Execute a command
output = ssh.execute_command("ls -l")
print(output)

The output variable will contain all output in the console, including escape codes from the terminal, you can use the method to clear them:

print(ssh.cleanup_escape_codes(output))

If you want to execute commands in sudo context:

ssh.elevate_privileges()
print(ssh.execute_command("echo 123 && sleep 5 && echo 321", timeout=10))
print(ssh.execute_command("id"))

And after you can revoke privileges and then continue to execute in normal context

ssh.revoke_privileges()
print(ssh.execute_command("id"))

Also, you can do some SFTP operations

print(ssh.list_directory())
ssh.sftp_get('/remote/path/file.txt', 'local_file.txt')
ssh.sftp_put('local_file.txt', '/remote/path/file.txt')

Close the SSH connection

ssh.close()

Metadata

Release files for PySSHHelper 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PySSHHelper 0.1.2
File Size Uploaded Provenance
pysshhelper-0.1.2.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for PySSHHelper 0.1.2
File Interpreter ABI Platform
pysshhelper-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / pysshhelper-0.1.2.tar.gz

Download URL pysshhelper-0.1.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a3029183d510dd127acb4019b04b68f899f925b51f552a2b4e6f01fbf53d0654
BLAKE2b-256 checksum
How to use checksums
c3bf70f2005c556243442a489d5b5423eebde8ba58dc8c7ac82f4cf56d4c904e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / pysshhelper-0.1.2-py3-none-any.whl

Download URL pysshhelper-0.1.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e1b7f67dca6fc8ae4f154429a4378a9bb071b7e03ecb7385e08ca581f6fdecd
BLAKE2b-256 checksum
How to use checksums
c84597f541e84c119f776d893d7caf88aea50fce0d312c59f782110bc04adf5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for PySSHHelper 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page