%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/paramiko/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/paramiko/__pycache__/transport.cpython-312.pyc

�

K�ea���J�dZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZm
Z
ddlmZddlmZmZmZddlZddlmZddlmZdd	lmZdd
lmZddlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKddlLmMZMmNZNdd
lOmPZPddlQmRZRddlSmTZTddlUmVZVmWZWddlXmYZYddlZm[Z[m\Z\ddl]m^Z^ddl_m`Z`maZambZbddlcmdZdmeZemfZfddlgmhZhddlimjZjmkZkddllmmZmddlnmoZompZpmqZqmrZrmsZsmtZtddlumvZvddlwmxZxddlymzZzddl{m|Z|ddl}m~Z~mZm�Z�m�Z�m�Z�m�Z�ddl�m�Z�m�Z�m�Z�gZ�d �Z�ddl�Z�e��je��Gd!�d"e�je��Z�Gd#�d$e��Z�Gd%�d&e��Z�y)'z
Core protocol implementation
�)�print_functionN)�md5�sha1�sha256�sha512)�default_backend)�
algorithms�Cipher�modes)�util)�AuthHandler)�GSSAuth)�Channel)/�	xffffffff�cMSG_CHANNEL_OPEN�cMSG_IGNORE�cMSG_GLOBAL_REQUEST�DEBUG�MSG_KEXINIT�
MSG_IGNORE�MSG_DISCONNECT�	MSG_DEBUG�ERROR�WARNING�cMSG_UNIMPLEMENTED�INFO�cMSG_KEXINIT�cMSG_NEWKEYS�MSG_NEWKEYS�cMSG_REQUEST_SUCCESS�cMSG_REQUEST_FAILURE�CONNECTION_FAILED_CODE�'OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED�OPEN_SUCCEEDED�cMSG_CHANNEL_OPEN_FAILURE�cMSG_CHANNEL_OPEN_SUCCESS�MSG_GLOBAL_REQUEST�MSG_REQUEST_SUCCESS�MSG_REQUEST_FAILURE�MSG_CHANNEL_OPEN_SUCCESS�MSG_CHANNEL_OPEN_FAILURE�MSG_CHANNEL_OPEN�MSG_CHANNEL_SUCCESS�MSG_CHANNEL_FAILURE�MSG_CHANNEL_DATA�MSG_CHANNEL_EXTENDED_DATA�MSG_CHANNEL_WINDOW_ADJUST�MSG_CHANNEL_REQUEST�MSG_CHANNEL_EOF�MSG_CHANNEL_CLOSE�MIN_WINDOW_SIZE�MIN_PACKET_SIZE�MAX_WINDOW_SIZE�DEFAULT_WINDOW_SIZE�DEFAULT_MAX_PACKET_SIZE�HIGHEST_USERAUTH_MESSAGE_ID�MSG_UNIMPLEMENTED�	MSG_NAMES�MSG_EXT_INFO�
cMSG_EXT_INFO)�ZlibCompressor�ZlibDecompressor)�DSSKey)�
Ed25519Key)�
KexCurve25519)�KexGex�KexGexSHA256)�	KexGroup1)�
KexGroup14�KexGroup14SHA256)�KexGroup16SHA512)�KexNistp256�KexNistp384�KexNistp521)�	KexGSSGex�KexGSSGroup1�
KexGSSGroup14)�Message)�
Packetizer�NeedRekeyException)�ModulusPack)�string_types�long�byte_ord�b�input�PY2)�RSAKey)�ECDSAKey)�ServerInterface)�
SFTPClient)�SSHException�BadAuthenticationType�ChannelException�IncompatiblePeer�MessageOrderError�ProxyCommandFailure)�retry_on_signal�ClosingContextManager�clamp_valuec�:�tD]}|j��y�N)�_active_threads�stop_thread)�thrs �4/usr/lib/python3/dist-packages/paramiko/transport.py�_join_lingering_threadsrm{s����������c���eZdZdZe�Ze�ZdZdje	j�ZdZdZ
dZdZdZej$�rdezZd	Zd
Zej,ej0ddd�ej,ej0dd
d�ej,ej0ddd�ej,ej2ddd�ej,ej2dd
d�ej,ej2ddd�ej4ej2dd
d�d�Zedd�edd�edd�edd�edd�edd�edd�edd�d�Z ide!�de!�de!�de!�de!�de!�de"�de"�de#�de#�de#�d e#�d!e#�d"e#�d#e$�d$e$�Z%e&e'e(e)e*e+e,e-e.e/e0e1d%�Z2ej$�ree2d&<e3e4fe3e4fd'd(�Z5d)Z6d*Z7e8e9d+d,d)d,d,d)fd-�Z:d.�Z;e<d/��Z=e<d0��Z>e<d1��Z?e<d2��Z@e<d3��ZAe<d4��ZBd5�ZCd6�ZDd7�ZEd�d8�ZFd'd9�ZGd'd:�ZHd;�ZId<�ZJeKd�d=��ZLd>�ZMd?�ZNd@�ZO	d�dA�ZPd�dB�ZQdC�ZRdD�ZS					d�dE�ZTd�dF�ZUdG�ZVdH�ZWd�dI�ZXdJ�ZYdK�ZZd�dL�Z[d�dM�Z\									d�dN�Z]dO�Z^dP�Z_dQ�Z`dR�ZadS�ZbdT�Zcd�dU�Zdd�dV�Zed�dW�Zfd�dX�ZgdY�ZhdZ�Zid[�Zjd\�Zkd]�Zld^�Zmd�d_�Znd`�Zoda�Zpdb�Zqdc�Zrdd�Zsde�Ztdf�Zudg�Zvdh�Zwdi�Zxdj�Zydk�Zzdl�Z{dm�Z|dn�Z}do�Z~dp�Zdq�Z�dr�Z�ds�Z�dt�Z�du�Z�dv�Z�dw�Z�dx�Z�d�dy�Z�dz�Z�d{�Z�d|�Z�d}�Z�d~�Z�d�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�e��j6e�e��j:e�e��j>e�e��jBe�e��jFe�e��jJe�e��jNe�e��jRiZ�y))��	Transporta�
    An SSH Transport attaches to a stream (usually a socket), negotiates an
    encrypted session, authenticates, and then creates stream tunnels, called
    `channels <.Channel>`, across the session.  Multiple channels can be
    multiplexed across a single session (and often are, in the case of port
    forwardings).

    Instances of this class may be used as context managers.
    �2.0zparamiko_{})z
aes128-ctrz
aes192-ctrz
aes256-ctrz
aes128-cbcz
aes192-cbcz
aes256-cbcz3des-cbc)�
hmac-sha2-256�
hmac-sha2-512�hmac-sha2-256-etm@openssh.com�hmac-sha2-512-etm@openssh.com�	hmac-sha1�hmac-md5�hmac-sha1-96�hmac-md5-96)�ssh-ed25519�ecdsa-sha2-nistp256�ecdsa-sha2-nistp384�ecdsa-sha2-nistp521�rsa-sha2-512�rsa-sha2-256�ssh-rsa�ssh-dss)	�ecdh-sha2-nistp256�ecdh-sha2-nistp384�ecdh-sha2-nistp521�diffie-hellman-group16-sha512�$diffie-hellman-group-exchange-sha256�diffie-hellman-group14-sha256�"diffie-hellman-group-exchange-sha1�diffie-hellman-group14-sha1�diffie-hellman-group1-sha1)�curve25519-sha256@libssh.org)�%gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==�)gss-group14-sha1-toWM5Slw5Ew8Mqkay+al2g==�(gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==��none�)�class�mode�
block-size�key-size�� ��)r��size��@)rvrxrrrtrsrurwryr�zssh-rsa-cert-v01@openssh.comrz!rsa-sha2-256-cert-v01@openssh.comr~z!rsa-sha2-512-cert-v01@openssh.comr�zssh-dss-cert-v01@openssh.comr{z(ecdsa-sha2-nistp256-cert-v01@openssh.comr|z(ecdsa-sha2-nistp384-cert-v01@openssh.comr}z(ecdsa-sha2-nistp521-cert-v01@openssh.comrzz ssh-ed25519-cert-v01@openssh.com)r�r�r�r�r�r�r�r�r�r�r�r�r�)NN��zlib@openssh.com�zlibr�N皙�����?FTc
��	����d|_d|_i|_||_d|_t�t�rE�jdd�}
|
d|_t|
�dk(r|
ddf�n|
dt|
d�f�t��tur��\���|_d}tj��tjtj�}|D]T\}
}}}}|tjk(s�|
}tj|tj��	t!���fd��nt'd	j)�|���t*j,j/|�d
|_�|_|j2j5|j6�|	xst8��|_d|j<zdz|j>z|_ d
|_!d
x|_"|_#dx|_$|_%dx|_&|_'dx|_(|_)d|_*d|_+d|_,||_-d|_.d|_/d|_0|jZr/tcd|�|_/|jd|jfz|_3d|_4d|_5d|_6d|_7d|_8d|_9t�|_:t+jv�|_<t{�|_>i|_?i|_@d|_A||_B||_Cd|_Dd|_Ed|_Fd|_Gt+j��|_It+jv�|_Jd|_Kd|_Lt�j�|j��|_O|j:j�|j��d|_Qd|_Rd|_Sd|_Td|_Ud|_V|xsi|_W||_Xd|_Yd|_Zi|_[g|_\t+j�|jx�|_^i|__t�|j�t�|j�t�|j�t�|j�t�|j�t�|j�t�|j�t�|j�t�|j�i	|_ry#tj"$r}t%|�}Yd}~��d}~wwxYw)a�
        Create a new SSH session over an existing socket, or socket-like
        object.  This only creates the `.Transport` object; it doesn't begin
        the SSH session yet.  Use `connect` or `start_client` to begin a client
        session, or `start_server` to begin a server session.

        If the object is not actually a socket, it must have the following
        methods:

        - ``send(str)``: Writes from 1 to ``len(str)`` bytes, and returns an
          int representing the number of bytes written.  Returns
          0 or raises ``EOFError`` if the stream has been closed.
        - ``recv(int)``: Reads from 1 to ``int`` bytes and returns them as a
          string.  Returns 0 or raises ``EOFError`` if the stream has been
          closed.
        - ``close()``: Closes the socket.
        - ``settimeout(n)``: Sets a (float) timeout on I/O operations.

        For ease of use, you may also pass in an address (as a tuple) or a host
        string as the ``sock`` argument.  (A host string is a hostname with an
        optional port (separated by ``":"``) which will be converted into a
        tuple of ``(hostname, port)``.)  A socket will be connected to this
        address and used for communication.  Exceptions from the ``socket``
        call may be thrown in this case.

        .. note::
            Modifying the the window and packet sizes might have adverse
            effects on your channels created from this transport. The default
            values are the same as in the OpenSSH code base and have been
            battle tested.

        :param socket sock:
            a socket or socket-like object to create the session over.
        :param int default_window_size:
            sets the default window size on the transport. (defaults to
            2097152)
        :param int default_max_packet_size:
            sets the default max packet size on the transport. (defaults to
            32768)
        :param bool gss_kex:
            Whether to enable GSSAPI key exchange when GSSAPI is in play.
            Default: ``False``.
        :param bool gss_deleg_creds:
            Whether to enable GSSAPI credential delegation when GSSAPI is in
            play. Default: ``True``.
        :param dict disabled_algorithms:
            If given, must be a dictionary mapping algorithm type to an
            iterable of algorithm identifiers, which will be disabled for the
            lifetime of the transport.

            Keys should match the last word in the class' builtin algorithm
            tuple attributes, such as ``"ciphers"`` to disable names within
            ``_preferred_ciphers``; or ``"kex"`` to disable something defined
            inside ``_preferred_kex``. Values should exactly match members of
            the matching attribute.

            For example, if you need to disable
            ``diffie-hellman-group16-sha512`` key exchange (perhaps because
            your code talks to a server which implements it differently from
            Paramiko), specify ``disabled_algorithms={"kex":
            ["diffie-hellman-group16-sha512"]}``.
        :param bool server_sig_algs:
            Whether to send an extra message to compatible clients, in server
            mode, with a list of supported pubkey algorithms. Default:
            ``True``.
        :param bool strict_kex:
            Whether to advertise (and implement, if client also advertises
            support for) a "strict kex" mode for safer handshaking. Default:
            ``True``.
        :param packetizer_class:
            Which class to use for instantiating the internal packet handler.
            Default: ``None`` (i.e.: use `Packetizer` as normal).

        .. versionchanged:: 1.15
            Added the ``default_window_size`` and ``default_max_packet_size``
            arguments.
        .. versionchanged:: 1.15
            Added the ``gss_kex`` and ``gss_deleg_creds`` kwargs.
        .. versionchanged:: 2.6
            Added the ``disabled_algorithms`` kwarg.
        .. versionchanged:: 2.9
            Added the ``server_sig_algs`` kwarg.
        .. versionchanged:: 3.4
            Added the ``strict_kex`` kwarg.
        .. versionchanged:: 3.4
            Added the ``packetizer_class`` kwarg.
        FN�:�r�zNo suitable address familyc�*���j��f�Srh)�connect)�hostname�port�socks���rl�<lambda>z$Transport.__init__.<locals>.<lambda>�s������h��=M�0N�rnzUnable to connect to {}: {}T�SSH-�-�zgssapi-keyexg>@zparamiko.transport��)s�activer��server_extensions�advertise_strict_kex�agreed_on_strict_kex�
isinstancerT�split�len�int�type�tuple�socket�getaddrinfo�	AF_UNSPEC�SOCK_STREAMrd�error�strr^�format�	threading�Thread�__init__�daemonr��
settimeout�_active_check_timeoutrQ�
packetizer�	_PROTO_ID�
_CLIENT_ID�
local_version�remote_version�local_cipher�
remote_cipher�local_kex_init�remote_kex_init�	local_mac�
remote_mac�local_compression�remote_compression�
session_id�
host_key_type�host_key�use_gss_kex�gss_kex_used�kexgss_ctxt�gss_hostr�_preferred_gsskex�_preferred_kex�
kex_engine�H�K�initial_kex_done�in_kex�
authenticated�_expected_packet�Lock�lock�
ChannelMap�	_channels�channel_events�
channels_seen�_channel_counter�default_max_packet_size�default_window_size�_forward_agent_handler�_x11_handler�_tcp_handler�saved_exception�Event�
clear_to_send�clear_to_send_lock�clear_to_send_timeout�log_namer�
get_logger�logger�set_log�auth_handler�global_response�completion_event�banner_timeout�handshake_timeout�auth_timeout�disabled_algorithms�server_sig_algs�server_mode�
server_object�server_key_dict�server_accepts�	Condition�server_accept_cv�subsystem_tabler=�_parse_ext_infor�_parse_newkeysr'�_parse_global_requestr(�_parse_request_successr)�_parse_request_failurer*�_parse_channel_open_successr+�_parse_channel_open_failurer,�_parse_channel_openr�_negotiate_keys�_handler_table)�selfr�r�r��gss_kex�gss_deleg_credsr�r�
strict_kex�packetizer_class�hl�reason�	addrinfos�family�socktype�proto�	canonname�sockaddr�af�er�r�s `                  @@rlr�zTransport.__init__Dsf���F�����
�!#���$.��!�$)��!��d�L�)����C��#�B��q�E�D�M��2�w�!�|��1��r�{���1��s�2�a�5�z�*����:���!�N�H�d�$�D�M�1�F��*�*��$�� 0� 0�&�2D�2D��I�AJ�
�<���%��H��v�1�1�1��B�!�=�=��V�-?�-?�@�D��'�(N�O��
�#�1�8�8��6�J���	���!�!�$�'������	�	
�	�	���T�7�7�8�:�+�9�z�4�@���#�d�n�n�4�s�:�T�_�_�L��� ���13�3���D�.�59�9���d�2�+/�/�����;?�?����!8����!�����
�#���!��������
����&�~��G�D��"&�"8�"8�4�;N�;N�"N�D����������� %������"��� %�����N�N�$��	�$���� ������ !���'>��$�#6�� �&*��#� ��� ���#���&�_�_�.���"+�.�.�"2���%)��"�,��
��o�o�d�m�m�4�����������,� ���#��� $��� ���"$������#6�#<�"�� �.���!���!���!��� ��� )� 3� 3�D�I�I� >���!���

�$�.�.���,�,��� :� :���!<�!<���!<�!<�$�d�&F�&F�$�d�&F�&F��d�6�6���-�-�

����{"�<�<�(�!$�Q����(�s�R=�=S&�S!�!S&c�f���t�dj���}t��fd�|D��S)Nz
_preferred_{}c3�^�K�|]$}|�jj�g�vr|���&y�wrh)r��get)�.0�xr�type_s  ��rl�	<genexpr>z.Transport._filter_algorithm.<locals>.<genexpr>/s4�����
����0�0�4�4�U�B�?�?�
�
�s�*-)�getattrr�r�)rr&�defaults`` rl�_filter_algorithmzTransport._filter_algorithm-s4����$�� 6� 6�u� =�>���
��
�
�	
rnc�$�|jd�S)N�ciphers�r*�rs rl�preferred_cipherszTransport.preferred_ciphers5����%�%�i�0�0rnc�$�|jd�S)N�macsr-r.s rl�preferred_macszTransport.preferred_macs9s���%�%�f�-�-rnc�`�|jd�}t|td�|D��z�S)N�keysc3�>K�|]}dj|����y�w)z{}-cert-v01@openssh.comN)r�)r$r%s  rlr'z+Transport.preferred_keys.<locals>.<genexpr>Fs����J�A�-�4�4�Q�7�J�s�)r*r�)r�filtereds  rl�preferred_keyszTransport.preferred_keys=s8���)�)�&�1�����J��J�J�
K�
�	
rnc�$�|jd�S)N�pubkeysr-r.s rl�preferred_pubkeyszTransport.preferred_pubkeysIr0rnc�$�|jd�S)N�kexr-r.s rl�
preferred_kexzTransport.preferred_kexMs���%�%�e�,�,rnc�$�|jd�S)N�compressionr-r.s rl�preferred_compressionzTransport.preferred_compressionQs���%�%�m�4�4rnc���ttt|��tz�}dj	|�}|j
s|dz
}n�|jdk7r<|dj	|j|j|jddz�z
}|j�r(|dj	t|j��z
}n|jr|dz
}n|d	z
}|d
z
}|S)�P
        Returns a string representation of this object, for debugging.
        z<paramiko.Transport at {}z (unconnected)r�z (cipher {}, {:d} bits)r�r�z (active; {} open channel(s))z (connected; awaiting auth)z
 (connecting)�>)�hexrU�idrr�r�r��_cipher_info�is_authenticatedr�r�r�)r�id_�outs   rl�__repr__zTransport.__repr__Us����$�r�$�x�.�9�,�-��)�0�0��5���{�{��#�#�C�� � �B�&��0�7�7��%�%��%�%�d�&7�&7�8��D�q�H�����$�$�&��6�=�=�����'�����&�&��4�4����&���s�
���
rnc�X�|jj�|j�y)a�
        Terminate this Transport without closing the session.  On posix
        systems, if a Transport is open during process forking, both parent
        and child will share the underlying socket, but only one process can
        use the connection (without corrupting the session).  Use this method
        to clean up a Transport object without disrupting the other process.

        .. versionadded:: 1.5.3
        N)r��closer.s rl�atforkzTransport.atforkns��	
�	�	�����
�
�rnc��t|�S)a
        Return a `.SecurityOptions` object which can be used to tweak the
        encryption algorithms this transport will permit (for encryption,
        digest/hash operations, public keys, and key exchanges) and the order
        of preference for them.
        )�SecurityOptionsr.s rl�get_security_optionszTransport.get_security_options{s���t�$�$rnc�f�|sy|�|j}|r|�tj|�}||_y)a�
        Normalize/canonicalize ``self.gss_host`` depending on various factors.

        :param str gss_host:
            The explicitly requested GSS-oriented hostname to connect to (i.e.
            what the host's name is in the Kerberos database.) Defaults to
            ``self.hostname`` (which will be the 'real' target hostname and/or
            host portion of given socket object.)
        :param bool trust_dns:
            Indicates whether or not DNS is trusted; if true, DNS will be used
            to canonicalize the GSS hostname (which again will either be
            ``gss_host`` or the transport's default hostname.)
            (Defaults to True due to backwards compatibility.)
        :param bool gssapi_requested:
            Whether GSSAPI key exchange or authentication was even requested.
            If not, this is a no-op and nothing happens
            (and ``self.gss_host`` is not set.)
            (Defaults to True due to backwards compatibility.)
        :returns: ``None``.
        N)r�r��getfqdnr�)rr��	trust_dns�gssapi_requesteds    rl�set_gss_hostzTransport.set_gss_host�s8��, �����}�}�H���-��~�~�h�/�H� ��
rnc��d|_|�||_|j�ytj�x|_}|j�|�tj
�|znd}	|j
d�|js|j�}|�|�td��|j�s|�tj
�|k\ry�g)a|
        Negotiate a new SSH2 session as a client.  This is the first step after
        creating a new `.Transport`.  A separate thread is created for protocol
        negotiation.

        If an event is passed in, this method returns immediately.  When
        negotiation is done (successful or not), the given ``Event`` will
        be triggered.  On failure, `is_active` will return ``False``.

        (Since 1.4) If ``event`` is ``None``, this method will not return until
        negotiation is done.  On success, the method returns normally.
        Otherwise an SSHException is raised.

        After a successful negotiation, you will usually want to authenticate,
        calling `auth_password <Transport.auth_password>` or
        `auth_publickey <Transport.auth_publickey>`.

        .. note:: `connect` is a simpler method for connecting as a client.

        .. note::
            After calling this method (or `start_server` or `connect`), you
            should no longer directly read from or write to the original socket
            object.

        :param .threading.Event event:
            an event to trigger when negotiation is complete (optional)

        :param float timeout:
            a timeout, in seconds, for SSH2 session negotiation (optional)

        :raises:
            `.SSHException` -- if negotiation fails (and no ``event`` was
            passed in)
        TNr��Negotiation failed.)
r�r��startr�r��time�wait�
get_exceptionr^�is_set)r�event�timeout�max_timer s     rl�start_clientzTransport.start_client�s���F�����$)�D�!��J�J�L��)2���(9�9�����
�
��,3�,?�4�9�9�;��(�T����J�J�s�O��;�;��&�&�(���=��G�"�#8�9�9��|�|�~��#��	�	��x�(?��rnc�l�|�
t�}d|_||_d|_|�||_|j�yt
j�x|_}|j�	|jd�|js|j�}|�|�td��|j�ry�N)ap
        Negotiate a new SSH2 session as a server.  This is the first step after
        creating a new `.Transport` and setting up your server host key(s).  A
        separate thread is created for protocol negotiation.

        If an event is passed in, this method returns immediately.  When
        negotiation is done (successful or not), the given ``Event`` will
        be triggered.  On failure, `is_active` will return ``False``.

        (Since 1.4) If ``event`` is ``None``, this method will not return until
        negotiation is done.  On success, the method returns normally.
        Otherwise an SSHException is raised.

        After a successful negotiation, the client will need to authenticate.
        Override the methods `get_allowed_auths
        <.ServerInterface.get_allowed_auths>`, `check_auth_none
        <.ServerInterface.check_auth_none>`, `check_auth_password
        <.ServerInterface.check_auth_password>`, and `check_auth_publickey
        <.ServerInterface.check_auth_publickey>` in the given ``server`` object
        to control the authentication process.

        After a successful authentication, the client should request to open a
        channel.  Override `check_channel_request
        <.ServerInterface.check_channel_request>` in the given ``server``
        object to allow channels to be opened.

        .. note::
            After calling this method (or `start_client` or `connect`), you
            should no longer directly read from or write to the original socket
            object.

        :param .threading.Event event:
            an event to trigger when negotiation is complete.
        :param .ServerInterface server:
            an object used to perform authentication and create `channels
            <.Channel>`

        :raises:
            `.SSHException` -- if negotiation fails (and no ``event`` was
            passed in)
        NTr�rX)r\rrr�r�rYr�r�r[r\r^r])rr^�serverr s    rl�start_serverzTransport.start_server�s���T�>�$�&�F����#��������$)�D�!��J�J�L��)2���(9�9�����
�
����J�J�s�O��;�;��&�&�(���=��G�"�#8�9�9��|�|�~��rnc��||j|j�<t|t�r||jd<||jd<yy)a
        Add a host key to the list of keys used for server mode.  When behaving
        as a server, the host key is used to sign certain packets during the
        SSH2 negotiation, so that the client can trust that we are who we say
        we are.  Because this is used for signing, the key must contain private
        key info, not just the public half.  Only one key of each type (RSA or
        DSS) is kept.

        :param .PKey key:
            the host key to add, usually an `.RSAKey` or `.DSSKey`.
        rr~N)r�get_namer�rZ)r�keys  rl�add_server_keyzTransport.add_server_key"sK��03����S�\�\�^�,��c�6�"�36�D� � ��0�36�D� � ��0�#rnc�T�	|j|jS#t$rYywxYw)a�
        Return the active host key, in server mode.  After negotiating with the
        client, this method will return the negotiated host key.  If only one
        type of host key was set with `add_server_key`, that's the only key
        that will ever be returned.  But in cases where you have set more than
        one type of host key (for example, an RSA key and a DSS key), the key
        type will be negotiated by the client, and this method will return the
        key of the type agreed on.  If the host key has not been negotiated
        yet, ``None`` is returned.  In client mode, the behavior is undefined.

        :return:
            host key (`.PKey`) of the type negotiated by the client, or
            ``None``.
        N)rr��KeyErrorr.s rl�get_server_keyzTransport.get_server_key6s3��	��'�'��(:�(:�;�;���	���	�s��	'�'c���t�t_ddg}|�|jd|�|D]#}	tjj	|�ydt_y#t
$rY�=wxYw)a�
        (optional)
        Load a file of prime moduli for use in doing group-exchange key
        negotiation in server mode.  It's a rather obscure option and can be
        safely ignored.

        In server mode, the remote client may request "group-exchange" key
        negotiation, which asks the server to send a random prime number that
        fits certain criteria.  These primes are pretty difficult to compute,
        so they can't be generated on demand.  But many systems contain a file
        of suitable primes (usually named something like ``/etc/ssh/moduli``).
        If you call `load_server_moduli` and it returns ``True``, then this
        file of primes has been loaded and we will support "group-exchange" in
        server mode.  Otherwise server mode will just claim that it doesn't
        support that method of key negotiation.

        :param str filename:
            optional path to the moduli file, if you happen to know that it's
            not in a standard location.
        :return:
            True if a moduli file was successfully loaded; False otherwise.

        .. note:: This has no effect when used in client mode.
        z/etc/ssh/moduliz/usr/local/etc/moduliNrTF)rSrp�
_modulus_pack�insert�	read_file�IOError)�filename�	file_list�fns   rl�load_server_modulizTransport.load_server_moduliKs{��4#.�-�	��&�(?�@�	������Q��)��	�B�
��'�'�1�1�"�5��	�#'�	����	�
��
�s�A � 	A,�+A,c���|jsy|j�t|jj	��D]}|j��|jj�y)zP
        Close this session, and any open channels that are tied to it.
        N)r�rj�listr��values�_unlinkr�rM)r�chans  rlrMzTransport.closetsR���{�{����������.�.�0�1�	�D��L�L�N�	��	�	���rnc�`�|jr|jstd��|jS)a�
        Return the host key of the server (in client mode).

        .. note::
            Previously this call returned a tuple of ``(key type, key
            string)``. You can get the same effect by calling `.PKey.get_name`
            for the key type, and ``str(key)`` for the key string.

        :raises: `.SSHException` -- if no session is currently active.

        :return: public key (`.PKey`) of the remote server
        �No existing session)r�r�r^r�r.s rl�get_remote_server_keyzTransport.get_remote_server_keys)�����T�%:�%:��4�5�5��}�}�rnc��|jS)z�
        Return true if this session is active (open).

        :return:
            True if the session is still active (open); False if the session is
            closed
        )r�r.s rl�	is_activezTransport.is_active�s���{�{�rnc�,�|jd|||��S)a�
        Request a new channel to the server, of type ``"session"``.  This is
        just an alias for calling `open_channel` with an argument of
        ``"session"``.

        .. note:: Modifying the the window and packet sizes might have adverse
            effects on the session created. The default values are the same
            as in the OpenSSH code base and have been battle tested.

        :param int window_size:
            optional window size for this session.
        :param int max_packet_size:
            optional max packet size for this session.

        :return: a new `.Channel`

        :raises:
            `.SSHException` -- if the request is rejected or the session ends
            prematurely

        .. versionchanged:: 1.13.4/1.14.3/1.15.3
            Added the ``timeout`` argument.
        .. versionchanged:: 1.15
            Added the ``window_size`` and ``max_packet_size`` arguments.
        �session)�window_size�max_packet_sizer_��open_channel)rr�r�r_s    rl�open_sessionzTransport.open_session�s(��8� � ��#�+��	!�
�	
rnc�(�|jd|��S)a�
        Request a new channel to the client, of type ``"x11"``.  This
        is just an alias for ``open_channel('x11', src_addr=src_addr)``.

        :param tuple src_addr:
            the source address (``(str, int)``) of the x11 server (port is the
            x11 port, ie. 6010)
        :return: a new `.Channel`

        :raises:
            `.SSHException` -- if the request is rejected or the session ends
            prematurely
        �x11)�src_addrr�)rr�s  rl�open_x11_channelzTransport.open_x11_channel�s��� � ��� �:�:rnc�$�|jd�S)aB
        Request a new channel to the client, of type
        ``"auth-agent@openssh.com"``.

        This is just an alias for ``open_channel('auth-agent@openssh.com')``.

        :return: a new `.Channel`

        :raises: `.SSHException` --
            if the request is rejected or the session ends prematurely
        �auth-agent@openssh.comr�r.s rl�open_forward_agent_channelz$Transport.open_forward_agent_channel�s��� � �!9�:�:rnc�(�|jd||�S)aC
        Request a new channel back to the client, of type ``forwarded-tcpip``.

        This is used after a client has requested port forwarding, for sending
        incoming connections back to the client.

        :param src_addr: originator's address
        :param dest_addr: local (server) connected address
        �forwarded-tcpipr�)rr��	dest_addrs   rl�open_forwarded_tcpip_channelz&Transport.open_forwarded_tcpip_channel�s��� � �!2�I�x�H�Hrnc���|jstd��|�dn|}|jj�	|j	|�}|j|�}|j
�}t�}|jt�|j|�|j|�|j|�|j|�|dk(s|dk(rQ|j|d�|j|d�|j|d�|j|d�n-|dk(r(|j|d�|j|d�t|�}	|jj||	�tj �x|j"|<}
d|j$|<|	j'|�|	j)||�|jj+�|j-|�t/j.�}	|
j1d	�|js|j3�}|�td
�}|�|
j5�rn&||zt/j.�krtd���s|jj7|�}	|	�|	S|j3�}|�td
�}|�#|jj+�wxYw)as
        Request a new channel to the server. `Channels <.Channel>` are
        socket-like objects used for the actual transfer of data across the
        session. You may only request a channel after negotiating encryption
        (using `connect` or `start_client`) and authenticating.

        .. note:: Modifying the the window and packet sizes might have adverse
            effects on the channel created. The default values are the same
            as in the OpenSSH code base and have been battle tested.

        :param str kind:
            the kind of channel requested (usually ``"session"``,
            ``"forwarded-tcpip"``, ``"direct-tcpip"``, or ``"x11"``)
        :param tuple dest_addr:
            the destination address (address + port tuple) of this port
            forwarding, if ``kind`` is ``"forwarded-tcpip"`` or
            ``"direct-tcpip"`` (ignored for other channel types)
        :param src_addr: the source address of this port forwarding, if
            ``kind`` is ``"forwarded-tcpip"``, ``"direct-tcpip"``, or ``"x11"``
        :param int window_size:
            optional window size for this session.
        :param int max_packet_size:
            optional max packet size for this session.
        :param float timeout:
            optional timeout opening a channel, default 3600s (1h)

        :return: a new `.Channel` on success

        :raises:
            `.SSHException` -- if the request is rejected, the session ends
            prematurely or there is a timeout openning a channel

        .. versionchanged:: 1.15
            Added the ``window_size`` and ``max_packet_size`` arguments.
        �SSH session not activeir��direct-tcpiprr�r�Tr�zUnable to open channel.zTimeout opening channel.)r�r^r��acquire�_sanitize_window_size�_sanitize_packet_size�
_next_channelrP�add_byter�
add_string�add_intrr��putr�r�r�r��_set_transport�_set_window�release�_send_user_messagerZr[r\r]r#)
r�kindr�r�r�r�r_�chanid�mryr^�start_tsr s
             rlr�zTransport.open_channel�sq��X�{�{��7�8�8�!�/�$�w���	�	����	 ��4�4�[�A�K�"�8�8��I�O��'�'�)�F��	�A�
�J�J�(�)�
�L�L���
�I�I�f��
�I�I�k�"�
�I�I�o�&��)�)�t�~�/E����Y�q�\�*��	�	�)�A�,�'����X�a�[�)��	�	�(�1�+�&�������X�a�[�)��	�	�(�1�+�&��6�?�D��N�N���v�t�,�2;�/�/�2C�C�D����'�%�)-�D���v�&�����%����[�/�:��I�I��������"��9�9�;����J�J�s�O��;�;��&�&�(���9�$�%>�?�A����|�|�~���G�#�d�i�i�k�1�"�#=�>�>���~�~�!�!�&�)�����K���� ���9��6�7�A����)
�I�I����s�FK�Kc�����jstd��t|�}�jd||fd��}|�td��|dk(r|j	�}|��fd�}|}|�_|S)a�
        Ask the server to forward TCP connections from a listening port on
        the server, across this SSH session.

        If a handler is given, that handler is called from a different thread
        whenever a forwarded connection arrives.  The handler parameters are::

            handler(
                channel,
                (origin_addr, origin_port),
                (server_addr, server_port),
            )

        where ``server_addr`` and ``server_port`` are the address and port that
        the server was listening on.

        If no handler is set, the default behavior is to send new incoming
        forwarded connections into the accept queue, to be picked up via
        `accept`.

        :param str address: the address to bind when forwarding
        :param int port:
            the port to forward, or 0 to ask the server to allocate any port
        :param callable handler:
            optional handler for incoming forwarded connections, of the form
            ``func(Channel, (str, int), (str, int))``.

        :return: the port number (`int`) allocated by the server

        :raises:
            `.SSHException` -- if the server refused the TCP forward request
        r��
tcpip-forwardT�r[zTCP forwarding request deniedrc�(���j|�yrh��_queue_incoming_channel)�channelr��dest_addr_portrs   �rl�default_handlerz7Transport.request_port_forward.<locals>.default_handlerss����,�,�W�5rn)r�r^r��global_request�get_intr�)r�addressr��handler�responser�s`     rl�request_port_forwardzTransport.request_port_forwardFs����B�{�{��7�8�8��4�y���&�&��g�t�_�4�'�
�����>�?�?��1�9��#�#�%�D��?�
6�
&�G�#����rnc�X�|jsyd|_|jd||fd��y)a.
        Ask the server to cancel a previous port-forwarding request.  No more
        connections to the given address & port will be forwarded across this
        ssh connection.

        :param str address: the address to stop forwarding
        :param int port: the port to stop forwarding
        N�cancel-tcpip-forwardTr�)r�r�r�)rr�r�s   rl�cancel_port_forwardzTransport.cancel_port_forward|s0���{�{�� ������2�W�d�O�$��Ornc�,�tj|�S)aE
        Create an SFTP client channel from an open transport.  On success, an
        SFTP session will be opened with the remote host, and a new
        `.SFTPClient` object will be returned.

        :return:
            a new `.SFTPClient` referring to an sftp session (channel) across
            this transport
        )r]�from_transportr.s rl�open_sftp_clientzTransport.open_sftp_client�s���(�(��.�.rnc��t�}|jt�|�$tt	j
d��dzdz}|j
t	j
|��|j|�y)a�
        Send a junk packet across the encrypted link.  This is sometimes used
        to add "noise" to a connection to confuse would-be attackers.  It can
        also be used as a keep-alive for long lived connections traversing
        firewalls.

        :param int byte_count:
            the number of random bytes to send in the payload of the ignored
            packet -- defaults to a random number from 10 to 41.
        Nr�r��
)rPr�rrV�os�urandom�	add_bytesr�)r�
byte_countr�s   rl�send_ignorezTransport.send_ignore�s\��
�I��	�
�
�;����"�2�:�:�a�=�1�B�6�"�<�J�	���B�J�J�z�*�+�����"rnc��tj�|_|j�	|jj	d�|j
s|j
�}|�|�td��|jj�r	y�c)aK
        Force this session to switch to new keys.  Normally this is done
        automatically after the session hits a certain number of packets or
        bytes sent or received, but this method gives you the option of forcing
        new keys whenever you want.  Negotiating new keys causes a pause in
        traffic both ways as the two sides swap keys and do computations.  This
        method returns when the session has switched to new keys.

        :raises:
            `.SSHException` -- if the key renegotiation failed (which causes
            the session to end)
        r�NrX)	r�r�r��_send_kex_initr[r�r\r^r]�rr s  rl�renegotiate_keyszTransport.renegotiate_keys�s~��!*��� 1���������!�!�&�&�s�+��;�;��&�&�(���=��G�"�#8�9�9��$�$�+�+�-���rnc�l�tj|�fd�}|jj||�y)a�
        Turn on/off keepalive packets (default is off).  If this is set, after
        ``interval`` seconds without sending any data over the connection, a
        "keepalive" packet will be sent (and ignored by the remote host).  This
        can be useful to keep connections alive over a NAT, for example.

        :param int interval:
            seconds to wait before sending a keepalive packet (or
            0 to disable keepalives).
        c�(�|jdd��S)Nzkeepalive@lag.netFr�)r�)r%s rl�_requestz)Transport.set_keepalive.<locals>._request�s���#�#�$7�e�#�D�DrnN)�weakref�proxyr��
set_keepalive)r�intervalr�s   rlr�zTransport.set_keepalive�s,���}�}�T�*�	E�	
���%�%�h��9rnc���|rtj�|_t�}|j	t
�|j
|�|j|�|�|j|�|jtdj|��|j|�|sy	|jjd�|jsy|jj�r
	|j S�P)a�
        Make a global request to the remote host.  These are normally
        extensions to the SSH2 protocol.

        :param str kind: name of the request.
        :param tuple data:
            an optional tuple containing additional data to attach to the
            request.
        :param bool wait:
            ``True`` if this method should not return until a response is
            received; ``False`` otherwise.
        :return:
            a `.Message` containing possible additional data if the request was
            successful (or an empty `.Message` if ``wait`` was ``False``);
            ``None`` if the request was denied.
        NzSending global request "{}"r�)r�r�r�rPr�rr��add_boolean�add�_logrr�r�r[r�r]r�)rr��datar[r�s     rlr�zTransport.global_request�s���"�$-�O�O�$5�D�!��I��	�
�
�&�'�	���T��	�
�
�d�����A�E�E�4�L��	�	�%�6�=�=�d�C�D�����"�����!�!�&�&�s�+��;�;���$�$�+�+�-���#�#�#�
rnc��|jj�	t|j�dkDr|jj	d�}nQ|j
j
|�t|j�dkDr|jj	d�}nd}|jj�|S#|jj�wxYw)aW
        Return the next channel opened by the client over this transport, in
        server mode.  If no channel is opened before the given timeout,
        ``None`` is returned.

        :param int timeout:
            seconds to wait for a channel, or ``None`` to wait forever
        :return: a new `.Channel` opened by the client
        rN)r�r�r�r�poprr[r�)rr_rys   rl�acceptzTransport.accept�s���	
�	�	����	 ��4�&�&�'�!�+��*�*�.�.�q�1���%�%�*�*�7�3��t�*�*�+�a�/��.�.�2�2�1�5�D� �D��I�I�������
�I�I����s�BB=�=Cc

��|�0t|t�r
gd�|_n|j�g|_|j	||	|xs|��|j�|��?|�s<|j
�}
|
j�|j�k7s!|
j�|j�k7r�|jtd�|jtdj|j�t|j����|jtdj|
j�t|
j����td��|jtdj|j���|�|�|s|r�|r4|jtd�|j||j|�y|r(|jtd	�|j|�y|�)|jtd
�|j!||�y|jtd�|j#||�y)a	
        Negotiate an SSH2 session, and optionally verify the server's host key
        and authenticate using a password or private key.  This is a shortcut
        for `start_client`, `get_remote_server_key`, and
        `Transport.auth_password` or `Transport.auth_publickey`.  Use those
        methods if you want more control.

        You can use this method immediately after creating a Transport to
        negotiate encryption with a server.  If it fails, an exception will be
        thrown.  On success, the method will return cleanly, and an encrypted
        session exists.  You may immediately call `open_channel` or
        `open_session` to get a `.Channel` object, which is used for data
        transfer.

        .. note::
            If you fail to supply a password or private key, this method may
            succeed, but a subsequent `open_channel` or `open_session` call may
            fail because you haven't authenticated yet.

        :param .PKey hostkey:
            the host key expected from the server, or ``None`` if you don't
            want to do host key verification.
        :param str username: the username to authenticate as.
        :param str password:
            a password to use for authentication, if you want to use password
            authentication; otherwise ``None``.
        :param .PKey pkey:
            a private key to use for authentication, if you want to use private
            key authentication; otherwise ``None``.
        :param str gss_host:
            The target's name in the kerberos database. Default: hostname
        :param bool gss_auth:
            ``True`` if you want to use GSS-API authentication.
        :param bool gss_kex:
            Perform GSS-API Key Exchange and user authentication.
        :param bool gss_deleg_creds:
            Whether to delegate GSS-API client credentials.
        :param gss_trust_dns:
            Indicates whether or not the DNS is trusted to securely
            canonicalize the name of the host being connected to (default
            ``True``).

        :raises: `.SSHException` -- if the SSH2 negotiation fails, the host key
            supplied by the server is incorrect, or authentication fails.

        .. versionchanged:: 2.3
            Added the ``gss_trust_dns`` argument.
        N)r~rr�)r�rTrUzBad host key from serverzExpected: {}: {}zGot     : {}: {}zHost key verified ({})z,Attempting GSS-API auth... (gssapi-with-mic)z)Attempting GSS-API auth... (gssapi-keyex)zAttempting public-key auth...zAttempting password auth...)r�rZ�_preferred_keysrfrVrar|�asbytesr�rr��reprr^�auth_gssapi_with_micr��auth_gssapi_keyex�auth_publickey�
auth_password)r�hostkey�username�password�pkeyr��gss_authrr�
gss_trust_dnsrgs           rlr�zTransport.connects��x���'�6�*�(��$�)0�(8�(8�(:�';��$�����#�$�0��	�	
�	
����

����,�,�.�C�����'�"2�"2�"4�4��;�;�=�G�O�O�$5�5��	�	�%�!;�<��	�	��&�-�-��(�(�*�D����1B�,C����	�	��&�-�-������S�[�[�]�(;���#�#=�>�>��I�I��/�6�6�w�7G�7G�7I�J�
�
��(�"6�8�w���	�	��I���)�)��d�m�m�_��	���	�	�%�!L�M��&�&�x�0�	��!��	�	�%�!@�A��#�#�H�d�3�
	��	�	�%�!>�?��"�"�8�X�6�rnc���|jj�	|j}d|_||jj�S#|jj�wxYw)ay
        Return any exception that happened during the last server request.
        This can be used to fetch more specific error information after using
        calls like `start_client`.  The exception (if any) is cleared after
        this call.

        :return:
            an exception, or ``None`` if there is no stored exception.

        .. versionadded:: 1.1
        N)r�r�r�r�r�s  rlr\zTransport.get_exception�sP��	
�	�	����	 ��$�$�A�#'�D� ���I�I�����D�I�I������A�A'c���	|jj�|||f|j|<|jj�y#|jj�wxYw)a'
        Set the handler class for a subsystem in server mode.  If a request
        for this subsystem is made on an open ssh channel later, this handler
        will be constructed and called -- see `.SubsystemHandler` for more
        detailed documentation.

        Any extra parameters (including keyword arguments) are saved and
        passed to the `.SubsystemHandler` constructor later.

        :param str name: name of the subsystem.
        :param handler:
            subclass of `.SubsystemHandler` that handles this subsystem.
        N�r�r�rr�)r�namer��larg�kwargs     rl�set_subsystem_handlerzTransport.set_subsystem_handler�sO��	 ��I�I����*1�4��)?�D� � ��&��I�I�����D�I�I����s�,A	�	A%c�r�|jxr*|jduxr|jj�S)a
        Return true if this session is active and authenticated.

        :return:
            True if the session is still open and has been authenticated
            successfully; False if authentication failed and/or the session is
            closed.
        N)r�r�rHr.s rlrHzTransport.is_authenticated�s:��
�K�K�
5��!�!��-�
5��!�!�2�2�4�	
rnc�h�|jr|j�y|jj�S)a
        Return the username this connection is authenticated for.  If the
        session is not authenticated (or authentication failed), this method
        returns ``None``.

        :return: username that was authenticated (a `str`), or ``None``.
        N)r�r��get_usernamer.s rlr�zTransport.get_username�s.���{�{�t�0�0�8��� � �-�-�/�/rnc�`�|jr|j�y|jjS)z�
        Return the banner supplied by the server upon connect. If no banner is
        supplied, this method returns ``None``.

        :returns: server supplied banner (`str`), or ``None``.

        .. versionadded:: 1.13
        N)r�r��bannerr.s rl�
get_bannerzTransport.get_banner�s+���{�{�t�0�0�8��� � �'�'�'rnc��|jr|jstd��tj�}t|�|_|jj||�|jj|�S)a�
        Try to authenticate to the server using no authentication at all.
        This will almost always fail.  It may be useful for determining the
        list of authentication types supported by the server, by catching the
        `.BadAuthenticationType` exception raised.

        :param str username: the username to authenticate as
        :return:
            list of auth types permissible for the next stage of
            authentication (normally empty)

        :raises:
            `.BadAuthenticationType` -- if "none" authentication isn't allowed
            by the server for this user
        :raises:
            `.SSHException` -- if the authentication failed due to a network
            error

        .. versionadded:: 1.5
        r{)	r�r�r^r�r�r
r��	auth_none�wait_for_response�rr��my_events   rlr�zTransport.auth_none�se��*���T�%:�%:��4�5�5��?�?�$��'��-������#�#�H�h�7�� � �2�2�8�<�<rnc���|jr|jstd��|�tj�}n|}t|�|_|jj|�|�|�gS	|jj|�S#t$rB}|rd|jvr�	�fd�}|j||�cYd}~S#t$r|�wxYwd}~wwxYw)a�	
        Authenticate to the server using a password.  The username and password
        are sent over an encrypted link.

        If an ``event`` is passed in, this method will return immediately, and
        the event will be triggered once authentication succeeds or fails.  On
        success, `is_authenticated` will return ``True``.  On failure, you may
        use `get_exception` to get more detailed error information.

        Since 1.1, if no event is passed, this method will block until the
        authentication succeeds or fails.  On failure, an exception is raised.
        Otherwise, the method simply returns.

        Since 1.5, if no event is passed and ``fallback`` is ``True`` (the
        default), if the server doesn't support plain password authentication
        but does support so-called "keyboard-interactive" mode, an attempt
        will be made to authenticate using this interactive mode.  If it fails,
        the normal exception will be thrown as if the attempt had never been
        made.  This is useful for some recent Gentoo and Debian distributions,
        which turn off plain password authentication in a misguided belief
        that interactive authentication is "more secure".  (It's not.)

        If the server requires multi-step authentication (which is very rare),
        this method will return a list of auth types permissible for the next
        step.  Otherwise, in the normal case, an empty list is returned.

        :param str username: the username to authenticate as
        :param basestring password: the password to authenticate with
        :param .threading.Event event:
            an event to trigger when the authentication attempt is complete
            (whether it was successful or not)
        :param bool fallback:
            ``True`` if an attempt at an automated "interactive" password auth
            should be made if the server doesn't support normal password auth
        :return:
            list of auth types permissible for the next stage of
            authentication (normally empty)

        :raises:
            `.BadAuthenticationType` -- if password authentication isn't
            allowed by the server for this user (and no event was passed in)
        :raises:
            `.AuthenticationException` -- if the authentication failed (and no
            event was passed in)
        :raises: `.SSHException` -- if there was a network error
        r{Nzkeyboard-interactivec�\��t|�dkDrtd��t|�dk(rgS�gS)Nr�zFallback authentication failed.r)r�r^)�title�instructions�fieldsr�s   �rlr�z(Transport.auth_password.<locals>.handlerBs5����6�{�Q��*�+L�M�M��6�{�a�'�
 "�	�$�:�%rn)r�r�r^r�r�r
r�r�r�r_�
allowed_types�auth_interactive)rr�r�r^�fallbackr�r r�s  `     rlr�zTransport.auth_password�s����^���T�%:�%:��4�5�5��=� ���(�H��H�'��-������'�'��(�H�E����I�	��$�$�6�6�x�@�@��$�	�� 6�a�o�o� M��
�	&��,�,�X�w�?�?���
���
��'	�s0�0B�	C�C�&C�<C�C�C�Cc��|jr|jstd��|�tj�}n|}t|�|_|jj|||�|�gS|jj|�S)a�
        Authenticate to the server using a private key.  The key is used to
        sign data from the server, so it must include the private part.

        If an ``event`` is passed in, this method will return immediately, and
        the event will be triggered once authentication succeeds or fails.  On
        success, `is_authenticated` will return ``True``.  On failure, you may
        use `get_exception` to get more detailed error information.

        Since 1.1, if no event is passed, this method will block until the
        authentication succeeds or fails.  On failure, an exception is raised.
        Otherwise, the method simply returns.

        If the server requires multi-step authentication (which is very rare),
        this method will return a list of auth types permissible for the next
        step.  Otherwise, in the normal case, an empty list is returned.

        :param str username: the username to authenticate as
        :param .PKey key: the private key to authenticate with
        :param .threading.Event event:
            an event to trigger when the authentication attempt is complete
            (whether it was successful or not)
        :return:
            list of auth types permissible for the next stage of
            authentication (normally empty)

        :raises:
            `.BadAuthenticationType` -- if public-key authentication isn't
            allowed by the server for this user (and no event was passed in)
        :raises:
            `.AuthenticationException` -- if the authentication failed (and no
            event was passed in)
        :raises: `.SSHException` -- if there was a network error
        r{)	r�r�r^r�r�r
r�r�r�)rr�rgr^r�s     rlr�zTransport.auth_publickeyRs}��F���T�%:�%:��4�5�5��=� ���(�H��H�'��-������(�(��3��A����I�� � �2�2�8�<�<rnc��|jr|jstd��tj�}t|�|_|jj||||�|jj|�S)a�
        Authenticate to the server interactively.  A handler is used to answer
        arbitrary questions from the server.  On many servers, this is just a
        dumb wrapper around PAM.

        This method will block until the authentication succeeds or fails,
        peroidically calling the handler asynchronously to get answers to
        authentication questions.  The handler may be called more than once
        if the server continues to ask questions.

        The handler is expected to be a callable that will handle calls of the
        form: ``handler(title, instructions, prompt_list)``.  The ``title`` is
        meant to be a dialog-window title, and the ``instructions`` are user
        instructions (both are strings).  ``prompt_list`` will be a list of
        prompts, each prompt being a tuple of ``(str, bool)``.  The string is
        the prompt and the boolean indicates whether the user text should be
        echoed.

        A sample call would thus be:
        ``handler('title', 'instructions', [('Password:', False)])``.

        The handler should return a list or tuple of answers to the server's
        questions.

        If the server requires multi-step authentication (which is very rare),
        this method will return a list of auth types permissible for the next
        step.  Otherwise, in the normal case, an empty list is returned.

        :param str username: the username to authenticate as
        :param callable handler: a handler for responding to server questions
        :param str submethods: a string list of desired submethods (optional)
        :return:
            list of auth types permissible for the next stage of
            authentication (normally empty).

        :raises: `.BadAuthenticationType` -- if public-key authentication isn't
            allowed by the server for this user
        :raises: `.AuthenticationException` -- if the authentication failed
        :raises: `.SSHException` -- if there was a network error

        .. versionadded:: 1.5
        r{)	r�r�r^r�r�r
r�r�r�)rr�r��
submethodsr�s     rlr�zTransport.auth_interactive�so��V���T�%:�%:��4�5�5��?�?�$��'��-������*�*��g�x��	
�� � �2�2�8�<�<rnc�2�|sd�}|j|||�S)a
        Autenticate to the server interactively but dumber.
        Just print the prompt and / or instructions to stdout and send back
        the response. This is good for situations where partial auth is
        achieved by key and then the user has to enter a 2fac token.
        c���g}|rt|j��|rt|j��|D]9\}}t|j�d��|jt���;|S)N� )�end)�print�strip�appendrX)r�r��prompt_list�answers�prompt�
show_inputs      rlr�z0Transport.auth_interactive_dumb.<locals>.handler�se������%�+�+�-�(���,�,�,�.�/�*5�,�&�F�J��&�,�,�.�c�2��N�N�5�7�+�,��rn)r�)rr�r�r�s    rl�auth_interactive_dumbzTransport.auth_interactive_dumb�s#���	
��$�$�X�w�
�C�Crnc��|jr|jstd��tj�}t|�|_|jj||||�|jj|�S)a�
        Authenticate to the Server using GSS-API / SSPI.

        :param str username: The username to authenticate as
        :param str gss_host: The target host
        :param bool gss_deleg_creds: Delegate credentials or not
        :return: list of auth types permissible for the next stage of
                 authentication (normally empty)
        :raises: `.BadAuthenticationType` -- if gssapi-with-mic isn't
            allowed by the server (and no event was passed in)
        :raises:
            `.AuthenticationException` -- if the authentication failed (and no
            event was passed in)
        :raises: `.SSHException` -- if there was a network error
        r{)	r�r�r^r�r�r
r�r�r�)rr�r�rr�s     rlr�zTransport.auth_gssapi_with_mic�sn�� ���T�%:�%:��4�5�5��?�?�$��'��-������.�.��h���	
�� � �2�2�8�<�<rnc��|jr|jstd��tj�}t|�|_|jj||�|jj|�S)aZ
        Authenticate to the server with GSS-API/SSPI if GSS-API kex is in use.

        :param str username: The username to authenticate as.
        :returns:
            a list of auth types permissible for the next stage of
            authentication (normally empty)
        :raises: `.BadAuthenticationType` --
            if GSS-API Key Exchange was not performed (and no event was passed
            in)
        :raises: `.AuthenticationException` --
            if the authentication failed (and no event was passed in)
        :raises: `.SSHException` -- if there was a network error
        r{)	r�r�r^r�r�r
r�r�r�r�s   rlr�zTransport.auth_gssapi_keyex�se�����T�%:�%:��4�5�5��?�?�$��'��-������+�+�H�h�?�� � �2�2�8�<�<rnc��||_tj|�|_|jj|j�y)ag
        Set the channel for this transport's logging.  The default is
        ``"paramiko.transport"`` but it can be set to anything you want. (See
        the `.logging` module for more info.)  SSH Channels will log to a
        sub-channel of the one specified.

        :param str name: new channel name for logging

        .. versionadded:: 1.1
        N)r�rr�r�r�r��rr�s  rl�set_log_channelzTransport.set_log_channels1����
��o�o�d�+�����������,rnc��|jS)z�
        Return the channel name used for this transport's logging.

        :return: channel name as a `str`

        .. versionadded:: 1.2
        )r�r.s rl�get_log_channelzTransport.get_log_channels���}�}�rnc�:�|jj|�y)aa
        Turn on/off logging a hex dump of protocol traffic at DEBUG level in
        the logs.  Normally you would want this off (which is the default),
        but if you are debugging something, it may be useful.

        :param bool hexdump:
            ``True`` to log protocol traffix (in hex) to the log; ``False``
            otherwise.
        N)r��set_hexdump)r�hexdumps  rlrzTransport.set_hexdumps��	
���#�#�G�,rnc�6�|jj�S)z�
        Return ``True`` if the transport is currently logging hex dumps of
        protocol traffic.

        :return: ``True`` if hex dumps are being logged, else ``False``.

        .. versionadded:: 1.4
        )r��get_hexdumpr.s rlrzTransport.get_hexdump%s�����*�*�,�,rnc�&�|rd|_yd|_y)a�
        Turn on/off compression.  This will only have an affect before starting
        the transport (ie before calling `connect`, etc).  By default,
        compression is off since it negatively affects interactive sessions.

        :param bool compress:
            ``True`` to ask the remote client/server to compress traffic;
            ``False`` to refuse compression

        .. versionadded:: 1.5.2
        r�r�N)�_preferred_compression)r�compresss  rl�use_compressionzTransport.use_compression0s���*N�D�'�*3�D�'rnc�D�t|jdd�}|�y|�S)a�
        Return the address of the remote side of this Transport, if possible.

        This is effectively a wrapper around ``getpeername`` on the underlying
        socket.  If the socket-like object has no ``getpeername`` method, then
        ``("unknown", 0)`` is returned.

        :return:
            the address of the remote host, if known, as a ``(str, int)``
            tuple.
        �getpeernameN)�unknownr)r(r�)r�gps  rlrzTransport.getpeernameAs%���T�Y�Y�
�t�
4��
�:���t�rnc��d|_|jj�trb|j	�rQ|tj�ur:|jd�|j	�r|tj�ur�8yyyy|j	�r�|tj�ur�|jjs|jjsh|jd�|j	�rF|tj�ur/|jjs|jjs�dyyyyyyyy)NFr�r�)r�r�rMrY�is_aliver��current_thread�joinr��_closed�closedr.s rlrjzTransport.stop_threadRs��������������-�-�/�d�)�2J�2J�2L�&L��	�	�"�
��-�-�/�d�)�2J�2J�2L�&L�/�&L�/��
�
���	� 8� 8� :�:��	�	�)�)����.�.��	�	�#���
�
���	� 8� 8� :�:��	�	�)�)����.�.�*�;� �/�*�;� rnc��tt|�t�r$|D]}|jj	||�� y|jj||g|���yrh)�
issubclassr�rvr��log)r�level�msg�argsr�s     rlr�zTransport._logksL���d�3�i��&��
*��������q�)�
*�
�D�K�K�O�O�E�3�.��.rnc��|jS)z0used by KexGex to find primes for group exchange)rmr.s rl�_get_modulus_packzTransport._get_modulus_packrs���!�!�!rnc��|j}|jj|��?|jdzdz|_|j}|jj|���?|jdzdz|_|S)zyou are holding the lockr�i���)r�r�r#�rr�s  rlr�zTransport._next_channelvs{���&�&���n�n� � ��(�4�%)�%:�%:�Q�%>�(�$J�D�!��*�*�F��n�n� � ��(�4�"&�!6�!6��!:�h� F����
rnc�:�|jj|�y)z?used by a Channel to remove itself from the active channel listN)r��deleter.s  rl�_unlink_channelzTransport._unlink_channels�������f�%rnc�:�|jj|�yrh)r��send_message)rr�s  rl�
_send_messagezTransport._send_message�s�����$�$�T�*rnc�>�tj�}	|jjd�|js|j	t
d�y|jj�|jj�rnJ|jj�tj�||jzkDrtd����	|j|�|jj�y#|jj�wxYw)z{
        send a message, but block if we're in key negotiation.  this is used
        for user-initiated requests.
        r�z0Dropping user packet because connection is dead.Nz2Key-exchange timed out waiting for key negotiation)
rZr�r[r�r�rr�r�r]r�r�r^r4)rr�rYs   rlr�zTransport._send_user_message�s���
�	�	�������#�#�C�(��;�;��	�	��M����#�#�+�+�-��!�!�(�(�*���#�#�+�+�-��y�y�{�U�T�%?�%?�?�?�"�H����	.����t�$��#�#�+�+�-��D�#�#�+�+�-�s�D�Dc�H�||_||_|j�||_yy)zR
        Used by a kex obj to set the K (root key) and H (exchange hash).
        N)r�r�r�)r�k�hs   rl�_set_K_HzTransport._set_K_H�s(���������?�?�"��D�O�#rnc�$�t|�|_y)zW
        Used by a kex obj to register the next packet type it expects to see.
        N)r�r�)r�ptypess  rl�_expect_packetzTransport._expect_packet�s��!&�f�
��rnc��|j|jt|��}|�td��|j	|j
t|��s$tdj
|j���||_y)NzUnknown host key typez#Signature verification ({}) failed.)�	_key_infor�rPr^�verify_ssh_sigr�r�r�)rr��sigrgs    rl�_verify_keyzTransport._verify_key�sx��0�d�n�n�T�/�/�0���1B�C���;��6�7�7��!�!�$�&�&�'�#�,�7��5�<�<��&�&���
�
��
rnc��t�}|j|j�|j|j�|jt
|��|j|j�t|jdd�}dj|jjj|�}|�t}|dz
}t|d�s#|jt |�t#|dd�||j%��j'�x}}t)|�|kr�t�}|j|j�|j|j�|j|�||j%��j'�}||z
}||z
}t)|�|kr��|d|S)z0id is 'A' - 'F' for the various keys used by ssh�	hash_algoNz&kex engine {} specified hash_algo {!r}z, falling back to sha1�_logged_hash_selectionT)rP�	add_mpintr�r�r�r�rWr�r(r�r��	__class__�__name__r�hasattrr�r�setattrr��digestr�)	rrF�nbytesr�rC�hash_select_msgrJ�sofarrJs	         rl�_compute_keyzTransport._compute_key�sd���I��	���D�F�F��	���D�F�F��	�
�
�1�R�5��	���D�O�O�$��D�O�O�[�$�?�	�B�I�I��O�O�%�%�.�.�	�
�����I��7�7�O��t�5�6��I�I�e�_�-��D�2�D�9���	�	��,�3�3�5�5��e��#�h����	�A�
�K�K�����
�K�K�����
�K�K����q�y�y�{�+�2�2�4�F��6�M�C��V�O�E��#�h����7�F�|�rnc��||jvrtd|z��t|j|d|�|j|d|�t���}||jur|j�S|j
�S)NzUnknown client cipher r�r�)�backend)rGr^r
r�_ENCRYPT�	encryptor�	decryptor)rr�rg�iv�	operation�ciphers      rl�_get_cipherzTransport._get_cipher�s����t�(�(�(��7�$�>�?�?��0��!�!�$�'��0��5�/��!�!�$�'��/��3�'�)��F�
�D�M�M�)��'�'�)�)��'�'�)�)rnc�2��|�
�fd�}|�_y|�_y)Nc�(���j|�yrhr�)r�rs �rlr�z=Transport._set_forward_agent_handler.<locals>.default_handler������,�,�W�5rn)r��rr�r�s`  rl�_set_forward_agent_handlerz$Transport._set_forward_agent_handler�s����?�
6�+:�D�'�*1�D�'rnc�2��|�
�fd�}|�_y|�_y)Nc�(���j|�yrhr�)r��
src_addr_portrs  �rlr�z3Transport._set_x11_handler.<locals>.default_handler�rZrn)r�r[s`  rl�_set_x11_handlerzTransport._set_x11_handler�s����?�
6�!0�D�� '�D�rnc��|jj�	|jj|�|jj�|jj
�y#|jj
�wxYwrh)r�r�rrr�notifyr�)rr�s  rlr�z!Transport._queue_incoming_channel�s^���	�	����	 ����&�&�w�/��!�!�(�(�*��I�I�����D�I�I����s�5A,�,Bc�H�|�|j}tt|t�Srh)r�rfr5r7)rr�s  rlr�zTransport._sanitize_window_sizes"�����2�2�K��?�K��I�Irnc�H�|�|j}tt|t�Srh)r�rfr6r7)rr�s  rlr�zTransport._sanitize_packet_size	s"���"�"�:�:�O��?�O�_�M�Mrnc��|jr|tks|j�ryt�}|tk(r|jt�|S|tk(r}|j�}|j�}|jt�|j|�|jt�|jd�|jd�|S)ao
        Checks message type against current auth state.

        If server mode, and auth has not succeeded, and the message is of a
        post-auth type (channel open or global request) an appropriate error
        response Message is crafted and returned to caller for sending.

        Otherwise (client mode, authed, or pre-auth message) returns None.
        Nr��en)rr:rHrPr'r�r!r,�get_textr�r%r�r#r�)r�ptype�message�replyr�r�s      rl�_ensure_authedzTransport._ensure_autheds���� � ��3�3��$�$�&���	���&�&��N�N�/�0����&�
&��#�#�%�D��_�_�&�F��N�N�4�5��M�M�&�!��M�M�A�B����R� ����T�"��rnc��|jr5|js(tj|d|���}t	d|�d���yy)a	
        Conditionally raise `MessageOrderError` during strict initial kex.

        This method should only be called inside code that handles non-KEXINIT
        messages; it does not interrogate ``ptype`` besides using it to log
        more accurately.
        zmsg z!In strict-kex mode, but was sent �!N)r�r�r<r#rb)rrhr�s   rl�_enforce_strict_kexzTransport._enforce_strict_kex4sM���$�$�T�-B�-B��=�=��$�u�g��7�D�#�3�D�8�1�=��
�.C�$rnc�d�t|_tj|�tt	t|��tz�}|jr&|jtdj|��n%|jtdj|��		|jjt|jdz��|jtdj|j��|j�|jj!|j"�|j%�|j't(�|j*�r`|jj-�r|j.s|j%�	|jj1�\}}|t4k(r|j7|��||t8k(r|j;|��n�|t<k(r#|j7|�|j?|���tA|jB�dkDr||jBvr:tD}|jFrtH}|dj|jB|���tK�|_!|dk\r#|dkr|jLjO||���[||jPvr>|jS||�}|r|jU|��n�|jP||��n�||jVvr�|jY�}|jZj]|�}|�|jV|||��nK||j^vr'|jtd	j|���n|jt`d
j|���n|jb�^||jbjPvrF|jbjP|}||jb|�tA|jB�dkDr����td|}	dj||	�}
|jtf|
�|thk7rKtk�}|jmtn�|jq|jr�|jU|�|jju�|j*r��`tj�|�t�|jZj���D]}|j���|j*r�d|_|jj��|j��|j�j��|jb�|jbj��|j�j��D]}|j���	|j�j��|j�j��|j�j��|j�j��y#t2$rY���wxYw#tD$rn}|jt`dj|jrd
nd|��|jt`twjx��||_=Yd}~���d}~wt|$r(}|jtd�||_=Yd}~��d}~wt~j�$r�}t�|j��tJurR|j�r-dj|j�d|j�d�}
n%t�|�xst�|�}
n|j�}
|jt`d|
z�||_=Yd}~���d}~wt�$r\}|jt`dt�|�z�|jt`twjx��||_=Yd}~��(d}~wwxYw#|j�j��wxYw#|jj���YyxYw)Nz!starting thread (server mode): {}z!starting thread (client mode): {}z
zLocal version/idstring: {}rz$Expecting packet from {!r}, got {:d}r��)z&Ignoring message for dead channel {:d}z(Channel request for unknown channel {:d}zOops, unhandled type {} ({!r})zException ({}): {}rc�clientzEOF in transport threadz	{} ({:d})r�zSocket exception: zUnknown exception: F)V�sysrirrErUrFrrr�rr�r��	write_allrWr��
_check_banner�start_handshaker�r�r<rr��
need_rekeyr��read_messagerRrrnr�_parse_disconnectr�_parse_debugr�r�r^r�rbr�r��
parse_nextrrkr4�_channel_handler_tabler�r�r#r�rr�r<rr;rPr�rr��seqno�complete_handshaker�
tb_stringsr��EOFErrorr�r�r�r*r�r��	Exception�removervrwrxrMr��set�abortr�r�r�rrbr�r��modules)r�tidrhr��	exc_class�	error_msgr�ryr�r��warningr)r �emsgr^s               rl�runz
Transport.runBs�����	���t�$��$�r�$�x�.�9�,�-������I�I�e�@�G�G��L�M��I�I�e�@�G�G��L�M�W	�}
)����)�)�!�D�,>�,>��,G�*H�I��	�	��0�7�7��8J�8J�K���"�"�$����/�/��0F�0F�G��#�#�%��#�#�K�0��k�k����1�1�3�D�K�K��+�+�-�!�#'�?�?�#?�#?�#A���q��
�*��0�0��7� ��.�0��.�.�q�1���)�+��0�0��7��)�)�!�,� ��4�0�0�1�A�5� ��(=�(=�=�(4�I�#�8�8�,=�	�"+� F� M� M�$(�$9�$9�5�!"�#��
16���-�!�R�K�e�r�k� �O�O�6�6�u�a�@�$��� 3� 3�3�$(�$7�$7��q�$A�	�$� �.�.�y�9�6�D�/�/��6�q�9��$�"=�"=�=�!"�����#�~�~�1�1�&�9���+�>�D�7�7��>�t�Q�G�#�t�'9�'9�9� �I�I� %� H� O� O�$*�!"��!�I�I� %� J� Q� Q�$*�!"��"��)�)�5�!�T�%6�%6�%E�%E�E�"&�"3�"3�"B�"B�5�"I���� 1� 1�1�5��t�4�4�5��9�$� )��/��"B�"I�"I�!�4�#���	�	�'�7�3� �$5�5�")�)�C��L�L�);�<��K�K����0� �.�.�s�3��O�O�6�6�8�c�k�k�X
�"�"�4�(��T�^�^�2�2�4�5�
������
��{�{�#������%�%�'��(�(�4��)�)�-�-�/��$�$�0��%�%�+�+�-�!�0�0�7�7�9� �E��I�I�K� �(��I�I�%�%�'��)�)�0�0�2��I�I�%�%�'��I�I�O�O���q.�!� �!��Z �
)��	�	��(�/�/�$(�$4�$4��(�A����	�	�%����!2�3�'(��$�$���
)��	�	�%�!:�;�'(��$�$���<�<�	
)�����<�5�(��v�v�*�1�1�!�&�&��)�Q�V�V�A�Y�G��"�1�v�0��a����6�6�D��	�	�%�!5��!<�=�'(��$�$���
)��	�	�%�!6��Q��!?�@��	�	�%����!2�3�'(��$�$��
)��(�I�I�%�%�'��	�
�x�x���+��,�s��C=X4�X$�9L
X4�C5`�;4_5�/4`�$	X1�-X4�0X1�1X4�4	_2�=A#Z&� `�&_2�2[�`�_2�+B^
�`�
_2�A_-�'`�-_2�2`�5`�`�`/c��dj|�}||k(r||z
}n|dj||�z
}|jt|�y)Nz{}: zlocal={}, remote={})r�r�r)r�which�local�remoter)s     rl�_log_agreementzTransport._log_agreement�sH���m�m�E�"���F�?��5�L�C��(�/�/��v�>�>�C��	�	�%��rnc�n�|jj�	|jj�|jj	�|j
�|j
�|j|�|jj�y#|jj	�wxYwrh)
r�r�r��clearr�r�r��_parse_kex_initr��	start_kex�rr�s  rlrzTransport._negotiate_keys�s������'�'�)�	.����$�$�&��#�#�+�+�-����&����!����Q�����!�!�#��
�#�#�+�+�-�s�B�B4c���td�D]U}|dk(r
|j}nd}	|jj|�}|dddk(rn|jtd|z��Wdddk7rt
d|zd	z��||_
|jtd
j|��|jd�}|dk\r|d|}|jdd�}t|�d
krt
d��|d}|d}|dk7r!|dk7rd}t|j|���dj||�}|jt |�y#t$r�t
$r}t
dt|�z��d}~wwxYw)N�dr�z!Error reading SSH protocol banner�r�zBanner: z!Indecipherable protocol version "�"zRemote version/idstring: {}rr��zInvalid SSH bannerr�z1.99rqz(Incompatible version ({} instead of 2.0)z!Connected (version {}, client {}))�ranger�r��readlinercr�r^r�r�rr�r��findr�r�rar)	r�ir_�bufr �segs�versionrqr)s	         rlrtzTransport._check_banner	s����s��	/�A��A�v��-�-����
��o�o�.�.�w�7���2�A�w�&� ���I�I�e�Z�#�-�.�#	/�$�r��7�f���B�S�H�3�N�O�O�!����	�	�%�6�=�=�c�B�C�
�H�H�S�M����6��b�q�'�C��y�y��a� ���t�9�q�=��3�4�4��q�'���a����f���E�!1�<�C�"�3�:�:�g�#6�7�7�1�8�8��&�I���	�	�$����='�
���
�"�7�#�a�&�@����
�s�E�E6�E1�1E6c��|jj�	|jj�|jj	�d|_d|_t|j�}|jr�d}|D�cgc]}|j|�s�|��}}|j�[t|�dkDrM|j�jD�cgc]}|j|�s|��}}||j�_ttt|j j#��j$|j&��}n|j&}|j)d�|j*r%|jrdnd}|j)d	|�d
��t-�}|j/t0�|j3t5j6d��|j9|�|j9|�|j9|j:�|j9|j:�|j9|j<�|j9|j<�|j9|j>�|j9|j>�|jAtC��|jAtC��|jEd�|jGd�|jI�x|_%|_&|jO|�y#|jj	�wxYwcc}wcc}w)z�
        announce to the other side that we'd like to negotiate keys, and what
        kind of key negotiation we support.
        FTz!diffie-hellman-group-exchange-shaNr�
ext-info-c�s�c�kex-strict-�-v00@openssh.comr�)(r�r�r�r�r�r�r�rvr>r�
startswithrmr�rQr=�filterrr5�__contains__r8rr�rPr�rr�r�r��add_listr/r3rAr��bytesr�r�r�r��_latest_kex_initr4)	r�	kex_algos�mp_required_prefixr7�kex_mp�pkex�available_server_keysr�r�s	         rlr�zTransport._send_kex_init1	s���
	
���'�'�)�	.����$�$�&��#�#�+�+�-�!��������+�+�,�	����!D��!*�O�A�a�l�l�;M�.N�a�O�F�O��"�"�*��V��q��
"�6�6�8�<�<����<�<�(:�;�����
37��)�)�+�/�$(����-�-�2�2�4�5�B�B��'�'��
%�!�%)�$7�$7�!�

���\�*��$�$��+�+�C��E����{�5�'�1A�B�C��I��	�
�
�<� �	���B�J�J�r�N�#�	�
�
�9��	�
�
�(�)�	�
�
�4�)�)�*�	�
�
�4�)�)�*�	�
�
�4�&�&�'�	�
�
�4�&�&�'�	�
�
�4�-�-�.�	�
�
�4�-�-�.�	���U�W��	���U�W��	�
�
�e��	�	�	�!��67�i�i�k�A���d�3����1���{
�#�#�+�+�-��P��s�L+�M
�M
�M�+Mc��i}|r|j�|jd�|j�|d<|j�|d<|j�|d<|j�|d<|j�|d<|j�|d<|j�|d<|j�|d	<|j�|d
<|j�|d<|j�|d<|j	�|S)
Nr��
kex_algo_list�server_key_algo_list�client_encrypt_algo_list�server_encrypt_algo_list�client_mac_algo_list�server_mac_algo_list�client_compress_algo_list�server_compress_algo_list�client_lang_list�server_lang_list�kex_follows)�get_byte�	get_bytes�get_list�get_booleanr�)rr��ignore_first_byte�parseds    rl�_really_parse_kex_initz Transport._really_parse_kex_inity	s������
�J�J�L�	���B��"#�*�*�,����)*�����%�&�-.�Z�Z�\��)�*�-.�Z�Z�\��)�*�)*�����%�&�)*�����%�&�./�j�j�l��*�+�./�j�j�l��*�+�%&�Z�Z�\��!�"�%&�Z�Z�\��!�"� !�
�
���}��	�	�	���
rnc�N�|jt|j�d��S)NT)r�)r�rPr�r.s rl�_get_latest_kex_initzTransport._get_latest_kex_init�	s+���*�*��D�)�)�*�"�+�
�	
rnc��|j|�}|d}|d}|d}|d}|d}|d}|d}	|d}
|d	}|d
}|d}
|jtd�d
|fd|fd|fd|fd|fd|fd|	fd|
fd|fd|ff
D]E\}}|dgk(rdg}dj|�}|jtdj	||���G|jtdj	|
��|jtd�d|_d|_g}t|�D]�\}}|jd�r||_|jd|��1|jd�s�C|jrd nd!}d|�d"�}||k(xr|j|_|jtd#|j���|jd|���|D]}|j|��|jr&|js|jdk7rt!d$��|jr*t#t%|j&j(|��}n)t#t%|j(|j&��}t+|�dk(rt-d%��|j.|d|�|_|jtd&j	|d��|jrjt#t%t#|j2j5��j(|j6��}t#t%|j(|��}n)t#t%|j(|j6��}t+|�dk(rt-d'��|d|_|jr|j;��t-d(��|j=d)|d|d�|jrSt#t%|j>j(|��}t#t%|j>j(|��}nRt#t%|j(|j>��}t#t%|j(|j>��}t+|�dk(st+|�dk(rt-d*��|d|_ |d|_!|j=d+|j@|jB�,�|jrSt#t%|jDj(|��}t#t%|jDj(|��}nRt#t%|j(|jD��}t#t%|j(|jD��}t+|�dk(st+|�dk(rt-d-��|d|_#|d|_$|j=d.|jF|jH�,�|jrSt#t%|jJj(|	��}t#t%|jJj(|
��}nRt#t%|	j(|jJ��}t#t%|
j(|jJ��}t+|�dk(st+|�dk(r-d/}|d0z
}t-|j	|||jJ���|d|_&|d|_'|j=d1|jL|jN�,�|jtd2�tP|jS�z|_*y)3Nr�r�r�r�r�r�r�r�r�r�r�z"=== Key exchange possibilities ===z	kex algosz
server keyzclient encryptzserver encryptz
client macz
server maczclient compresszserver compresszclient langzserver langr�z<none>z, z{}: {}zkex follows: {}z=== Key exchange agreements ===z	ext-info-rr�r�r�r�zStrict kex mode: z9In strict-kex mode, but KEXINIT was not the first packet!z3Incompatible ssh peer (no acceptable kex algorithm)zKex: {}z.Incompatible ssh peer (no acceptable host key)z;Incompatible ssh peer (can't match requested host key type)�HostKeyz/Incompatible ssh server (no acceptable ciphers)r
)r�r�z,Incompatible ssh server (no acceptable macs)�MACz3Incompatible ssh server (no acceptable compression)z {!r} {!r} {!r}�Compressionz=== End of kex handshake ===)+r�r�rr"r��_remote_ext_info�_remote_strict_kex�	enumerater�rnrr�r�r�r�r|rbrvr�r>r�r�ra�	_kex_infor�rr5r8r�rkr�r/r�r�r3r�r�rAr�r�r�
get_so_farr�)rr�r�r�r�r�r�r�r�r�r�r�r�r��prefix�value�to_popr��algor��expected�
agreed_kexr��agreed_keys�agreed_local_ciphers�agreed_remote_ciphers�agreed_remote_macs�agreed_local_macs�agreed_remote_compression�agreed_local_compressionr)s                               rlr�zTransport._parse_kex_init�	s����,�,�Q�/����/�
�%�&<�=��#)�*D�#E� �#)�*D�#E� �%�&<�=��%�&<�=��$*�+F�$G�!�$*�+F�$G�!�!�"4�5��!�"4�5���]�+���	�	�%�=�>�
�-�(�
�/�0��7�8�
�7�8�
�/�0�
�/�0�
� 9�:�
� 9�:�
�,�-�
�,�-�

�	=�M�F�E����}�!�
���I�I�e�$�E��I�I�e�X�_�_�V�U�;�<�#	=�$	
�	�	�%�*�1�1�+�>�?��	�	�%�:�;�!%���"&����� ��/�	$�G�A�t����{�+�(,��%��
�
�a��#�����/�#�/�/��S��(���/?�@���H�$�B��)B�)B��)��	�	��.�t�/H�/H�.I�J���
�
�a��#�	$� �	!�A����a� �	!�
�%�%��)�)����1��#�K��
������t�)�)�6�6�
�F��J���}�1�1�4�3E�3E�F��J��z�?�a��#�E��
�8�$�.�.��A��7��=����	�	�%��)�)�*�Q�-�8�9����$(����-�-�2�2�4�5�B�B��'�'��%�!���)�6�6�8L���K���+�8�8�$�:M�:M�N��K��{��q� �"�@��
�)��^�������!4�!4�!6�!>�"�M��
�	
���I�{�1�~�{�1�~�F����#'���*�*�7�7�,��$� �%)���*�*�7�7�,��%�!�$(��,�9�9��*�*��$� �%)��,�9�9��*�*��%�!��#�$��)�S�1F�-G�1�-L�"�A��
�1��3���2�1�5�������D�-�-�d�6H�6H�	�	
����!%��t�*�*�7�7�9M�N�"��!%��t�*�*�7�7�9M�N�!��!%��+�8�8�$�:M�:M�N�!��"&��+�8�8�$�:M�:M�N�"��
�!�"�a�'�S�1C�-D��-I�"�>��
�+�1�-���,�Q�/�������������	�	
����(,���.�.�;�;�-��)�%�(,���.�.�;�;�-��(�$�(,��-�:�:��.�.��(�$�)-��-�:�:��.�.��)�%�
�(�)�Q�.��,�-��2�G�C��$�$�C�"��
�
�,�-��.�.���
�":�!�!<���";�A�">��������(�(��*�*�	�	
�
	
�	�	�%�7�8� ,�a�l�l�n�<��rnc�b�|j|jd}|jr?|jd|�}|jd|j|jd�}n>|jd|�}|jd|j|jd�}|j	|j|||j
�}d|jv}|j|jd}|j|jd	}|jr"|jd
|�j�}n!|jd|�j�}|jj||||||��|j|jd
}	|	�Q|jdk7s|jr6|jtd�|jj!|	��|j"r1|jtd�|jj%�yy)zMswitch on newly negotiated encryption parameters for
         inbound trafficr��A�Cr��B�D�etm@openssh.comr�r��E�F��etmr�Nr��$Switching on inbound compression ...z8Resetting inbound seqno after NEWKEYS due to strict mode)rGr�rrNrW�_DECRYPTr��	_mac_info�digest_sizer��set_inbound_cipher�_compression_infor�r�r�r�set_inbound_compressorr��reset_seqno_in)
r�
block_size�IV_in�key_in�enginer��mac_size�
mac_engine�mac_key�compress_ins
          rl�_activate_inboundzTransport._activate_inbound|
s����&�&�t�'9�'9�:�<�H�
�����%�%�c�:�6�E��&�&��T�&�&�t�'9�'9�:�:�F��F��%�%�c�:�6�E��&�&��T�&�&�t�'9�'9�:�:�F��F��!�!������t�}�}�
�� �4�?�?�2���>�>�$�/�/�2�6�:���^�^�D�O�O�4�W�=�
�����'�'��Z�\�-E�-E�F�G��'�'��Z�\�-E�-E�F�G����*�*��J�
�H�g�3�	+�	
��,�,�T�-D�-D�E�a�H���"��#�#�'9�9�T�=O�=O��I�I�e�C�D��O�O�2�2�;�=�A��$�$��I�I��J�
�
�O�O�*�*�,�%rnc	��t�}|jt�|j|�|jr0|jtd�|jj�|j|jd}|jr?|jd|�}|jd|j|jd�}n>|jd|�}|jd|j|jd�}|j|j|||j�}d|jv}|j |jd	}|j |jd
}|jr"|jd|�j"�}	n!|jd|�j"�}	|jj%d
�}
|jj'|||||	|
|��|j(|j*d}|�Q|j*dk7s|j,r6|jtd�|jj/|��|jj1�sd|_|jr�|j4r�|j6dk(r�ddj9|j:�i}t�}|jt<�|j?tA|��tC|jE��D]'\}
}|jG|
�|jG|��)|j|�|jItJ�y)zNswitch on newly negotiated encryption parameters for
         outbound trafficz9Resetting outbound seqno after NEWKEYS due to strict moder�r�r�r�r�r�r�r�r�r�r�z-ctrr�rNr��%Switching on outbound compression ...Fr�zserver-sig-algs�,)&rPr�rr4r�r�rr��reset_seqno_outrGr�rrNrWrQr�r�r��endswith�set_outbound_cipherr�r�r��set_outbound_compressorrvr�rr�r"r;r>r�r��sorted�itemsr�r<r)rr�r��IV_out�key_outr�r�r�r�r��sdctr�compress_out�
extensionsr�r�s               rl�_activate_outboundzTransport._activate_outbound�
s���
�I��	�
�
�<� ����1���$�$��I�I��K�
�
�O�O�+�+�-��&�&�t�'8�'8�9�,�G�
�����&�&�s�J�7�F��'�'��T�&�&�t�'8�'8�9�*�E��G��&�&�s�J�7�F��'�'��T�&�&�t�'8�'8�9�*�E��G��!�!����w���
�
�
�� �4�>�>�1���>�>�$�.�.�1�&�9���^�^�D�N�N�3�G�<�
�����'�'��Z�\�-E�-E�F�G��'�'��Z�\�-E�-E�F�G��!�!�*�*�6�2�����+�+��J�
�H�g�u�#�	,�	
��-�-�d�.D�.D�E�a�H���#��"�"�&8�8�D�<N�<N��I�I�e�D�E��O�O�3�3�L�N�C����)�)�+��D�K�
����$�$��%�%��5�+�S�X�X�d�6L�6L�-M�N�J��	�A�
�J�J�}�%�
�I�I�c�*�o�&�%�j�&6�&6�&8�9�
$���e����T�"����U�#�
$�
���q�!����K�(rnc��d|_|jdk(rR|j|jd}|jtd�|j
j
|��|jdk(rS|j|jd}|jtd�|j
j|��yy)NTr�rr�r�r�)	r�r�r�r�rr�r�r�r�)rrr�s   rl�
_auth_triggerzTransport._auth_trigger�
s���!����!�!�%7�7��1�1�$�2H�2H�I�!�L�L��I�I�e�D�E��O�O�3�3�L�N�C��"�"�&8�8��0�0��1H�1H�I�!�L�K��I�I�e�C�D��O�O�2�2�;�=�A�9rnc���i}t|j��D]'}|j�}|j�}|||<�)|j	t
dj
|��||_y)NzGot EXT_INFO: {})r�r�rg�
get_stringr�rr�r�)rr)r�_r�r�s      rlrzTransport._parse_ext_info�
sj���
��s�{�{�}�%�	%�A��<�<�>�D��N�N�$�E�$�J�t��	%�	
�	�	�%�+�2�2�:�>�?�",��rnc��|jtd�|j�dx|_|_d|_d|_|jr|j�t|�|_|jsdx|_
|j_|j�|jj�|jj�sd|_|j"j%�	|j&j�|j"j)�y#|j"j)�wxYw)NzSwitch to new keys ...TF)r�rr�r�r�r�r�rr�r
r�r��_initial_kex_doner�r�rvr�r�r�r�r�r�s  rlr	zTransport._parse_newkeyss���	�	�%�1�2���� �59�9���d�2�����������!2�!2�!:� +�D� 1�D���$�$�IM�L�D�!�D�O�O�$E�� � �,��!�!�%�%�'����)�)�+��D�K����'�'�)�	.����"�"�$��#�#�+�+�-���
�#�#�+�+�-�s�1D&�&Ec��|j�}|j�}|jtdj	||��y)NzDisconnect (code {:d}): {})r�rgr�rr�)rr��code�descs    rlrxzTransport._parse_disconnects4���y�y�{���z�z�|���	�	�$�4�;�;�D�$�G�Hrnc�&�|j�}|jtdj|��|j	�}|j
s(|jtdj|��d}n�|dk(rB|j�}|j
�}|jj||�}|rd|f}n`|dk(r?|j�}|j
�}|jj||�d}n|jj||�}d}t|�tur|}d}|rXt�}|r%|jt�|j |�n|jt"�|j%|�yy)NzReceived global request "{}"z*Rejecting "{}" global request from server.Fr�r�T�)rgr�rr�r�rr�r�check_port_forward_request�cancel_port_forward_request�check_global_requestr�r�rPr�r r�r!r4)	rr�r��
want_reply�okr�r��extrar)s	         rlr
zTransport._parse_global_request#sS���z�z�|���	�	�%�7�>�>�t�D�E��]�]�_�
�����I�I��<�C�C�D�I�
��B�
�_�
$��j�j�l�G��9�9�;�D��#�#�>�>�w��M�B���U��
�+�
+��j�j�l�G��9�9�;�D����:�:�7�D�I��B��#�#�8�8��q�A�B�����8�u���E��B���)�C�����1�2����������1�2����s�#�rnc��|jtd�||_|j�|jj	�yy)NzGlobal request successful.�r�rr�r�r�r�s  rlrz Transport._parse_request_successGs<���	�	�%�5�6� ���� � �,��!�!�%�%�'�-rnc��|jtd�d|_|j�|jj	�yy)NzGlobal request denied.rr�s  rlrz Transport._parse_request_failureMs<���	�	�%�1�2�#���� � �,��!�!�%�%�'�-rnc�t�|j�}|j�}|j�}|j�}|jj|�}|�|jtd�y|j
j
�	|j|||�|jtdj|��||jvr*|j|j�|j|=|j
j�y#|j
j�wxYw)Nz%Success for unrequested channel! [??]zSecsh channel {:d} opened.)
r�r�r#r�rr�r��_set_remote_channelrr�r�r�r�)rr�r��
server_chanid�server_window_size�server_max_packet_sizerys       rlr
z%Transport._parse_channel_open_successSs���������	�	��
��Y�Y�[��!"������~�~�!�!�&�)���<��I�I�g�F�G���	�	����		 ��$�$��1�3I�
�
�I�I�e�9�@�@��H�I���,�,�,��#�#�F�+�/�/�1��'�'��/��I�I������
�I�I����s
�A0D�D7c��|j�}|j�}|j�}|j�tj|d�}|j	t
dj
|||��|jj�	t||�|_
||jvrS|jj|�||jvr*|j|j�|j|=|jj�y#|jj�wxYw)Nz(unknown code)z&Secsh channel {:d} open FAILED: {}: {})r�rgr"r#r�rr�r�r�r`r�r�r�r0r�r�)rr�r�r�
reason_str�reason_texts      rlrz%Transport._parse_channel_open_failureis�������������Z�Z�\�
�	�
�
��,�0�0��9I�J���	�	��4�;�;��
�K�
�	
�	
�	�	����	 �#3�F�K�#H�D� ���,�,�,����%�%�f�-��T�0�0�0��'�'��/�3�3�5��+�+�F�3��I�I������
�I�I����s
�A2D&�&Ec�:�|j�}|j�}|j�}|j�}d}|dk(ri|j�]|jtd�|j
j
�	|j�}|j
j��n�|dk(r�|j��|j�}|j�}	|jtdj||	��|j
j
�	|j�}|j
j��n�|dk(r�|j��|j�}
|j�}|j�}|j�}	|jtdj||	��|j
j
�	|j�}|j
j��n2|js.|jtdj|��d	}t}n�|j
j
�	|j�}|j
j�|d
k(rb|j�}
|j�}|j�}|j�}	|jj|||	f|
|f�}n|jj!||�}|t"k7r'|jtdj|��d	}|rut%�}|j't(�|j+|�|j+�|j-d�|j-d
�|j/|�yt1�}|j
j
�	|j2j5||�d	|j6|<|j9|�|j;|j<|j>�|jA|||�|j
j�t%�}|j'tB�|j+|�|j+|�|j+|j<�|j+|j>�|j/|�|jtdj||��|dk(r|j|�y|dk(r|j|	f�y|dk(r!	f|_"|j|||	f
f�y|jG|�y#|j
j�wxYw#|j
j�wxYw#|j
j�wxYw#|j
j�wxYw#|j
j�wxYw)NFr�z!Incoming forward agent connectionr�z$Incoming x11 connection from {}:{:d}r�z.Incoming tcp forwarded connection from {}:{:d}z+Rejecting "{}" channel request from server.Tr�z+Rejecting "{}" channel request from client.r�rfzSecsh channel {:d} ({}) opened.)$rgr�r�r�rr�r�r�r�r�r�r�rr#r�"check_channel_direct_tcpip_request�check_channel_requestr$rPr�r%r�r�r4rr�r�r�r�r�r�r�rr&�origin_addrr�)rr�r�r��initial_window_sizer��reject�	my_chanidr(�origin_port�server_addr�server_portrr��	dest_portr)rys                 rlrzTransport._parse_channel_open�s����z�z�|��������i�i�k���)�)�+�����,�,��+�+�7��I�I�e�@�A��I�I����
$� �.�.�0�	��	�	�!�!�#��e�m�$�"3�"3�"?��*�*�,�K��)�)�+�K��I�I��6�=�=����
�
�I�I����
$� �.�.�0�	��	�	�!�!�#��'�'�d�.?�.?�.K��*�*�,�K��)�)�+�K��*�*�,�K��)�)�+�K��I�I��@�G�G����
�
�I�I����
$� �.�.�0�	��	�	�!�!�#��!�!��I�I��=�D�D�T�J�
��F�<�F��I�I����
$� �.�.�0�	��	�	�!�!�#��~�%��J�J�L�	��I�I�K�	��j�j�l���i�i�k���+�+�N�N�� �+�.��	�*����+�+�A�A��)�����'��	�	��A�H�H��N������)�C��L�L�2�3��K�K����K�K����N�N�2���N�N�4� ����s�#���y�!���	�	����	 ��N�N���y�$�/�,0�D���y�)�����%�����(�(�$�*F�*F�
�
�$�$��+�_�
�
�I�I�����I��	�
�
�,�-�	�	�	�&��	�	�	�)��	�	�	�$�*�*�+�	�	�	�$�.�.�/����1���	�	��4�;�;�I�t�L�	
��+�+��'�'��-�
�U�]����d�[�+�$>�?�
�&�
&� +�[�9�D������{�K�0�;��2L�
�
�(�(��.��[�	�	�!�!�#���	�	�!�!�#�� �	�	�!�!�#���	�	�!�!�#��Z
�I�I����s=�V�#V!�!W�"W�A5W>�V�!V=�W�W;�>Xc���|j�|j�}|j�|jtdj	tj|���y)Nz
Debug msg: {})r�rr�rr�r�safe_string)rr�r)s   rlryzTransport._parse_debug�sC��	�
�
���l�l�n��	�����	�	�%��/�/��0@�0@��0E�F�Grnc�"�	|jj�||jvrdgif|jj�S|j||jj�S#|jj�wxYwrhr�rs  rl�_get_subsystem_handlerz Transport._get_subsystem_handlersq��	 ��I�I�����4�/�/�/��R��|�
�I�I�����'�'��-��I�I�����D�I�I����s�,A2�	A2�2B)TTrh)NNN)NNNNN)NT)	Nr�NNNFFTT)r�)Nr�)T)F)�rG�
__module__�__qualname__�__doc__�objectrQr�r�r��paramiko�__version__r��_preferred_ciphers�_preferred_macsr��_preferred_pubkeysr�rC�is_availabler�rr	�AESr�CTR�CBC�	TripleDESrGrrrrr�rZrAr[rBr>rFrGrDrErHrIrNrOrMrJrKrLr�r?r@r�rmr�r8r9r�r*�propertyr/r3r8r;r>rArKrNrQrVrardrhrk�staticmethodrtrMr|r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r\r�rHr�r�r�r�r�r�r
r�r�rrrrrrrjr�r,r�r1r4r�r9r<rArNrWr\r`r�r�r�rkrnr�r�rrtr�r�r�r�r�rr	rr	rxr
rrr
rrryr3r-r�_request_successr.�_request_failedr/�_feedr0�_feed_extendedr1�_window_adjustr2�_handle_requestr3�_handle_eofr4�
_handle_closer{rrnrlrprp�s�����x�H��x�H��I��%�%�h�&:�&:�;�J���	�O�	�O�	��
�N�"�}�!�!�#�:�^�K����
'�� �^�^��I�I���	
� �^�^��I�I���	
� �^�^��I�I���	
� �^�^��I�I���	
� �^�^��I�I���	
� �^�^��I�I���	
� �)�)��I�I���	
�K+�L�\ $�R�0�"&��3�#)�2�6�39�2�)F�#)�2�6�39�2�)F�!�2�.�!$�b�1�	�I��
	�6��	'��
�	���	,�V��	���	,�V��	�6��	'���	�x��	3�H��	�x�� 	3�H�!�"	�x�#�$	3�H�%�&	�z�'�(	+�J�)�I�0'0�'1�.4�0<�)9�)9�4@�5B�1:�)�)�)�
�I�"�}�!�!�#�4A�	�0�1�,�-=�>��!1�2��
���M���
0� 7��� ����g
�R
��1��1��.��.��	
��	
��1��1��-��-��5��5��2�%� !�D8�t@�D7�(�*�&��&�P	��"�?C�!
�F;� ;�
I������]�~4�lP�
/�#�$�4:�"#$�J�6���
������~�@ �( �(

�
0�(�=�8S�j/=�b3=�jD�.=�4=�.
-��
-�	-�4�"�"�2/�"��&�+�.�4 �.�
��<*�2�	(� �J�
N�
$�L�h�T	�$�)�VF�P�&
�h=�T)-�V?)�B
B�,��8I�
"$�H(�(��,�0|/�|H� �	�W�5�5��W�4�4��'�-�-�!�7�#9�#9�!�7�#9�#9��W�4�4���,�,��7�0�0�	�rnrpc�*�eZdZdZdZd�Zd�Zd�Zed��Z	e	jd��Z	ed��Zejd	��Zed
��Zejd��Zed��Z
e
jd
��Z
ed��Zejd��Zy)rPa:
    Simple object containing the security preferences of an ssh transport.
    These are tuples of acceptable ciphers, digests, key types, and key
    exchange algorithms, listed in order of preference.

    Changing the contents and/or order of these fields affects the underlying
    `.Transport` (but only if you change them before starting the session).
    If you try to add an algorithm that paramiko doesn't recognize,
    ``ValueError`` will be raised.  If you try to assign something besides a
    tuple to one of the fields, ``TypeError`` will be raised.
    �
_transportc��||_yrh)rM)r�	transports  rlr�zSecurityOptions.__init__,s	��#��rnc�8�dj|j�S)rCz#<paramiko.SecurityOptions for {!r}>)r�rMr.s rlrKzSecurityOptions.__repr__/s��5�;�;�D�O�O�L�Lrnc�`�t|�turt|�}t|�turtd��tt	|j
|�j
��}|D�cgc]	}||vs�|��}}t|�dkDrtd��t|j
||�ycc}w)Nzexpected tuple or listrzunknown cipher)
r�rvr��	TypeErrorr(rMr5r��
ValueErrorrI)rr��origr%�possible�n�	forbiddens       rl�_setzSecurityOptions._set5s�����7�d�?��a��A���7�%���4�5�5�������6�;�;�=�>�� !�7�1�Q�h�%6�Q�7�	�7��y�>�A���-�.�.������q�)��8s�*	B+�4B+c�.�|jjS)zSymmetric encryption ciphers)rMr:r.s rlr,zSecurityOptions.ciphers@s�����1�1�1rnc�*�|jdd|�y)Nr:rG�rX�rr%s  rlr,zSecurityOptions.ciphersEs���	�	�&���:rnc�.�|jjS)z Digest (one-way hash) algorithms)rMr;r.s rl�digestszSecurityOptions.digestsI������.�.�.rnc�*�|jdd|�y)Nr;r�r[r\s  rlr^zSecurityOptions.digestsN����	�	�#�[�!�4rnc�.�|jjS)zPublic-key algorithms)rMr�r.s rl�	key_typeszSecurityOptions.key_typesRr_rnc�*�|jdd|�y)Nr�r>r[r\s  rlrczSecurityOptions.key_typesWrarnc�.�|jjS)zKey exchange algorithms)rMr�r.s rlr=zSecurityOptions.kex[s�����-�-�-rnc�*�|jdd|�y)Nr�r�r[r\s  rlr=zSecurityOptions.kex`s���	�	�"�K��3rnc�.�|jjS)zCompression algorithms)rMrr.s rlr@zSecurityOptions.compressionds�����5�5�5rnc�*�|jdd|�y)Nrr�r[r\s  rlr@zSecurityOptions.compressionis���	�	�*�,?��CrnN)rGr4r5r6�	__slots__r�rKrXrBr,�setterr^rcr=r@rrnrlrPrPs��
��I�$�M�	*��2��2�
�^�^�;��;��/��/�
�^�^�5��5��/��/����5��5��.��.�	�Z�Z�4��4��6��6����D��DrnrPc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)r�c�h�tj�|_tj�|_yrh)r��WeakValueDictionary�_mapr�r��_lockr.s rlr�zChannelMap.__init__os ���/�/�1��	��^�^�%��
rnc���|jj�	||j|<|jj�y#|jj�wxYwrh)ror�rnr�)rr�rys   rlr�zChannelMap.puttsF���
�
����	!� $�D�I�I�f���J�J��� ��D�J�J��� �s�A�A"c���|jj�	|jj|d�|jj	�S#|jj	�wxYwrh)ror�rnr#r�r.s  rlr#zChannelMap.get{sJ���
�
����	!��9�9�=�=���.��J�J��� ��D�J�J��� �s�A�A.c���|jj�		|j|=|jj	�y#t$rY�&wxYw#|jj	�wxYwrh)ror�rnrjr�r.s  rlr0zChannelMap.delete�sa���
�
����	!�
��I�I�f�%�
�J�J��� ���
��
��
�J�J��� �s#�
A�	A�A�A�A�A0c���|jj�	t|jj	��|jj�S#|jj�wxYwrh)ror�rvrnrwr�r.s rlrwzChannelMap.values�sM���
�
����	!���	�	�(�(�*�+��J�J��� ��D�J�J��� �s�"A�A5c���|jj�	t|j�|jj	�S#|jj	�wxYwrh)ror�r�rnr�r.s rl�__len__zChannelMap.__len__�sC���
�
����	!��t�y�y�>��J�J��� ��D�J�J��� �r�N)	rGr4r5r�r�r#r0rwrurrnrlr�r�ns ��&�
!�!�!�!�!rnr�)�r6�
__future__rr�r�rrr�rZr��hashlibrrrr�cryptography.hazmat.backendsr�&cryptography.hazmat.primitives.ciphersr	r
rr8r�paramiko.auth_handlerr
�paramiko.ssh_gssr�paramiko.channelr�paramiko.commonrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>�paramiko.compressr?r@�paramiko.dsskeyrA�paramiko.ed25519keyrB�paramiko.kex_curve25519rC�paramiko.kex_gexrDrE�paramiko.kex_group1rF�paramiko.kex_group14rGrH�paramiko.kex_group16rI�paramiko.kex_ecdh_nistrJrKrL�paramiko.kex_gssrMrNrO�paramiko.messagerP�paramiko.packetrQrR�paramiko.primesrS�paramiko.py3compatrTrUrVrWrXrY�paramiko.rsakeyrZ�paramiko.ecdsakeyr[�paramiko.serverr\�paramiko.sftp_clientr]�paramiko.ssh_exceptionr^r_r`rarbrc�
paramiko.utilrdrerfrirm�atexit�registerr�rpr7rPr�rrnrl�<module>r�s+��(�&�	�
�
����-�-�8�L�L���-�$�$�0�0�0�0�0�0�0�0�0�0�0�0�0�b?�"�*�1�1�)�=�1�H�H�C�C�$�:�'�J�J�"�&�+�+���N�M����
�����'�(�R.�	� � �"7�R.�p\ND�f�ND�b*!��*!rn

Zerion Mini Shell 1.0