The cross-platform tool to execute bash commands remotely.
Project description
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.8 (06.02.2020)
get_file_permission extended:
- added faq
- added "human=False" param returns access rights in human readable form otherwise in in octal
- added alias "stat"
1.0.7 (30.01.2020)
- ResponseParser methods notation changed.
- stdout -> str
- stderr -> str
- exited -> int
- ok -> bool
- command -> str
1.0.6 (29.01.2020)
- kill_user_session method added
1.0.5 (26.01.2020)
- logging refactored to avoid multiple log entries
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
plinux-1.0.8.tar.gz
(7.9 kB
view details)
Built Distribution
plinux-1.0.8-py3-none-any.whl
(19.9 kB
view details)
File details
Details for the file plinux-1.0.8.tar.gz
.
File metadata
- Download URL: plinux-1.0.8.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb66e9cab764dbbc310499fa42c8eae72557ed94b8e5d027867f02aa93f18969 |
|
MD5 | 0abeb49945edd3a9b8344a3753131fff |
|
BLAKE2b-256 | 658d8886e16f3013444e8de0d218a085add22df97b5c36813315cf76fa5eb8d9 |
File details
Details for the file plinux-1.0.8-py3-none-any.whl
.
File metadata
- Download URL: plinux-1.0.8-py3-none-any.whl
- Upload date:
- Size: 19.9 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/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93624346addad86e5033c6ed581126cdb75ff7e1886c11a7861f12a674c60dc7 |
|
MD5 | 2a5b3f0c9c7a57cefd06bda422dfe418 |
|
BLAKE2b-256 | 9ef5d59a2c6aabe81edb9cf79a6607dee68716f7d9732ddd8ddf3fb3c0e28dcf |