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.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.7.tar.gz
(7.8 kB
view details)
Built Distribution
plinux-1.0.7-py3-none-any.whl
(19.7 kB
view details)
File details
Details for the file plinux-1.0.7.tar.gz
.
File metadata
- Download URL: plinux-1.0.7.tar.gz
- Upload date:
- Size: 7.8 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 | d851359ffef53154be146abf63dd339cee4a195c7c30a60a1add9db0e33a2739 |
|
MD5 | b279dfb883c2c067a046c8b0ef6e8dab |
|
BLAKE2b-256 | 4140c89663078395c589ff882a5ecf5d1689d2480355dc2f79df30f75a625494 |
File details
Details for the file plinux-1.0.7-py3-none-any.whl
.
File metadata
- Download URL: plinux-1.0.7-py3-none-any.whl
- Upload date:
- Size: 19.7 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 | fa5bb9854c957bae38f36d4b1b46e57f6e8ec8446c72f3e91602d7fcd32a4927 |
|
MD5 | 250728b861eec6afb8ef7f606b4c2f94 |
|
BLAKE2b-256 | 0602a55e4b9c2dd437d01a091824efb93d318abc4a01e5f98e74458b9f235b95 |