Skip to main content

The cross-platform tool to execute bash commands remotely.

Project description

Build Status

Plinux

Cross-platform tool to work with remote Linux OS.

Plinux based on paramiko project. It can establish ssh connection to a remote server, execute command as user or with sudo rights. Plinux returns object with exit code, sent command, stdout/sdtderr response.

Installation

For most users, the recommended method to install is via pip:

pip install plinux

Import

from plinux import Plinux

Usage

Command from usual user:

from plinux import Plinux

client = Plinux(host="172.16.0.124", username="bobby", password="qawsedrf")
response = client.run_cmd("hostname")
print(response.stdout)  # WebServer
print(response.ok)  # True

Command using sudo:

from plinux import Plinux

client = Plinux(host="172.16.0.124", username="bobby", password="qawsedrf", logger_enabled=True)
response = client.run_cmd("systemctl stop myservicename.service", sudo=True)

print(response)  # ResponseParser(response=(0, None, None, "sudo -S -p '' -- sh -c 'systemctl stop myservicename.service'"))
print(response.command)  # sudo -S -p '' -- sh -c 'systemctl stop myservicename.service'
print(response.exited)  # 0

Aliases

Some methods have "human commands" and aliases:

  • client.run_cmd("ls /home/bobby")
  • client.list_dir("/home/bobby")
  • client.ls("/home/bobby")

Changelog

1.0.5 (26.01.2020)
  • logging refactored to avoid multiple log entries

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

plinux-1.0.5.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

plinux-1.0.5-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file plinux-1.0.5.tar.gz.

File metadata

  • Download URL: plinux-1.0.5.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for plinux-1.0.5.tar.gz
Algorithm Hash digest
SHA256 ae3a99de2b5fd9a2e2521fff640163a93ba6052de4f78d83b877c79610b5ad87
MD5 9025d7a241239934c44953a8dd20a7f9
BLAKE2b-256 cb95b3a4305328d15c1f84f10fdfb27e77e005141ad5ed37f8cf56590afa3133

See more details on using hashes here.

File details

Details for the file plinux-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: plinux-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for plinux-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8e35c0d9c99ca472a800d35fe2773bf993ebc4d3b3fb85626966100f54283030
MD5 c723a1c8e4dc7e57cfad93954a27444f
BLAKE2b-256 6048419651b14e69837341c157f477f88d157236d3649ee1eae4f252284098d6

See more details on using hashes here.

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