IPWorks SSH 2020 Python Edition

Questions / Feedback?

SCP Class

Properties   Methods   Events   Configuration Settings   Errors  

The SCP class can be used to transfer files to and from SSH servers using the Secure Copy Protocol (SCP).

Syntax

class ipworksssh.SCP

Remarks

The SCP class is the SSH-enabled equivalent of the IPWorks RCP class. The ssh_host and ssh_port properties specify the SSH server to use. The ssh_user and ssh_password properties allow the client to authenticate itself with the server. The on_ssh_server_authentication event and/or ssh_accept_server_host_key property allow you to check the server identity. Finally, the on_ssh_status event provides information about the SSH handshake.

The SCP class implements a standard SCP File Transfer client.

The first step in using the class is specifying the ssh_host, ssh_user and ssh_password. The file to upload to or download from is given by the remote_file property. The file to download to or upload from is specified by local_file.

If local_file is set to something other than an empty string, then files are received in local_file, otherwise the data is received through the on_transfer event. on_start_transfer and on_end_transfer are fired at the beginning and end of transmission.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

connectedTriggers a connection or disconnection.
file_permissionsThe file permissions for the RemoteFile .
firewall_auto_detectThis property tells the class whether or not to automatically detect and use firewall system settings, if available.
firewall_typeThis property determines the type of firewall to connect through.
firewall_hostThis property contains the name or IP address of firewall (optional).
firewall_passwordThis property contains a password if authentication is to be used when connecting through the firewall.
firewall_portThis property contains the TCP port for the firewall Host .
firewall_userThis property contains a user name if authentication is to be used connecting through a firewall.
local_fileThe path to a local file for upload/download.
local_hostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
local_portThe TCP port in the local host where the class binds.
overwriteWhether or not the class should overwrite files during transfer.
remote_fileThe name of the remote file for uploading, downloading, etc.
remote_pathThe remote path on the server.
ssh_accept_server_host_key_encodedThe certificate (PEM/base64 encoded).
ssh_auth_modeThe authentication method to be used the class when calling SSHLogon .
ssh_cert_encodedThe certificate (PEM/base64 encoded).
ssh_cert_storeThe name of the certificate store for the client certificate.
ssh_cert_store_passwordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
ssh_cert_store_typeThe type of certificate store for this certificate.
ssh_cert_subjectThe subject of the certificate used for client authentication.
ssh_compression_algorithmsA comma-separated list containing all allowable compression algorithms.
ssh_encryption_algorithmsA comma-separated list containing all allowable encryption algorithms.
ssh_hostThe address of the SSH host.
ssh_passwordThe password for SSH password-based authentication.
ssh_portThe port on the SSH server where the SSH service is running; by default, 22.
ssh_userThe username for SSH authentication.
timeoutA timeout for the class.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

configSets or retrieves a configuration setting.
decode_packetDecodes a hex-encoded SSH packet.
do_eventsProcesses events from the internal message queue.
downloadDownload a RemoteFile from an SCP server.
encode_packetHex encodes an SSH packet.
get_ssh_paramUsed to read a field from an SSH packet's payload.
get_ssh_param_bytesUsed to read a field from an SSH packet's payload.
interruptInterrupt the current method.
resetReset the class.
set_ssh_paramUsed to write a field to the end of a payload.
ssh_logoffLogoff from the SSH server.
ssh_logonLogon to the SSHHost using the current SSHUser and SSHPassword .
uploadUpload a file specified by LocalFile to an SCP server.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_connectedFired immediately after a connection completes (or fails).
on_connection_statusFired to indicate changes in connection state.
on_disconnectedFired when a connection is closed.
on_end_transferFired when a file completes downloading/uploading.
on_errorInformation about errors during data delivery.
on_logFires once for each log message.
on_ssh_custom_authFired when the class is doing custom authentication.
on_ssh_keyboard_interactiveFired when the class receives a request for user input from the server.
on_ssh_server_authenticationFired after the server presents its public key to the client.
on_ssh_statusShows the progress of the secure connection.
on_start_transferFired when a file starts downloading/uploading.
on_transferFired during file download/upload.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

DirectoryPermissionsThe permissions of folders created on the remote host.
LastAccessedTimeThe last accessed time of the remote file.
LastModifiedTimeThe last modified time of the remote file.
PreserveFileTimePreserves the file's modified time during transfer.
RecursiveModeIf set to true the class will recursively upload or download files.
ServerResponseWindowThe time to wait for a server response in milliseconds.
ClientSSHVersionStringThe SSH version string used by the class.
EnablePageantAuthWhether to use a key stored in Pageant to perform client authentication.
KerberosDelegationIf true, asks for credentials with delegation enabled during authentication.
KerberosRealmThe fully qualified domain name of the Kerberos Realm to use for GSSAPI authentication.
KerberosSPNThe Kerberos Service Principal Name of the SSH host.
KeyRenegotiationThresholdSets the threshold for the SSH Key Renegotiation.
LogLevelSpecifies the level of detail that is logged.
MaxPacketSizeThe maximum packet size of the channel, in bytes.
MaxWindowSizeThe maximum window size allowed for the channel, in bytes.
PasswordPromptThe text of the password prompt used in keyboard-interactive authentication.
PreferredDHGroupBitsThe size (in bits) of the preferred modulus (p) to request from the server.
RecordLengthThe length of received data records.
ServerSSHVersionStringThe remote host's SSH version string.
SignedSSHCertThe CA signed client public key used when authenticating.
SSHAcceptAnyServerHostKeyIf set the class will accept any key presented by the server.
SSHAcceptServerCAKeyThe CA public key that signed the server's host key.
SSHAcceptServerHostKeyFingerPrintThe fingerprint of the server key to accept.
SSHFingerprintHashAlgorithmThe algorithm used to calculate the fingerprint.
SSHFingerprintMD5The server hostkey's MD5 fingerprint.
SSHFingerprintSHA1The server hostkey's SHA1 fingerprint.
SSHFingerprintSHA256The server hostkey's SHA256 fingerprint.
SSHKeepAliveCountMaxThe maximum number of keep alive packets to send without a response.
SSHKeepAliveIntervalThe interval between keep alive packets.
SSHKeyExchangeAlgorithmsSpecifies the supported key exchange algorithms.
SSHKeyRenegotiateCauses the class to renegotiate the SSH keys.
SSHMacAlgorithmsSpecifies the supported Mac algorithms.
SSHPubKeyAuthSigAlgorithmsSpecifies the enabled signature algorithms that may be used when attempting public key authentication.
SSHPublicKeyAlgorithmsSpecifies the supported public key algorithms.
SSHVersionPatternThe pattern used to match the remote host's version string.
TryAllAvailableAuthMethodsIf set to true, the class will try all available authentication methods.
WaitForChannelCloseWhether to wait for channels to be closed before disconnected.
WaitForServerDisconnectWhether to wait for the server to close the connection.
ConnectionTimeoutSets a separate timeout value for establishing a connection.
FirewallAutoDetectTells the class whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
LingerWhen set to True, connections are terminated gracefully.
LingerTimeTime in seconds to have the connection linger.
LocalHostThe name of the local host through which connections are initiated or accepted.
LocalPortThe port in the local host where the class binds.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
MaxTransferRateThe transfer rate limit in bytes per second.
ProxyExceptionsListA semicolon separated list of hosts and IPs to bypass when using a proxy.
TCPKeepAliveDetermines whether or not the keep alive socket option is enabled.
TcpNoDelayWhether or not to delay when sending packets.
UseIPv6Whether to use IPv6.
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2023 /n software inc. - All rights reserved.
IPWorks SSH 2020 Python Edition - Version 20.0 [Build 8501]