class documentation

class _CommandTransport(SSHClientTransport): (source)

View In Hierarchy

_CommandTransport is an SSH client transport which includes a host key verification step before it will proceed to secure the connection.

_CommandTransport also knows how to set up a connection to an authentication agent if it is told where it can connect to one.

Method __init__
Method connection​Lost When the underlying connection to the SSH server is lost, if there were any connection setup errors, propagate them. Also, clean up the connection to the ssh agent if one was created.
Method connection​Secure When the connection is secure, start the authentication process.
Method verify​Host​Key Ask the KnownHostsFile provider available on the factory which created this protocol this protocol to verify the given host key.
Instance Variable connection​Ready Undocumented
Instance Variable creator Undocumented
Method _save​Host​Key​Failure When host key verification fails, record the reason for the failure in order to fire a Deferred with it later.
Instance Variable _host​Key​Failure Undocumented
Instance Variable _state Undocumented
Instance Variable _userauth The _UserAuth instance which is in charge of the overall authentication process or None if the SSH connection has not reach yet the user-auth service.

Inherited from SSHClientTransport:

Method connection​Made Called when the connection is started with the server. Just sets up a private instance variable.
Method request​Service Request that a service be run over this transport.
Method ssh_​KEX_​DH_​GEX_​GROUP This handles different messages which share an integer value.
Method ssh_​KEX_​DH_​GEX_​REPLY Called when we receive a MSG_KEX_DH_GEX_REPLY message. Payload:: string server host key integer f (server DH public key)
Method ssh_​KEXINIT Called when we receive a MSG_KEXINIT message. For a description of the packet, see SSHTransportBase.ssh_KEXINIT(). Additionally, this method sends the first key exchange packet.
Method ssh_​NEWKEYS Called when we receive a MSG_NEWKEYS message. No payload. If we've finished setting up our own keys, start using them. Otherwise, remember that we've received this message.
Method ssh_​SERVICE_​ACCEPT Called when we receive a MSG_SERVICE_ACCEPT message. Payload:: string service name
Instance Variable e our Diffie-Hellman public key.
Instance Variable ec​Priv Undocumented
Instance Variable ec​Pub Undocumented
Instance Variable g the Diffie-Hellman group generator.
Instance Variable instance the SSHService object we are requesting.
Instance Variable is​Client since we are always the client, this is always True.
Instance Variable p the Diffie-Hellman group prime
Instance Variable x our Diffie-Hellman private key.
Method _continue​GEX_​REPLY The host key has been verified, so we generate the keys.
Method _continue​KEXDH_​REPLY The host key has been verified, so we generate the keys.
Method _key​Setup See SSHTransportBase._keySetup().
Method _ssh_​KEX_​ECDH_​REPLY Called to handle a reply to a ECDH exchange message(KEX_ECDH_INIT).
Method _ssh_​KEXDH_​REPLY Called to handle a reply to a non-group key exchange message (KEXDH_INIT).
Instance Variable _dh​Maximal​Group​Size Maximal acceptable group size advertised by the client in MSG_KEX_DH_GEX_REQUEST.
Instance Variable _dh​Minimal​Group​Size Minimal acceptable group size advertised by the client in MSG_KEX_DH_GEX_REQUEST.
Instance Variable _dh​Preferred​Group​Size Preferred group size advertised by the client in MSG_KEX_DH_GEX_REQUEST.
Instance Variable _got​New​Keys if we receive a MSG_NEWKEYS message before we are ready to transition to the new keys, this is set to True so we can transition when the keys are ready locally.

Inherited from SSHTransportBase (via SSHClientTransport):

Method data​Received First, check for the version string (SSH-2.0-*). After that has been received, this method adds data to the buffer, and pulls out any packets.
Method dispatch​Message Send a received message to the appropriate method.
Method get​Host Returns an SSHTransportAddress corresponding to the this side of transport.
Method get​Packet Try to return a decrypted, authenticated, and decompressed packet out of the buffer. If there is not enough data, return None.
Method get​Peer Returns an SSHTransportAddress corresponding to the other (peer) side of this transport.
Method is​Encrypted Check if the connection is encrypted in the given direction.
Method is​Verified Check if the connection is verified/authentication in the given direction.
Method kex​Alg​.setter Set the key exchange algorithm name.
Method lose​Connection Lose the connection to the other side, sending a DISCONNECT_CONNECTION_LOST message.
Method receive​Debug Called when we receive a debug message from the other side.
Method receive​Error Called when we receive a disconnect error message from the other side.
Method receive​Unimplemented Called when we receive an unimplemented packet message from the other side.
Method send​Debug Send a debug message to the other side.
Method send​Disconnect Send a disconnect message to the other side and then disconnect.
Method send​Ignore Send a message that will be ignored by the other side. This is useful to fool attacks based on guessing packet sizes in the encrypted stream.
Method send​Kex​Init Send a KEXINIT message to initiate key exchange or to respond to a key exchange initiated by the peer.
Method send​Packet Sends a packet. If it's been set up, compress the data, encrypt it, and authenticate it before sending. If key exchange is in progress and the message is not part of key exchange, queue it to be sent later.
Method send​Unimplemented Send a message to the other side that the last packet was not understood.
Method set​Service Set our service to service and start it running. If we were running a service previously, stop it first.
Method ssh_​DEBUG No summary
Method ssh_​DISCONNECT Called when we receive a MSG_DISCONNECT message. Payload:: long code string description
Method ssh_​IGNORE Called when we receive a MSG_IGNORE message. No payload. This means nothing; we simply return.
Method ssh_​UNIMPLEMENTED Called when we receive a MSG_UNIMPLEMENTED message. Payload:: long packet
Instance Variable buf Data we've received but hasn't been parsed into a packet.
Instance Variable comment An optional string giving more information about the server or client.
Instance Variable current​Encryptions an SSHCiphers instance. It represents the current encryption and authentication options for the transport.
Instance Variable dh​Secret​Key Undocumented
Instance Variable dh​Secret​Key​Public​MP Undocumented
Instance Variable first the first bytes of the next packet. In order to avoid decrypting data twice, the first bytes are decrypted and stored until the whole packet is available.
Instance Variable got​Version A boolean indicating whether we have received the version string from the other side.
Instance Variable incoming​Compression an object supporting the .decompress(str) method, or None if there is no incoming compression. Used to decompress incoming data.
Instance Variable incoming​Compression​Type A string representing the incoming compression type.
Instance Variable incoming​Packet​Sequence the sequence number of the next packet we are expecting from the other side.
Instance Variable kex​Alg The key exchange algorithm name agreed between client and server.
Instance Variable key​Alg the agreed-upon public key type for the key exchange.
Instance Variable next​Encryptions an SSHCiphers instance. Held here until the MSG_NEWKEYS messages are exchanged, when nextEncryptions is transitioned to currentEncryptions.
Instance Variable other​Kex​Init​Payload the MSG_KEXINIT payload we received. Used in the key exchange
Instance Variable other​Version​String the version string sent by the other side. Used in the key exchange.
Instance Variable our​Kex​Init​Payload the MSG_KEXINIT payload we sent. Used in the key exchange.
Instance Variable our​Version​String the version string that we sent to the other side. Used in the key exchange.
Instance Variable outgoing​Compression an object supporting the .compress(str) and .flush() methods, or None if there is no outgoing compression. Used to compress outgoing data.
Instance Variable outgoing​Compression​Type A string representing the outgoing compression type.
Instance Variable outgoing​Packet​Sequence the sequence number of the next packet we will send.
Instance Variable protocol​Version A string representing the version of the SSH protocol we support. Currently defaults to '2.0'.
Instance Variable service an SSHService instance, or None. If it's set to an object, it's the currently running service.
Instance Variable session​ID a string that is unique to this SSH session. Created as part of the key exchange, sessionID is used to generate the various encryption and authentication keys.
Instance Variable supported​Ciphers A list of strings representing the encryption algorithms supported, in order from most-preferred to least.
Instance Variable supported​Compressions A list of strings representing compression types supported, from most-preferred to least.
Instance Variable supported​Key​Exchanges A list of strings representing the key exchanges supported, in order from most-preferred to least.
Instance Variable supported​Languages A list of strings representing languages supported, from most-preferred to least.
Instance Variable supported​MACs A list of strings representing the message authentication codes (hashes) supported, in order from most-preferred to least. Both this and supportedCiphers can include 'none' to use no encryption or authentication, but that must be done manually,
Instance Variable supported​Public​Keys A list of strings representing the public key types supported, in order from most-preferred to least.
Instance Variable supported​Versions A container of strings representing supported ssh protocol version numbers.
Instance Variable version A string representing the version of the server or client. Currently defaults to 'Twisted'.
Method _allowed​Key​Exchange​Message​Type Determine if the given message type may be sent while key exchange is in progress.
Method _encode​ECPublic​Key Encode an elliptic curve public key to bytes.
Method _finish​Ephemeral​DH Completes the Diffie-Hellman key agreement started by _startEphemeralDH, and forgets the ephemeral secret key.
Method _generate​ECPrivate​Key Generate an private key for ECDH key exchange.
Method _generate​ECShared​Secret Generate a shared secret for ECDH key exchange.
Method _get​Key Get one of the keys for authentication/encryption.
Method _new​Keys No summary
Method _start​Ephemeral​DH Prepares for a Diffie-Hellman key agreement exchange.
Method _unsupported​Version​Received Called when an unsupported version of the ssh protocol is received from the remote endpoint.
Constant _KEY​_EXCHANGE​_NONE Undocumented
Constant _KEY​_EXCHANGE​_PROGRESSING Undocumented
Constant _KEY​_EXCHANGE​_REQUESTED Undocumented
Class Variable _log Undocumented
Instance Variable _blocked​By​Key​Exchange Whenever _keyExchangeState is not _KEY_EXCHANGE_NONE, this is a list of pending messages which were passed to sendPacket but could not be sent because it is not legal to send them while a key exchange is in progress. When the key exchange completes, another attempt is made to send these messages.
Instance Variable _kex​Alg Undocumented
Instance Variable _key​Exchange​State The current protocol state with respect to key exchange. This is either _KEY_EXCHANGE_NONE if no key exchange is in progress (and returns to this value after any key exchange completqes), _KEY_EXCHANGE_REQUESTED if this side of the connection initiated a key exchange, and _KEY_EXCHANGE_PROGRESSING if the other side of the connection initiated a key exchange. _KEY_EXCHANGE_NONE is the initial value (however SSH connections begin with key exchange, so it will quickly change to another state).

Inherited from Protocol (via SSHClientTransport, SSHTransportBase):

Method log​Prefix Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable factory Undocumented

Inherited from BaseProtocol (via SSHClientTransport, SSHTransportBase, Protocol):

Method make​Connection Make a connection to a transport and a server.
Instance Variable connected Undocumented
Instance Variable transport Undocumented
def __init__(self, creator): (source)
Parameters
creator:_NewConnectionHelper.The _NewConnectionHelper that created this connection.
def connectionLost(self, reason): (source)
When the underlying connection to the SSH server is lost, if there were any connection setup errors, propagate them. Also, clean up the connection to the ssh agent if one was created.
def connectionSecure(self): (source)
When the connection is secure, start the authentication process.
def verifyHostKey(self, hostKey, fingerprint): (source)
Ask the KnownHostsFile provider available on the factory which created this protocol this protocol to verify the given host key.
Returns
A Deferred which fires with the result of KnownHostsFile.verifyHostKey.
connectionReady = (source)

Undocumented

creator = (source)

Undocumented

def _saveHostKeyFailure(self, reason): (source)
When host key verification fails, record the reason for the failure in order to fire a Deferred with it later.
Parameters
reason:FailureThe cause of the host key verification failure.
Returns
Failurereason
_hostKeyFailure = (source)

Undocumented

_state: bytes = (source)

Undocumented

_userauth: _UserAuth = (source)
The _UserAuth instance which is in charge of the overall authentication process or None if the SSH connection has not reach yet the user-auth service.