Skip to main content

a package on top of fabric to use SSH easily

Project description

topssh

a package on top of fabric to use ssh easily

installation

pip install topssh

usage

from topssh.ssh_lite import SSH
from topssh.ssh import SSH as FullSSH

host = "127.0.0.1"
user ="username"
password = "password"

# lite ssh only captures command output
ssh = SSH(host, user, password)
ssh.add_sudo_watcher()
ssh.connect(timeout=5)

out = ssh.run("hostname")
print(out)

out = ssh.run("uname -a")
print(out)

# all outpus in ssh.echo_text
print("".join(ssh.echo_text))

# full ssh cpatures all output including command input and output
ssh = FullSSH(host, user, password)
ssh.connect(timeout=5)

# add timestamps to output and ignore color chars
# ssh.patch_output()

out = ssh.run("hostname")
print(out)

out = ssh.run("uname -a")
print(out)

# all outpus in ssh.echo_text
print("".join(ssh.echo_text))

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

topssh-2024.1.31.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

topssh-2024.1.31-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

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