ssh_paramiko
ssh_paramiko is a wrapper utility around ssh, using paramiko, to execute commands and exchange files remotelly
Usage
Executing a simple remote command
>>> from ssh_paramiko import RemoteServer
>>> ssh = RemoteServer('/tmp/sshkey',logFolder='.')
>>> ssh.set_log_level('DEBUG')
Log: Changing log level to DEBUG | Log level:DEBUG | Date:01/11/2016 12:04:40
>>> ssh.set_log_rotate_handler(True) # set bzipped log files (ssh_paramiko.debug.log.bz2
# and ssh_paramiko.error.log.bz2) to be rotated
>>> ssh.connect_server('myServer')
Log: Connecting to server myServer | Log level:DEBUG | Date:01/11/2016 12:04:41
Log: Initiating connection with server myServer... | Log level:DEBUG | Date:01/11/2016 12:04:41
Log: Instantiating transport object for sftp... | Log level:DEBUG | Date:01/11/2016 12:04:41
(True, '')
>>> ssh.execute_cmd('whoami')
(True, 'root\n', '')
>>> ssh.close_connection()
Log: Connection with server myServer ended. | Log level:INFO | Date:01/11/2016 12:04:45
True
Transfering a remote file to a local file
>>> from ssh_paramiko import RemoteServer
>>> ssh = RemoteServer('/tmp/sshkey',logFolder='.')
>>> ssh.set_log_level('DEBUG')
Log: Changing log level to DEBUG | Log level:DEBUG | Date:01/11/2016 12:04:40
>>> ssh.set_log_rotate_handler(True) # set bzipped log files (ssh_paramiko.debug.log.bz2 and
# ssh_paramiko.error.log.bz2) to be rotated
>>> ssh.connect_server('myServer')
Log: Connecting to server myServer | Log level:DEBUG | Date:01/11/2016 12:04:41
Log: Initiating connection with server myServer... | Log level:DEBUG | Date:01/11/2016 12:04:41
Log: Instantiating transport object for sftp... | Log level:DEBUG | Date:01/11/2016 12:04:41
(True, '')
>>> ssh.get_file('local_file.py', '/root/remote_file.py', callBack=ssh.transferProgressBar)
Log: Transfering remote file /root/remote_file.py from server myServer to local file local_file.py
| Log level:DEBUG | Date:01/11/2016 12:08:15
TrueSize: 542 bytes(0.0 MB) || File transfered. [###################################] 100.0%
>>> ssh.close_connection()
Log: Connection with server myServer ended. | Log level:INFO | Date:01/11/2016 12:04:45
True
Transfering a local file to a remote file
>>> from ssh_paramiko import RemoteServer
>>> ssh = RemoteServer('/tmp/sshkey',logFolder='.')
>>> ssh.set_log_level('DEBUG')
Log: Changing log level to DEBUG | Log level:DEBUG | Date:01/11/2016 12:07:40
>>> ssh.set_log_rotate_handler(True) # set bzipped log files (ssh_paramiko.debug.log.bz2 and
# ssh_paramiko.error.log.bz2) to be rotated
>>> ssh.connect_server('myServer')
Log: Connecting to server myServer | Log level:DEBUG | Date:01/11/2016 12:07:41
Log: Initiating connection with server myServer... | Log level:DEBUG | Date:01/11/2016 12:07:41
Log: Instantiating transport object for sftp... | Log level:DEBUG | Date:01/11/2016 12:07:41
(True, '')
>>> ssh.put_file('local_file.py', '/root/remote_file.py', callBack=ssh.transferProgressBar)
Log: Transfering local file local_file.py to remote file /root/remote_file.py in server myServer |
Log level:DEBUG | Date:01/11/2016 12:07:44
TrueSize: 542 bytes(0.0 MB) || File transfered. [###################################] 100.0%
>>> ssh.close_connection()
Log: Connection with server myServer ended. | Log level:INFO | Date:01/11/2016 12:07:44
True
Installation
To install ssh_paramiko, simply run:
$ pip install ssh_paramiko
ssh_paramiko is compatible with Python 2.6+
Documentation
Source Code
Feel free to fork, evaluate and contribute to this project.
License
GPLv3 licensed.
Metadata
Release files for ssh-paramiko 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ssh_paramiko-0.1.2.tar.gz | 27.3 kB | Without provenance | Details for ssh_paramiko-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ssh_paramiko-0.1.2-py2.7.egg | Legacy Egg format | - | - | Details for ssh_paramiko-0.1.2-py2.7.egg |
Total release size: 33.7 kB
Release files / ssh_paramiko-0.1.2.tar.gz
| Download URL | ssh_paramiko-0.1.2.tar.gz |
|---|---|
| Size | 27.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecb244bd232535623a48e0b1f0b40f8803c326b6e3577a2f8424d478273ccaea
|
|
BLAKE2b-256 checksum How to use checksums |
25c5c21c2b8ca72b9918f9be06e41abe106c8f5d702546335fcd47a1ac2087fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ssh_paramiko-0.1.2-py2.7.egg
| Download URL | ssh_paramiko-0.1.2-py2.7.egg |
|---|---|
| Size | 6.4 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
c2f7b31463956dd4f4091c2a8ca461f00bb78408bbcdf3f0559900579d13ef80
|
|
BLAKE2b-256 checksum How to use checksums |
a98bfc4f44ba357128f573ef4aeb5bf64d29531259bbc3b3c82179fc4e2395c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for ssh-paramiko 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.