HY_sshapi
A set of APIs used to contact with a remote (linux-like) server.
Usage
from SSH_Operation.SSH_Operation import SSH_Operation
ssh = SSH_Operation({})
Methods
#══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
# Class: SSH_Operation
#──────────────────────────
# Author: Hengyue Li
#──────────────────────────
# Version:
# 2022/02/26
# support ssh -D
# 2019/04/11
# 2019/04/02
#
# 2019/03/16
# new upload function, to upload dir without compression.
# 2019/03/09:
# 1. rebuilt interface of InteractiveConnectionSSH
# 2. change filename to from RemoteContral1
# 3. make a package contains interface.py
# 2019/03/01
# 2018/06/01
# 2018/02/28
# 2017/09/04
#──────────────────────────
# discription:
# operation between local PC with a remote server
# remember to call connect or disconnect for some function.
#
#──────────────────────────
# Imported :
# shutil , tempfile , stat
import paramiko,threading,time,sys
import shutil,os,tempfile,random
from .interactive import *
from .forward import forward_tunnel
import logging
# import SSH_Operation.interactive as interactive
#──────────────────────────
# Interface:
#
# [ini] SSHDict ( see details in paramiko )
#
# [sub] connect()
# connect to server.
#
# [sub] connectIfNotConnected()
#
# [sub] disconnect()
# disconnect to server.
#
# [fun] IsRemotePathExist(remotepah)
# check if a remote path is existed or not.
#
# [fun] IsRemoteDirExisted(remotepah):
# for a given remote path, check if it is directory and existed.
#
# [fun] RemoveRemoteDIr(remoeDir):
# remove remote directory
#
# [fun] send_commandlist(commandlist)
# return error
#
# [sub] upload_file(localfile,remotedestination)
# if we call self.upload_file( "test.file" , "/here" )
# then "test.file" will be renamed to "here" and be put at root ("/").
# if there is file (the same name as localfile) existed at server, it will be coverd.
#
# [sub] download_file(remotefile,localdestination)
# the "remotefile" will be copied and be saved as "localdestination"
# "remotefile" and "localdestination" are all files exactly. The same as upload
#
# [sub] CompressUploadDir(localdirectoy,remotedestination): !!!! linux dependent ("tar" is used)
# The upload file can only be directory and compression will be used. Faster!
# usage:
# localdirectoy = "some/path/directory"
# remotedestination = "other/path"
# the directory would be put at: "other/path/directory"
#
# [sub] upload_dir(localdirectoy,remotedestination)
# the same as CompressUploadDir without compression
#
# [sub] CompressDownloadDir(Remotedirectoy,localdestination): !!!! linux dependent ("zip/unzip" is also used)
# The download file can only be directory and compression will be used. Faster!
# usage:
# Remotedirectoy = "some/path/directory"
# localdestination = "other/path"
# the directory would be put at: "other/path/directory"
# This function is not well designed. Tempral file will be created in the folder.
# But it looks working fine.
#
# [fun] IsUserExist(username):
# return True of False
# check if username is exist in remote server.
#
# [fun] CreatUser(username):
# return possible errors.
# 1. Maybe only root user can use this command.
# 2. not forget to call IsUserExist to check if it is existed or not!
#
# [fun] RemoveUser(username):
# like "CreatUser".
#
# [fun] GetHomePath(): (make connection before this sub)
# get the home path of the remote
#
# [sub] CreateInteractiveConnectionSSH()
#
# [sub] CreateInteractiveConnectionSSH_linuxString()
#
# [sub] DynamicSocket(localPort) ( command dependent )
# "ssh -D"
#
# [sub] PortForward(localPort,targetHost,targetPort)
# port forward localPort -> targetHost:targetPort
#══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Metadata
Release files for HY-sshapi 2022.11.19.1248
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 |
|---|---|---|---|---|
| HY_sshapi-2022.11.19.1248.tar.gz | 10.7 kB | Without provenance | Details for HY_sshapi-2022.11.19.1248.tar.gz |
Release files / HY_sshapi-2022.11.19.1248.tar.gz
| Download URL | HY_sshapi-2022.11.19.1248.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52585b55dd97f1c8be1be8f6fb99f0624478a57c3c7aad0d54b44f1b7c9140ce
|
|
BLAKE2b-256 checksum How to use checksums |
3b0ec586a4a4fa232f2c36a9366e740552c329cd7e07b0e8920128aaf2794050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.2 tqdm/4.59.0 importlib-metadata/3.7.2 keyring/23.0.0 rfc3986/1.4.0 colorama/0.4.1 CPython/3.8.7
|
Security for HY-sshapi 2022.11.19.1248
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.