class documentation

class SSHClient:

View In Hierarchy

Full SSH-2 protocol client with multiple KEX algorithms

Method __del__ Undocumented
Method __init__ Undocumented
Method clear_output Clear all accumulated command output
Method connect Full SSH-2 connect: version exchange, KEX, auth
Method disconnect Send SSH_MSG_DISCONNECT and clean up
Method execute_command Execute a command over the encrypted SSH channel
Property error Undocumented
Property is_connected Undocumented
Property output Undocumented
Method _auth_password Password authentication
Method _build_kexinit Build our SSH_MSG_KEXINIT payload
Method _close_socket Undocumented
Method _collect_output Read channel data until EOF or close, return list of lines.
Method _derive_keys Derive encryption, IV, and MAC keys from shared secret
Method _do_curve25519_kex Curve25519 ECDH key exchange
Method _do_dh_group14_kex Diffie-Hellman Group 14 fixed-group key exchange
Method _do_gex_kex Diffie-Hellman Group Exchange key exchange
Method _do_kex Dispatch to the correct key exchange method
Method _drain_channel Drain all pending packets from the previous channel until fully closed.
Method _negotiate_kexinit Parse server KEXINIT and pick algorithms
Method _open_session_channel Open a session channel, draining any previous channel first.
Method _read_packet Read one SSH binary packet, decrypting if encryption is active
Method _read_ssh_packet Read a packet, transparently handling transport-level messages
Method _recv_exact Receive exactly n bytes
Method _request_service Send SSH_MSG_SERVICE_REQUEST
Method _resolve_host Resolve host with a practical LAN fallback for mDNS names.
Method _send_all Send all bytes
Method _send_exec Send exec request on the channel
Method _send_packet Build, optionally encrypt, and send an SSH binary packet
Method _window_adjust Send window adjust to allow server to send more data
Constant _CIPHERS Undocumented
Constant _CLIENT_VERSION Undocumented
Constant _COMPRESSION Undocumented
Constant _HOST_KEY_ALGORITHMS Undocumented
Constant _KEX_ALGORITHMS Undocumented
Constant _MACS Undocumented
Instance Variable _authenticated Undocumented
Instance Variable _channel_closed Undocumented
Instance Variable _channel_eof Undocumented
Instance Variable _channel_id Undocumented
Instance Variable _cipher_c2s Undocumented
Instance Variable _cipher_s2c Undocumented
Instance Variable _client_kexinit Undocumented
Instance Variable _connected Undocumented
Instance Variable _dec_cipher Undocumented
Instance Variable _enc_cipher Undocumented
Instance Variable _encrypted Undocumented
Instance Variable _error Undocumented
Instance Variable _kex_algorithm Undocumented
Instance Variable _lock Undocumented
Instance Variable _mac_c2s Undocumented
Instance Variable _mac_func Undocumented
Instance Variable _mac_key_c2s Undocumented
Instance Variable _mac_key_s2c Undocumented
Instance Variable _mac_len Undocumented
Instance Variable _mac_s2c Undocumented
Instance Variable _output Undocumented
Instance Variable _recv_seq Undocumented
Instance Variable _remote_channel Undocumented
Instance Variable _remote_max_pkt Undocumented
Instance Variable _remote_window Undocumented
Instance Variable _send_seq Undocumented
Instance Variable _server_kexinit Undocumented
Instance Variable _server_version Undocumented
Instance Variable _session_id Undocumented
Instance Variable _sock Undocumented
def __del__(self):

Undocumented

def __init__(self):

Undocumented

def clear_output(self):

Clear all accumulated command output

def connect(self, host, port, username, password):

Full SSH-2 connect: version exchange, KEX, auth

def disconnect(self):

Send SSH_MSG_DISCONNECT and clean up

def execute_command(self, command):

Execute a command over the encrypted SSH channel

@property
error: str =

Undocumented

@property
is_connected: bool =

Undocumented

@property
output: list =

Undocumented

def _auth_password(self, username, password):

Password authentication

def _build_kexinit(self):

Build our SSH_MSG_KEXINIT payload

def _close_socket(self):

Undocumented

def _collect_output(self):

Read channel data until EOF or close, return list of lines.

def _derive_keys(self, K, H, hash_cls):

Derive encryption, IV, and MAC keys from shared secret

def _do_curve25519_kex(self):

Curve25519 ECDH key exchange

def _do_dh_group14_kex(self):

Diffie-Hellman Group 14 fixed-group key exchange

def _do_gex_kex(self):

Diffie-Hellman Group Exchange key exchange

def _do_kex(self):

Dispatch to the correct key exchange method

def _drain_channel(self):

Drain all pending packets from the previous channel until fully closed.

def _negotiate_kexinit(self, server_payload):

Parse server KEXINIT and pick algorithms

def _open_session_channel(self):

Open a session channel, draining any previous channel first.

def _read_packet(self):

Read one SSH binary packet, decrypting if encryption is active

def _read_ssh_packet(self):

Read a packet, transparently handling transport-level messages

def _recv_exact(self, n):

Receive exactly n bytes

def _request_service(self, name):

Send SSH_MSG_SERVICE_REQUEST

def _resolve_host(self, host, port):

Resolve host with a practical LAN fallback for mDNS names.

def _send_all(self, data):

Send all bytes

def _send_exec(self, command):

Send exec request on the channel

def _send_packet(self, payload):

Build, optionally encrypt, and send an SSH binary packet

def _window_adjust(self, amount):

Send window adjust to allow server to send more data

_CIPHERS: str =

Undocumented

Value
'aes128-ctr,aes256-ctr'
_CLIENT_VERSION: str =

Undocumented

Value
'SSH-2.0-Picoware_1.6.9'
_COMPRESSION: str =

Undocumented

Value
'none'
_HOST_KEY_ALGORITHMS: str =

Undocumented

Value
'ssh-ed25519,rsa-sha2-256,rsa-sha2-512,ecdsa-sha2-nistp256,ssh-rsa'
_KEX_ALGORITHMS: str =

Undocumented

Value
'curve25519-sha256,[email protected],diffie-hellman-group-exchange-sh↵
a256,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1'
_MACS: str =

Undocumented

Value
'hmac-sha2-256,hmac-sha1'
_authenticated: bool =

Undocumented

_channel_closed: bool =

Undocumented

_channel_eof: bool =

Undocumented

_channel_id: int =

Undocumented

_cipher_c2s =

Undocumented

_cipher_s2c =

Undocumented

_client_kexinit =

Undocumented

_connected: bool =

Undocumented

_dec_cipher =

Undocumented

_enc_cipher =

Undocumented

_encrypted: bool =

Undocumented

_error: str =

Undocumented

_kex_algorithm =

Undocumented

_lock =

Undocumented

_mac_c2s =

Undocumented

_mac_func =

Undocumented

_mac_key_c2s =

Undocumented

_mac_key_s2c =

Undocumented

_mac_len: int =

Undocumented

_mac_s2c =

Undocumented

_output: list =

Undocumented

_recv_seq: int =

Undocumented

_remote_channel: int =

Undocumented

_remote_max_pkt: int =

Undocumented

_remote_window: int =

Undocumented

_send_seq: int =

Undocumented

_server_kexinit =

Undocumented

_server_version =

Undocumented

_session_id =

Undocumented

_sock =

Undocumented