Rshell Class
Properties Methods Events Configuration Settings Errors
The Rshell class is used to execute commands on a remote Unix machine using the rshell mechanism.
Syntax
class ipworks.Rshell
Remarks
The Rshell class allows remote execution of commands on UNIX hosts, or any other system with the rshell interface. Using the class is very simple. The destination is specified by the remote_host property, the login information is given by the local_user and remote_user properties. Then call the execute method with the Command to execute as a parameter. You can also set the command property to the command that you would like to execute for identical results. Further input can be supplied to the command by assigning data to the Text parameter of the send method, or via the stdin property.
The output of the command is returned through the on_stdout event. If an error happens on the protocol level, the error message can be found in the error_message property. Errors during command execution (the stderr stream) are given by the on_stderr event.
To be able to successfully use the class, the remote host must be set up to allow execution of commands via rshell from the machine the class runs on.
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
bytes_sent | The number of bytes actually sent after an assignment to Stdin. |
command | The command to be sent to the remote host. |
connected | Shows whether the class is connected. |
eof | If True, the connection has closed, and there is no buffered data available. |
eol | Used to break the stdout data stream into chunks separated by its value. |
err_eol | Used to break the stderr data stream into chunks separated by its value. |
error_message | The error message returned when any of the steps prior to command execution fail. |
firewall_auto_detect | This property tells the class whether or not to automatically detect and use firewall system settings, if available. |
firewall_type | This property determines the type of firewall to connect through. |
firewall_host | This property contains the name or IP address of firewall (optional). |
firewall_password | This property contains a password if authentication is to be used when connecting through the firewall. |
firewall_port | This property contains the TCP port for the firewall Host . |
firewall_user | This property contains a user name if authentication is to be used connecting through a firewall. |
local_host | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
local_port | The TCP port in the local host where the class binds. |
local_user | The identifier of the user on the local machine. |
remote_host | The address of the remote host. Domain names are resolved to IP addresses. |
remote_port | The remote shell service port (default is 514). |
remote_user | The id of the user on the remote host. |
stderr | Returns the standard error output (stderr) from the remote application. |
stdin | A string of data to be sent to the remote host while connected. |
stdout | Provides the standard output (stdout) from the remote application. |
timeout | A 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.
config | Sets or retrieves a configuration setting. |
disconnect | Disconnects from the RemoteHost . |
do_events | Processes events from the internal message queue. |
execute | Executes a Command on the remote host. |
interrupt | Interrupt the current method. |
reset | Reset the class. |
send | Sends standard input to the program executing on the remote host. |
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_connected | Fired immediately after a connection completes (or fails). |
on_connection_status | Fired to indicate changes in connection state. |
on_disconnected | Fired when a connection is closed. |
on_error | Information about errors during data delivery. |
on_stderr | Fired when data (complete lines) come in through stderr. |
on_stdout | Fired when data (complete lines) come in through stdout. |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
EnableStderr | Enables or disables secondary (stderr) stream. |
MaxStderr | Maximum storage available for the stderr buffer. |
MaxStdout | Maximum storage available for the stdout buffer. |
StderrPort | The local port from which the remote system sends the stderr stream. |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the class whether or not to automatically detect and use firewall system settings, if available. |
FirewallHost | Name or IP address of firewall (optional). |
FirewallPassword | Password to be used if authentication is to be used when connecting through the firewall. |
FirewallPort | The TCP port for the FirewallHost;. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
Linger | When set to True, connections are terminated gracefully. |
LingerTime | Time in seconds to have the connection linger. |
LocalHost | The name of the local host through which connections are initiated or accepted. |
LocalPort | The port in the local host where the class binds. |
MaxLineLength | The maximum amount of data to accumulate when no EOL is found. |
MaxTransferRate | The transfer rate limit in bytes per second. |
ProxyExceptionsList | A semicolon separated list of hosts and IPs to bypass when using a proxy. |
TCPKeepAlive | Determines whether or not the keep alive socket option is enabled. |
TcpNoDelay | Whether or not to delay when sending packets. |
UseIPv6 | Whether to use IPv6. |
LogSSLPackets | Controls whether SSL packets are logged when using the internal security API. |
OpenSSLCADir | The path to a directory containing CA certificates. |
OpenSSLCAFile | Name of the file containing the list of CA's trusted by your application. |
OpenSSLCipherList | A string that controls the ciphers to be used by SSL. |
OpenSSLPrngSeedData | The data to seed the pseudo random number generator (PRNG). |
ReuseSSLSession | Determines if the SSL session is reused. |
SSLCACertFilePaths | The paths to CA certificate files on Unix/Linux. |
SSLCACerts | A newline separated list of CA certificate to use during SSL client authentication. |
SSLCheckCRL | Whether to check the Certificate Revocation List for the server certificate. |
SSLCipherStrength | The minimum cipher strength used for bulk encryption. |
SSLEnabledCipherSuites | The cipher suite to be used in an SSL negotiation. |
SSLEnabledProtocols | Used to enable/disable the supported security protocols. |
SSLEnableRenegotiation | Whether the renegotiation_info SSL extension is supported. |
SSLIncludeCertChain | Whether the entire certificate chain is included in the SSLServerAuthentication event. |
SSLNegotiatedCipher | Returns the negotiated ciphersuite. |
SSLNegotiatedCipherStrength | Returns the negotiated ciphersuite strength. |
SSLNegotiatedCipherSuite | Returns the negotiated ciphersuite. |
SSLNegotiatedKeyExchange | Returns the negotiated key exchange algorithm. |
SSLNegotiatedKeyExchangeStrength | Returns the negotiated key exchange algorithm strength. |
SSLNegotiatedVersion | Returns the negotiated protocol version. |
SSLProvider | The name of the security provider to use. |
SSLSecurityFlags | Flags that control certificate verification. |
SSLServerCACerts | A newline separated list of CA certificate to use during SSL server certificate validation. |
TLS12SignatureAlgorithms | Defines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True. |
TLS12SupportedGroups | The supported groups for ECC. |
TLS13KeyShareGroups | The groups for which to pregenerate key shares. |
TLS13SignatureAlgorithms | The allowed certificate signature algorithms. |
TLS13SupportedGroups | The supported groups for (EC)DHE key exchange. |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
FirewallData | Used to send extra data to the firewall. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
ProcessIdleEvents | Whether the class uses its internal event loop to process events when the main thread is idle. |
SelectWaitMillis | The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process. |
UseInternalSecurityAPI | Tells the class whether or not to use the system security libraries or an internal implementation. |