U ¨Ãq`Ãã@súdZddlmZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z ddlmZddlmZmZmZddlZddlmZddlmZdd lmZdd lmZdd lmZmZmZm 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;mZ>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZIdd lJmKZKmLZLdd lMmNZNddlOmPZPddlQmRZRddlSmTZTmUZUddlVmWZWddlXmYZYmZZZddl[m\Z\ddl]m^Z^m_Z_m`Z`ddlambZbmcZcmdZdddlemfZfddlgmhZhmiZiddljmkZkddllmmZmmnZnmoZompZpmqZqmrZrddlsmtZtddlumvZvddlwmxZxddlymzZzddl{m|Z|m}Z}m~Z~mZddl€mZm‚Z‚mƒZƒgZ„d d!„Z…ddl†Z†e† ‡e…¡Gd"d#„d#ejˆe‚ƒZ‰Gd$d%„d%eŠƒZ‹Gd&d'„d'eŠƒZŒdS)(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)Ú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ÚProxyCommandFailure)Úretry_on_signalÚClosingContextManagerÚ clamp_valuecCstD] }| ¡qdS©N)Ú_active_threadsÚ stop_thread)Zthr©reú9/tmp/pip-target-nv4zd3e_/lib/python/paramiko/transport.pyÚ_join_lingering_threadswsrgc@sèeZdZdZeƒZeƒZdZd e j ¡Z dZ dZ dZdZe ¡rHdeZd Zd Zejejd d d œejejd d d œejejd dd œejejdd d œejejd d d œejejd d d œejejd dd œejejdd d œdœZeddœeddœeddœeddœeddœeddœed dœeddœdœZ e!e!e"e"e#e#e#e#e#e#e$e$dœ Z%e&e'e(e)e*e+e,e-e.e/e0e1dœ Z2e ¡rjee2d<e3e4fe3e4fddœZ5dZ6dZ7e8e9dddfdd „Z:d!d"„Z;ee„ƒZKd?d@„ZLdAdB„ZMdCdD„ZNdÔdEdF„ZOdÕdGdH„ZPdIdJ„ZQdKdL„ZRdÖdMdN„ZSd×dOdP„ZTdQdR„ZUdSdT„ZVdØdUdV„ZWdWdX„ZXdYdZ„ZYdÙd[d\„ZZdÚd]d^„Z[dÛd`da„Z\dbdc„Z]ddde„Z^dfdg„Z_dhdi„Z`djdk„Zadldm„ZbdÜdndo„ZcdÝdpdq„ZddÞdrds„Zedßdtdu„Zfdvdw„Zgdxdy„Zhdzd{„Zid|d}„Zjd~d„Zkd€d„Zldàd‚dƒ„Zmd„d…„Znd†d‡„Zodˆd‰„ZpdŠd‹„ZqdŒd„ZrdŽd„Zsdd‘„Ztd’d“„Zud”d•„Zvd–d—„Zwd˜d™„Zxdšd›„Zydœd„ZzdždŸ„Z{d d¡„Z|d¢d£„Z}d¤d¥„Z~d¦d§„Zd¨d©„Z€dªd«„Zd¬d­„Z‚d®d¯„Zƒd°d±„Z„d²d³„Z…d´dµ„Z†d¶d·„Z‡d¸d¹„Zˆdºd»„Z‰d¼d½„ZŠd¾d¿„Z‹dÀdÁ„ZŒdÂdÄZdÄdÅ„ZŽdÆdÇ„ZdÈdÉ„ZdÊdË„Z‘dÌdÍ„Z’dÎdÏ„Z“e”eŠe•eŒe–ee—eŽe˜ee™eeše‘e›eƒiZœeežjŸe ežj¡e¢ežj£e¤ežj¥e¦ežj§e¨ežj©eªežj«e¬ežj­iZ®dS)áÚ 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.0z paramiko_{})ú aes128-ctrú aes192-ctrú aes256-ctrú aes128-cbcú aes192-cbcú aes256-cbcú blowfish-cbcú3des-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ú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éé é)rjrkrlrprmrnrorqé)rÚsizeé é@)rvrxrrrtrsrurwry) r~zssh-rsa-cert-v01@openssh.comrzssh-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€rr‚r‰)NN©úzlib@openssh.comÚzlibrŽNçš™™™™™¹?FTc sød|_d|_tˆtƒrZˆ dd¡}|d|_t|ƒdkrF|ddf‰n|dt|dƒf‰tˆƒtkrˆ\‰‰ˆ|_d}t   ˆˆt j t j ¡} | D]x\} } } } }| t j kr’| }t   |t j ¡‰zt ‡‡‡fdd „ƒWn.t jk r}z t|ƒ}W5d}~XYq’Xqq’td  ˆ|¡ƒ‚tj |¡| d ¡ˆ|_|j |j¡tˆƒ|_d |jd |j|_d|_d|_|_ d|_!|_"d|_#|_$d|_%|_&d|_'d|_(d|_)||_*d|_+d|_,d|_-|j*rèt.d|ƒ|_,|j/|j0|_0d|_1d|_2d|_3d|_4d|_5d|_6tƒ|_7t 8¡|_9t:ƒ|_;i|_||_?||_@d|_Ad|_Bd|_Cd|_Dt E¡|_Ft 8¡|_Gd|_Hd|_ItJ K|jI¡|_L|j M|jL¡d|_Nd|_Od|_Pd|_Qd|_Rd|_S|pÄi|_Td|_Ud|_Vi|_Wg|_Xt Y|j9¡|_Zi|_[dS)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"]}``. .. 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. FNú:érézNo suitable address familycsˆ ˆˆf¡Srb)Úconnectre©ÚhostnameÚportÚsockrerfÚ™óz$Transport.__init__..zUnable to connect to {}: {}TúSSH-ú-Úz gssapi-keyexg>@zparamiko.transportéé)\Úactiver¤Ú isinstancerQÚsplitÚlenÚintÚtypeÚtupleÚsocketÚ getaddrinfoÚ AF_UNSPECÚ SOCK_STREAMr_ÚerrorÚstrr[ÚformatÚ threadingÚThreadÚ__init__Ú setDaemonr¦Ú settimeoutÚ_active_check_timeoutrNÚ 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_keyZ use_gss_kexÚ gss_kex_usedZ 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_timeoutZ auth_timeoutÚdisabled_algorithmsÚ server_modeÚ server_objectÚserver_key_dictÚserver_acceptsÚ ConditionÚserver_accept_cvÚsubsystem_table)Úselfr¦råräÚgss_kexÚgss_deleg_credsr÷ZhlÚreasonZ addrinfosÚfamilyÚsocktypeÚprotoÚ canonnameZsockaddrÚafÚerer£rfr¾1s°O    ÿ  ÿ            zTransport.__init__cs(tˆd ˆ¡ƒ}t‡‡fdd„|DƒƒS)Nz _preferred_{}c3s$|]}|ˆj ˆg¡kr|VqdSrb)r÷Úget)Ú.0Úx©rÿÚtype_rerfÚ ösþz.Transport._filter_algorithm..)Úgetattrr»r´)rÿr Údefaultrer rfÚ_filter_algorithmôsþzTransport._filter_algorithmcCs | d¡S)NÚciphers©r©rÿrererfÚpreferred_ciphersüszTransport.preferred_cipherscCs | d¡S)NZmacsrrrererfÚpreferred_macsszTransport.preferred_macscCs | d¡S)NÚkeysrrrererfÚpreferred_keysszTransport.preferred_keyscCs | d¡S)NÚkexrrrererfÚ preferred_kexszTransport.preferred_kexcCs | d¡S)NÚ compressionrrrererfÚpreferred_compression szTransport.preferred_compressioncCsœttt|ƒƒt@ƒ}d |¡}|js.|d7}nb|jdkrZ|d |j|j|jdd¡7}| ¡rx|d t |j ƒ¡7}n|j rˆ|d7}n|d 7}|d 7}|S) úP Returns a string representation of this object, for debugging. z) ÚhexrRÚidrr»r®rÇÚ _cipher_infoÚis_authenticatedr±ràrÙ)rÿZid_ÚoutrererfÚ__repr__s$   þÿ zTransport.__repr__cCs|j ¡| ¡dS)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¦ÚcloserrererfÚatfork)s zTransport.atforkcCst|ƒ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. )ÚSecurityOptionsrrererfÚget_security_options6szTransport.get_security_optionscCs6|sdS|dkr|j}|r,|dk r,t |¡}||_dS)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Ó)rÿrÓÚ trust_dnsÚgssapi_requestedrererfÚ set_gss_host?s  zTransport.set_gss_hostcCsžd|_|dk r ||_| ¡dSt ¡|_}| ¡|dk rJt ¡|nd}| d¡|jsz| ¡}|dk rr|‚tdƒ‚|  ¡sš|dk rNt ¡|krNqšqNdS)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 ` or `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ÚtimeoutZmax_timerrererfÚ start_clientas(# ÿ ÿzTransport.start_clientcCsŒ|dkrtƒ}d|_||_d|_|dk r:||_| ¡dSt ¡|_}| ¡| d¡|js||  ¡}|dk rt|‚t dƒ‚|  ¡rPqˆqPdS)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žr-) rYrørùr®rôr.r¼rêr0r1r[r2)rÿr3ÚserverrrererfÚ start_server›s&* zTransport.start_servercCs||j| ¡<dS)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`. N)rúÚget_name)rÿÚkeyrererfÚadd_server_keyÝs zTransport.add_server_keycCs(z|j|jWStk r"YnXdS)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)rúrÐÚKeyErrorrrererfÚget_server_keyës zTransport.get_server_keyc Csbtƒt_ddg}|dk r$| d|¡|D].}ztj |¡WdStk rTYq(Xq(dt_dS)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)rPrhÚ _modulus_packÚinsertÚ read_fileÚIOError)ÚfilenameÚ file_listÚfnrererfÚload_server_modulis  zTransport.load_server_modulicCs<|js dS| ¡t|j ¡ƒD] }| ¡q |j ¡dS)zP Close this session, and any open channels that are tied to it. N)r®rdÚlistràÚvaluesÚ_unlinkr¦r%)rÿÚchanrererfr%)s  zTransport.closecCs|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ÑrrererfÚget_remote_server_key4s zTransport.get_remote_server_keycCs|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®rrererfÚ is_activeEszTransport.is_activecCs|jd|||dS)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_sizer4©Ú open_channel)rÿrMrNr4rererfÚ open_sessionOs üzTransport.open_sessioncCs|jd|dS)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_addrrO)rÿrSrererfÚopen_x11_channelrszTransport.open_x11_channelcCs | d¡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.comrOrrererfÚopen_forward_agent_channel‚s z$Transport.open_forward_agent_channelcCs| d||¡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-tcpiprO)rÿrSÚ dest_addrrererfÚopen_forwarded_tcpip_channels z&Transport.open_forwarded_tcpip_channelc Csò|jstdƒ‚|dkrdn|}|j ¡z| |¡}| |¡}| ¡}tƒ}|  t ¡|  |¡|  |¡|  |¡|  |¡|dks|dkrÊ|  |d¡|  |d¡|  |d¡|  |d¡n$|dkrî|  |d¡|  |d¡t |ƒ} |j || ¡t ¡|j|<} d |j|<|  |¡|  ||¡W5|j ¡X| |¡t ¡} |  d ¡|jsˆ| ¡} | dkr„td ƒ} | ‚|  ¡r˜q¶n| |t ¡krXtd ƒ‚qX|j |¡} | dk rÐ| S| ¡} | dkrêtd ƒ} | ‚dS) 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 activeNirWú direct-tcpiprr rRTržzUnable to open channel.zTimeout opening channel.)r®r[rÞÚacquireÚreleaseÚ_sanitize_window_sizeÚ_sanitize_packet_sizeÚ _next_channelrMÚadd_byterÚ add_stringÚadd_intrràÚputr¼rêrárâÚ_set_transportÚ _set_windowÚ_send_user_messager/r0r1r2r ) rÿÚkindrXrSrMrNr4ÚchanidÚmrHr3Ústart_tsrrererfrPœs`,                   zTransport.open_channelcslˆjstdƒ‚t|ƒ}ˆjd||fdd}|dkr:tdƒ‚|dkrJ| ¡}|dkrb‡fdd „}|}|ˆ_|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 rZú tcpip-forwardT©r0NzTCP forwarding request deniedrcsˆ |¡dSrb©Ú_queue_incoming_channel)ÚchannelrSZdest_addr_portrrerfÚdefault_handler(sz7Transport.request_port_forward..default_handler)r®r[r²Úglobal_requestÚget_intrè)rÿÚaddressr¥ÚhandlerÚresponserqrerrfÚrequest_port_forwardûs"!ÿ zTransport.request_port_forwardcCs(|js dSd|_|jd||fdddS)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-forwardTrm)r®rèrr)rÿrtr¥rererfÚcancel_port_forward1s zTransport.cancel_port_forwardcCs t |¡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 )rZZfrom_transportrrererfÚopen_sftp_client?s zTransport.open_sftp_clientcCsLtƒ}| t¡|dkr.tt d¡ƒdd}| t |¡¡| |¡dS)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•é )rMrarrSÚosÚurandomÚ add_bytesrg)rÿZ byte_countrjrererfÚ send_ignoreKs  zTransport.send_ignorecCsRt ¡|_| ¡|j d¡|js@| ¡}|dk r8|‚tdƒ‚|j ¡rqNqdS)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žNr-) r¼rêrôÚ_send_kex_initr0r®r1r[r2©rÿrrererfÚrenegotiate_keys]s   zTransport.renegotiate_keyscCs$t |¡fdd„}|j ||¡dS)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). cSs|jdddS)Nzkeepalive@lag.netFrm)rr)r rererfÚ_requestƒsz)Transport.set_keepalive.._requestN)ÚweakrefÚproxyrÂÚ set_keepalive)rÿÚintervalrƒrererfr†ws zTransport.set_keepalivecCs’|rt ¡|_tƒ}| t¡| |¡| |¡|dk rD|j|Ž|  t d  |¡¡|  |¡|shdS|j  d¡|js~dS|j ¡rhqŒqh|jS)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ôrMrarrbÚ add_booleanÚaddÚ_logrr»rgr0r®r2ró)rÿrhÚdatar0rjrererfrrˆs$        zTransport.global_requestcCsh|j ¡zLt|jƒdkr(|j d¡}n,|j |¡t|jƒdkrP|j d¡}nd}W5|j ¡X|S)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±rûÚpoprýr0)rÿr4rHrererfÚaccept­s   zTransport.acceptr«c Csj|dk r| ¡g|_|j|| |p"|d| ¡|dk rÎ|sÎ| ¡} |  ¡| ¡ksd|  ¡| ¡kr¸| td¡| td | ¡t | ¡ƒ¡¡| td |  ¡t |  ¡ƒ¡¡t dƒ‚| td | ¡¡¡|dk sè|dk sè|sè|rf|r | td¡|  ||j |¡nZ|r*| td¡|  |¡n<|dk rN| td ¡| ||¡n| td ¡| ||¡dS) 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Ór*r+zBad 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...)r8Ú_preferred_keysr,r5rJÚasbytesrŠrr»Úreprr[Úauth_gssapi_with_micrÓÚauth_gssapi_keyexÚauth_publickeyÚ auth_password) rÿZhostkeyÚusernameÚpasswordÚpkeyrÓZgss_authrrZ gss_trust_dnsr9rererfr¢Æsl< ý ÿþ  ÿþ ÿþ ÿÿÿ      zTransport.connectcCs0|j ¡z|j}d|_|W¢S|j ¡XdS)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érrererfr1<s zTransport.get_exceptioncOs0z|j ¡|||f|j|<W5|j ¡XdS)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]r\rþ)rÿÚnameruZlargÚkwargrererfÚset_subsystem_handlerPs zTransport.set_subsystem_handlercCs|jo|jdk o|j ¡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òr"rrererfr"ds ÿýzTransport.is_authenticatedcCs|jr|jdkrdS|j ¡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_usernamerrererfrœsszTransport.get_usernamecCs|jr|jdkrdS|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òZbannerrrererfÚ get_banners zTransport.get_bannercCs@|jr |jstdƒ‚t ¡}t|ƒ|_|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 rI) r®rÙr[r¼rêr ròÚ auth_noneÚwait_for_response©rÿr•Úmy_eventrererfržŒs   zTransport.auth_nonec sÒ|jr |jstdƒ‚|dkr&t ¡}n|}t|ƒ|_|j |ˆ|¡|dk rPgSz|j |¡WSt k rÌ}zP|r~d|j kr€‚z"‡fdd„}|  ||¡WWY¢Stk rº|‚YnXW5d}~XYnXdS)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 rINzkeyboard-interactivecs*t|ƒdkrtdƒ‚t|ƒdkr$gSˆgS)Nr zFallback authentication failed.r)r±r[)ÚtitleÚ instructionsÚfields©r–rerfruís   z(Transport.auth_password..handler) r®rÙr[r¼rêr ròr”rŸr\Z allowed_typesÚauth_interactive)rÿr•r–r3Úfallbackr¡rrurer¥rfr”¨s&/    zTransport.auth_passwordcCs\|jr |jstdƒ‚|dkr&t ¡}n|}t|ƒ|_|j |||¡|dk rPgS|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 rIN) r®rÙr[r¼rêr ròr“rŸ)rÿr•r9r3r¡rererfr“ýs#   zTransport.auth_publickeycCsD|jr |jstdƒ‚t ¡}t|ƒ|_|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 rI) r®rÙr[r¼rêr ròr¦rŸ)rÿr•ruÚ submethodsr¡rererfr¦.s+  ÿzTransport.auth_interactivecCs|s dd„}| |||¡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. cSsRg}|rt| ¡ƒ|r$t| ¡ƒ|D]$\}}t| ¡dd| tƒ¡q(|S)Nú )Úend)ÚprintÚstripÚappendrU)r¢r£Z prompt_listZanswersÚpromptZ show_inputrererfrums   z0Transport.auth_interactive_dumb..handler)r¦)rÿr•rur¨rererfÚauth_interactive_dumbcs zTransport.auth_interactive_dumbcCsD|jr |jstdƒ‚t ¡}t|ƒ|_|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 rI) r®rÙr[r¼rêr ròr‘rŸ)rÿr•rÓrr¡rererfr‘zs  ÿzTransport.auth_gssapi_with_miccCs@|jr |jstdƒ‚t ¡}t|ƒ|_|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 rI) r®rÙr[r¼rêr ròr’rŸr rererfr’”s   zTransport.auth_gssapi_keyexcCs$||_t |¡|_|j |j¡dS)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ñ©rÿr™rererfÚset_log_channel«s  zTransport.set_log_channelcCs|jS)z• Return the channel name used for this transport's logging. :return: channel name as a `str` .. versionadded:: 1.2 )rîrrererfÚget_log_channelºszTransport.get_log_channelcCs|j |¡dS)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ÿZhexdumprererfr³Äs zTransport.set_hexdumpcCs |j ¡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_hexdumprrererfr´Ðs zTransport.get_hexdumpcCs|r d|_nd|_dS)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›rN)Ú_preferred_compression)rÿÚcompressrererfÚuse_compressionÛs zTransport.use_compressioncCs t|jddƒ}|dkrdS|ƒ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)rr¦)rÿZgprererfr¸ìs zTransport.getpeernamecCsjd|_|j ¡tr6| ¡rf|t ¡k rf| d¡qn0| ¡rf|t ¡k rf|jj sf|jj sf| d¡q6dS)NFr{rž) r®rÂr%rVÚis_aliver¼Úcurrent_threadÚjoinr¦Ú_closedÚclosedrrererfrdýs  ÿ þýüzTransport.stop_threadcGs@tt|ƒtƒr(|D]}|j ||¡qn|jj||f|žŽdSrb)Ú issubclassr³rErðÚlog)rÿÚlevelÚmsgÚargsrjrererfrŠszTransport._logcCs|jS)z0used by KexGex to find primes for group exchange)r=rrererfÚ_get_modulus_packszTransport._get_modulus_packcCsB|j}|j |¡dk r.|jdd@|_|j}q|jdd@|_|S)zyou are holding the lockNr iÿÿÿ)rãràr ©rÿrirererfr`!s zTransport._next_channelcCs|j |¡dS)z?used by a Channel to remove itself from the active channel listN)ràÚdeleterÅrererfÚ_unlink_channel*szTransport._unlink_channelcCs|j |¡dSrb)rÂÚ send_message)rÿr‹rererfÚ _send_message.szTransport._send_messagecCs†t ¡}|j d¡|js*| td¡dS|j ¡|j ¡r@qf|j  ¡t ¡||j krt dƒ‚qz|  |¡W5|j  ¡XdS)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) r/rër0r®rŠrrìr\r2r]rír[rÉ)rÿr‹r.rererfrg1s& ÿ   ÿzTransport._send_user_messagecCs ||_||_|jdkr||_dS)zR Used by a kex obj to set the K (root key) and H (exchange hash). N)rØr×rÏ)rÿÚkÚhrererfÚ_set_K_HKs zTransport._set_K_HcGst|ƒ|_dS)zW Used by a kex obj to register the next packet type it expects to see. N)r´rÜ)rÿZptypesrererfÚ_expect_packetTszTransport._expect_packetcCsP|j|jt|ƒƒ}|dkr$tdƒ‚| |jt|ƒ¡sFtd |j¡ƒ‚||_dS)NzUnknown host key typez#Signature verification ({}) failed.)Ú _key_inforÐrMr[Zverify_ssh_sigr×r»rÑ)rÿrÑÚsigr9rererfÚ _verify_keyZsÿÿzTransport._verify_keyc Cstƒ}| |j¡| |j¡| t|ƒ¡| |j¡t|j ddƒ}d  |j j j |¡}|dkrlt }|d7}t|dƒsŽ| t|¡t|ddƒ|| ¡ƒ ¡}}t|ƒ|krøtƒ}| |j¡| |j¡| |¡|| ¡ƒ ¡}||7}||7}q¢|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 sha1Z_logged_hash_selectionT)rMZ add_mpintrØr~r×rarTrÏrrÖr»Ú __class__Ú__name__rÚhasattrrŠrÚsetattrrÚdigestr±) rÿr ÚnbytesrjrÑZhash_select_msgr#ZsofarrÖrererfÚ _compute_keyfs4   ÿ        zTransport._compute_keycCsb||jkrtd|ƒ‚nFt|j|d|ƒ|j|d|ƒtƒd}||jkrV| ¡S| ¡SdS)NzUnknown client cipher rr‘)Úbackend)r!r[r rÚ_ENCRYPTZ encryptorZ decryptor)rÿr™r9ZivZ operationÚcipherrererfÚ _get_cipher„s ý zTransport._get_ciphercs&|dkr‡fdd„}|ˆ_n|ˆ_dS)Ncsˆ |¡dSrbrn)rprrerfrq•sz=Transport._set_forward_agent_handler..default_handler)ræ©rÿrurqrerrfÚ_set_forward_agent_handler’s z$Transport._set_forward_agent_handlercs&|dkr‡fdd„}|ˆ_n|ˆ_dS)Ncsˆ |¡dSrbrn)rpZ src_addr_portrrerfrq sz3Transport._set_x11_handler..default_handler)rçrÝrerrfÚ_set_x11_handlerœs zTransport._set_x11_handlercCs6|j ¡z|j |¡|j ¡W5|j ¡XdSrb)rÞr\r]rûr­rýÚnotify)rÿrprererfro§s   z!Transport._queue_incoming_channelcCs|dkr|j}tt|tƒSrb)rårar4r6)rÿrMrererfr^¯szTransport._sanitize_window_sizecCs|dkr|j}tt|tƒSrb)rärar5r6)rÿrNrererfr_´szTransport._sanitize_packet_sizecCs‚|jr|tks| ¡rdStƒ}|tkr4| t¡nJ|tkr~| ¡}|  ¡}| t ¡|  |¡|  t ¡|  d¡|  d¡|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)rør9r"rMr&rar r+Úget_textrsr$rcr"rb)rÿÚptypeÚmessageZreplyrhrirererfÚ_ensure_authed¹s& ÿþý      zTransport._ensure_authedc Cst|_t |¡ttt|ƒƒt@ƒ}|jr>| t d  |¡¡n| t d  |¡¡z¤z|j   t |jdƒ¡| t d  |j¡¡| ¡|j  |j¡| ¡| t¡|jrâ|j  ¡rÊ|jsÊ| ¡z|j  ¡\}}Wntk rôYqªYnX|tkrqªn0|tkr| |¡qân|tkr4| |¡qªt|j ƒdkrŽ||j krbt!d  |j |¡ƒ‚t"ƒ|_ |dkrŽ|dkrŽ|j# $||¡qª||j%krÌ| &||¡}|r¸| '|¡n|j%|||ƒn ||j(kr@| )¡}|j* +|¡}|dk r|j(|||ƒn6||j,kr(| t d   |¡¡n| t-d   |¡¡qân–|j.dk r†||j.j%kr†|j.j%|}||j.|ƒt|j ƒdkrÖqªnPt/|}d   ||¡} | t0| ¡|t1krÖt2ƒ} |  3t4¡|  5|j6¡| '| ¡|j  7¡qªWnVt!k r6} z.| t-d t8| ƒ¡| t-t9 :¡¡| |_;W5d} ~ XYntk rð} zft?| j@ƒt"krÄ| j@r°d  | j@d| j@d¡} nt8| ƒpÀtA| ƒ} n| j@} | t-d| ¡| |_;W5d} ~ XYnNtBk r<} z.| t-dt8| ƒ¡| t-t9 :¡¡| |_;W5d} ~ XYnXt C|¡tD|j* E¡ƒD]}| F¡qV|jrêd|_|j  G¡|jHdk r”|jH I¡|j.dk rª|j. J¡|jK E¡D]} |  I¡q´z|jL N¡|jO P¡W5|jL M¡X|jQ G¡Wn|jjRdk r‚YnXdS)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})z Exception: zEOF in transport threadz {} ({:d})r zSocket exception: zUnknown exception: F)SÚsysrcr­rrRr rrørŠrr»rÂZ write_allrTrÅÚ _check_bannerZstart_handshakerör€rÍrr®Ú need_rekeyrÚZ read_messagerOrrÚ_parse_disconnectrÚ _parse_debugr±rÜr[r´rÖZ parse_nextÚ_handler_tablerårÉÚ_channel_handler_tablersràr rârròr;rr:rMrarrcZseqnoZcomplete_handshakerºr Z tb_stringsréÚEOFErrorrµr¹r³rÃrÚ ExceptionÚremoverErFrGr%rôÚsetÚabortrárÞr]r\rýràr¦Úmodules)rÿÚtidrãrjÚ error_msgrirHrur™ÚwarningrÂrÚemsgr3rererfÚrunßsþ  þ        ÿÿ       ÿþÿþÿ þ  ÿ                z Transport.runcCs<d |¡}||kr||7}n|d ||¡7}| t|¡dS)Nz {} agreed: zlocal={}, remote={})r»rŠr)rÿÚwhichÚlocalÚremoterÂrererfÚ_log_agreements   zTransport._log_agreementcCsP|j ¡z|j ¡W5|j ¡X|jdkr8| ¡| |¡|j  ¡dSrb) rìr\r]rëÚclearrÉr€Ú_parse_kex_initrÖZ start_kex©rÿrjrererfÚ_negotiate_keysŒs    zTransport._negotiate_keysc CshtdƒD]”}|dkr|j}nd}z|j |¡}WnFtk rF‚Yn2tk rv}ztdt|ƒƒ‚W5d}~XYnX|dd…dkrŒqž| t d|¡q|dd…dkr¾td|d ƒ‚||_ | t d   |¡¡|  d ¡}|dkrô|d|…}|  d d¡}t|ƒd krtdƒ‚|d}|d}|dkrL|dkrLd}t|  |¡ƒ‚d  ||¡}| t|¡dS)Nédréz!Error reading SSH protocol bannerér©zBanner: z!Indecipherable protocol version "ú"zRemote version/idstring: {}r©rªézInvalid SSH bannerr z1.99riz(Incompatible version ({} instead of 2.0)z!Connected (version {}, client {}))ÚrangerõrÂÚreadliner^rïr[rºrŠrrÆr»Úfindr°r±r) rÿÚir4ÚbufrZsegsÚversionÚclientrÂrererfrè™s@  ÿ    zTransport._check_bannercsn|j ¡z|j ¡W5|j ¡Xd|_d|_|jr¦d‰‡fdd„|jDƒ}|j dkrˆt |ƒdkrˆ‡fdd„|  ¡j Dƒ}||  ¡_ t tt |j ¡ƒj|jƒƒ}n|j}tƒ}| t¡| t d ¡¡| |j¡| |¡| |j¡| |j¡| |j¡| |j¡| |j¡| |j¡| tƒ¡| tƒ¡| d¡|  d¡| !¡|_"| #|¡dS) 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-shacsg|]}| ˆ¡r|‘qSre©Ú startswith©r rÊ©Zmp_required_prefixrerfÚ Òs þz,Transport._send_kex_init..Nrcsg|]}| ˆ¡s|‘qSrer rrrerfrÚs þr)$rìr\r]rërýrÒrÚrørr=r±r(rrEÚfilterrúrÚ __contains__rrMrarr~r|r}Zadd_listrrrrbÚbytesrˆrcrrÉrÉ)rÿZkex_mpZpkexÚavailable_server_keysrjrerrfr€ÄsP   þ þ þÿ              zTransport._send_kex_initcCs| d¡| ¡}| ¡}| ¡}| ¡}| ¡}| ¡}| ¡}| ¡} | ¡} | ¡} | ¡} | ¡| tdt|ƒdt|ƒdt|ƒdt|ƒdt|ƒdt|ƒdt|ƒd t| ƒd t| ƒd t| ƒd t| ƒ¡|jrtt |j j |ƒƒ} ntt |j |j ƒƒ} t | ƒd kr:t dƒ‚|j| d |ƒ|_| td | d ¡¡|jrštt t|j ¡ƒj |jƒƒ}tt |j |ƒƒ}ntt |j |jƒƒ}t |ƒd krÂt dƒ‚|d |_|jrê| ¡dkrêt dƒ‚| d|d |d ¡|jr.tt |jj |ƒƒ}tt |jj |ƒƒ}n$tt |j |jƒƒ}tt |j |jƒƒ}t |ƒd ksnt |ƒd krvt dƒ‚|d |_|d |_|jd|j|jd|jrÌtt |jj |ƒƒ}tt |jj |ƒƒ}n$tt |j |jƒƒ}tt |j |jƒƒ}t |ƒd ks t |ƒd krt dƒ‚|d |_|d |_|jd|j|jd|jrjtt |jj |ƒƒ}tt |jj | ƒƒ}n$tt |j |jƒƒ}tt | j |jƒƒ}t |ƒd ksªt |ƒd krÊd}|d7}t | |||j¡ƒ‚|d |_|d |_|jd|j|jdt | !¡|_"dS)Nrz kex algos:z server key:z client encrypt:z server encrypt:z client mac:z server mac:z client compress:z server compress:z client lang:z server lang:z kex follows?rz3Incompatible ssh peer (no acceptable kex algorithm)zKex agreed: {}z.Incompatible ssh peer (no acceptable host key)z;Incompatible ssh peer (can't match requested host key type)ZHostKeyz/Incompatible ssh server (no acceptable ciphers)r )rúrûz,Incompatible ssh server (no acceptable macs)ZMACz3Incompatible ssh server (no acceptable compression)z {!r} {!r} {!r}Z Compression)#Ú get_bytesZget_listÚ get_booleanrsrŠrrºrørErrrr±r[Ú _kex_inforÖr»rúrrrÐr<rürrÇrÈrrËrÌrrÍrÎrZ get_so_farrÊ)rÿrjZ kex_algo_listZserver_key_algo_listZclient_encrypt_algo_listZserver_encrypt_algo_listZclient_mac_algo_listZserver_mac_algo_listZclient_compress_algo_listZserver_compress_algo_listZclient_lang_listZserver_lang_listZ kex_followsZ agreed_kexrZ agreed_keysZagreed_local_ciphersZagreed_remote_ciphersZagreed_remote_macsZagreed_local_macsZagreed_remote_compressionZagreed_local_compressionrÂrererfrþüs” ÿþýüûúùø ÷ ö õ ô óòñðïîíìëþ ÿ ÿÿþÿÿÿ ÿÿ ÿþÿþÿþÿþÿÿ  ÿ ÿ ÿ ÿ ÿ  ÿþÿþÿþÿþÿ ÿ þýÿ  ý zTransport._parse_kex_initc Cs*|j|jd}|jr<| d|¡}| d|j|jd¡}n$| d|¡}| d|j|jd¡}| |j|||j¡}d|jk}|j|jd}|j|jd }|jr¶| d |ƒj¡}n| d |ƒj¡}|j j ||||||d |j |j d } | dk r&|j dks |j r&| td¡|j  | ƒ¡dS)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 ...)r!rÈrørØrÜÚ_DECRYPTrÌÚ _mac_infoÚ digest_sizerÂZset_inbound_cipherÚ_compression_inforÎrÛrŠrÚset_inbound_compressor) rÿÚ block_sizeZIV_inZkey_inÚenginer!Úmac_sizeÚ mac_engineÚmac_keyÚ compress_inrererfÚ_activate_inboundà sP ÿ ÿÿ ÿ ÿÿ zTransport._activate_inboundc Csntƒ}| t¡| |¡|j|jd}|jrV| d|¡}| d|j|jd¡}n$| d|¡}| d|j|jd¡}| |j|||j ¡}d|j k}|j |j d}|j |j d }|jrÐ| d |ƒj ¡} n| d |ƒj ¡} |j  d ¡} |jj||||| | |d |j|jd} | dk rN|jdks4|jrN| td¡|j | ƒ¡|j ¡s`d|_| t¡dS)zNswitch on newly negotiated encryption parameters for outbound trafficr’rrr“rrrr˜rrrz-ctrr rNrœú%Switching on outbound compression ...F)rMrarrÉr!rÇrørØrÜrÚrËr$r%ÚendswithrÂZset_outbound_cipherr&rÍrÛrŠrÚset_outbound_compressorrérÚrÍr) rÿrjr(ZIV_outZkey_outr)r!r*r+r,ZsdctrÚ compress_outrererfÚ_activate_outboundç s`   ÿ ÿÿ  ÿ ÿÿ  zTransport._activate_outboundcCsrd|_|jdkr:|j|jd}| td¡|j |ƒ¡|jdkrn|j|jd}| td¡|j |ƒ¡dS)NTrœrr/r r") rÛrÍr&rŠrrÂr1rÎr')rÿr2r-rererfÚ _auth_trigger s    zTransport._auth_triggercCs | td¡| ¡d|_|_d|_d|_|jrF|jdkrFt |ƒ|_|j sRd|_ |j dk rf|j   ¡|j  ¡svd|_|j ¡z|j  ¡W5|j ¡XdS)NzSwitch to new keys ...TF)rŠrr.rÉrÊrØrÖrøròr rÙrôrñrÂrérÚrìr\r]rërÿrererfÚ_parse_newkeys s$        zTransport._parse_newkeyscCs(| ¡}| ¡}| td ||¡¡dS)NzDisconnect (code {:d}): {})rsrârŠrr»)rÿrjÚcodeÚdescrererfrê9 szTransport._parse_disconnectc Cs| ¡}| td |¡¡| ¡}|js@| td |¡¡d}nl|dkrr| ¡}| ¡}|j ||¡}|r¬|f}n:|dkrž| ¡}| ¡}|j  ||¡d}n|j  ||¡}d}t |ƒt krÄ|}d}|rüt ƒ}|rè| t¡|j|Žn | t¡| |¡dS)NzReceived global request "{}"z*Rejecting "{}" global request from server.FrlrxTre)rârŠrr»rrørsrùZcheck_port_forward_requestZcancel_port_forward_requestZcheck_global_requestr³r´rMrarr‰r rÉ) rÿrjrhZ want_replyÚokrtr¥ÚextrarÂrererfÚ_parse_global_request> s@þ    zTransport._parse_global_requestcCs*| td¡||_|jdk r&|j ¡dS)NzGlobal request successful.©rŠrrórôrñrÿrererfÚ_parse_request_successb s  z Transport._parse_request_successcCs*| td¡d|_|jdk r&|j ¡dS)NzGlobal request denied.r;rÿrererfÚ_parse_request_failureh s  z Transport._parse_request_failurecCs¤| ¡}| ¡}| ¡}| ¡}|j |¡}|dkrD| td¡dS|j ¡zD| |||¡| t d  |¡¡||j kr|j |  ¡|j |=W5|j ¡XdS)Nz%Success for unrequested channel! [??]zSecsh channel {:d} opened.) rsràr rŠrrÞr\r]Ú_set_remote_channelrr»rárñ)rÿrjriZ server_chanidZserver_window_sizeZserver_max_packet_sizerHrererfÚ_parse_channel_open_successn s*   ÿ   z%Transport._parse_channel_open_successcCs¤| ¡}| ¡}| ¡}| ¡t |d¡}| td |||¡¡|j ¡zFt ||ƒ|_ ||j kr|j  |¡||j kr|j | ¡|j |=W5|j  ¡XdS)Nz(unknown code)z&Secsh channel {:d} open FAILED: {}: {})rsrâr!r rŠrr»rÞr\r]r]réráràrÆrñ)rÿrjrirZ reason_strZ reason_textrererfÚ_parse_channel_open_failure„ s. ÿþ       z%Transport._parse_channel_open_failurecCsh| ¡}| ¡}| ¡}| ¡}d}|dkrj|jdk rj| td¡|j ¡z | ¡}W5|j ¡Xnˆ|dkrÈ|j dk rÈ| ¡}| ¡} | td  || ¡¡|j ¡z | ¡}W5|j ¡Xn*|dkr8|j dk r8| ¡} | ¡} | ¡}| ¡} | td  || ¡¡|j ¡z | ¡}W5|j ¡Xnº|j s\| td  |¡¡d }t } n–|j ¡z | ¡}W5|j ¡X|d krÄ| ¡} | ¡}| ¡}| ¡} |j ||| f| |f¡} n|j ||¡} | tkrò| td   |¡¡d }|r>tƒ}| t¡| |¡| | ¡| d ¡| d ¡| |¡dSt|ƒ}|j ¡zD|j ||¡d |j|<| |¡| |j|j¡|  |||¡W5|j ¡Xtƒ}| t!¡| |¡| |¡| |j¡| |j¡| |¡| td  ||¡¡|dkr| |¡nR|dkr.|  ||| f¡n6|dkrZ|| f|_"|  ||| f| | f¡n | #|¡dS)NFrUz!Incoming forward agent connectionrRz$Incoming x11 connection from {}:{:d}rWz.Incoming tcp forwarded connection from {}:{:d}z+Rejecting "{}" channel request from server.Tr[z+Rejecting "{}" channel request from client.r«rázSecsh channel {:d} ({}) opened.)$rârsrærŠrrÞr\r]r`rçr»rèrør"rùZ"check_channel_direct_tcpip_requestZcheck_channel_requestr#rMrar$rcrbrÉrràrdrârerfrårär>r%Ú origin_addrro)rÿrjrhriZinitial_window_sizerNÚrejectZ my_chanidrAÚ origin_portZ server_addrZ server_portrrXZ dest_portrÂrHrererfÚ_parse_channel_openœ söÿþ   ÿþ  ÿþ  þ    ýÿ þ         ÿÿ        ÿ     ÿzTransport._parse_channel_opencCs4| ¡| ¡}| ¡| td t |¡¡¡dS)Nz Debug msg: {})rZ get_stringrŠrr»r Z safe_string)rÿrjrÂrererfrë szTransport._parse_debugcCsBz0|j ¡||jkr$dgifW¢S|j|W¢S|j ¡XdSrbr˜r°rererfÚ_get_subsystem_handler s   z Transport._get_subsystem_handler)TT)NN)NN)N)NNN)N)NNNNN)N)N)NT)N) Nr«NNNFFTT)NT)N)r«)Nr«)T)¯rÓÚ __module__Ú __qualname__Ú__doc__ÚobjectrÚr#rÃr»ÚparamikoÚ __version__rÄÚ_preferred_ciphersÚ_preferred_macsrŽrÕr@Z is_availablerÔrµrZAESr ZCTRZBlowfishZCBCZ TripleDESr!rrrrr$rWr>rXr?rÎrCrDrArBrErFrKrLrJrGrHrIrr<r=r&r=rÁr7r8r¾rÚpropertyrrrrrr$r&r(r,r5r7r:r<Ú staticmethodrDr%rJrKrQrTrVrYrPrwryrzrr‚r†rrrr¢r1r›r"rœrržr”r“r¦r¯r‘r’r±r²r³r´r·r¸rdrŠrÄr`rÇrÉrgrÌrÍrÐrØrÜrÞrßror^r_rårørürrèr€rþr.r3r4r5rêr:r<r=r?r@rDrërErr&r'r(r)r*r+rrìr,rZ_request_successr-Z_request_failedr.Z_feedr/Z_feed_extendedr0Z_window_adjustr1Z_handle_requestr2Z _handle_eofr3Z _handle_closerírerererfrhsô     üüüüüüüüÕ4ø ôô ú ù D       " : B (  ÿ # ù _ 6  % ö v   U 1 5         &!  +8H$, $~ ø ørhc@s®eZdZdZdZdd„Zdd„Zdd„Zed d „ƒZ e j d d „ƒZ ed d „ƒZ e j dd „ƒZ edd„ƒZ e j dd„ƒZ edd„ƒZ e j dd„ƒZ edd„ƒZej dd„ƒZdS)r'a: 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. Ú _transportcCs ||_dSrb)rP)rÿÚ transportrererfr¾O szSecurityOptions.__init__cCs d |j¡S)rz#)r»rPrrererfr$R szSecurityOptions.__repr__cstt|ƒtkrt|ƒ}t|ƒtk r(tdƒ‚tt|j|ƒ ¡ƒ‰‡fdd„|Dƒ}t|ƒdkrbtdƒ‚t |j||ƒdS)Nzexpected tuple or listcsg|]}|ˆkr|‘qSrere)r Ún©Úpossiblererfr^ sz(SecurityOptions._set..rzunknown cipher) r³rEr´Ú TypeErrorrrPrr±Ú ValueErrorrÕ)rÿr™Úorigr Ú forbiddenrerSrfÚ_setX s   zSecurityOptions._setcCs|jjS)zSymmetric encryption ciphers)rPrLrrererfrc szSecurityOptions.cipherscCs| dd|¡dS)NrLr!©rY©rÿr rererfrh scCs|jjS)z Digest (one-way hash) algorithms)rPrMrrererfÚdigestsl szSecurityOptions.digestscCs| dd|¡dS)NrMr$rZr[rererfr\q scCs|jjS)zPublic-key algorithms)rPrŽrrererfÚ key_typesu szSecurityOptions.key_typescCs| dd|¡dS)NrŽrÎrZr[rererfr]z scCs|jjS)zKey exchange algorithms)rPrÕrrererfr~ szSecurityOptions.kexcCs| dd|¡dS)NrÕrrZr[rererfrƒ scCs|jjS)zCompression algorithms)rPrµrrererfr‡ szSecurityOptions.compressioncCs| dd|¡dS)Nrµr&rZr[rererfrŒ sN)rÓrFrGrHÚ __slots__r¾r$rYrNrÚsetterr\r]rrrerererfr'@ s2           r'c@s<eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd S)rßcCst ¡|_t ¡|_dSrb)r„ÚWeakValueDictionaryÚ_mapr¼rÝÚ_lockrrererfr¾’ s zChannelMap.__init__cCs*|j ¡z||j|<W5|j ¡XdSrb)rbr\r]ra)rÿrirHrererfrd— s zChannelMap.putcCs.|j ¡z|j |d¡W¢S|j ¡XdSrb)rbr\r]rar rÅrererfr ž s zChannelMap.getcCsB|j ¡z&z |j|=Wntk r,YnXW5|j ¡XdSrb)rbr\r]rar;rÅrererfrÆ¥ s   zChannelMap.deletecCs.|j ¡zt|j ¡ƒW¢S|j ¡XdSrb)rbr\r]rErarFrrererfrF¯ s zChannelMap.valuescCs*|j ¡zt|jƒW¢S|j ¡XdSrb)rbr\r]r±rarrererfÚ__len__¶ s zChannelMap.__len__N) rÓrFrGr¾rdr rÆrFrcrerererfrß‘ s  rß)rHÚ __future__rr|rµrçr¼r/r„ÚhashlibrrrrZcryptography.hazmat.backendsrZ&cryptography.hazmat.primitives.ciphersrr r rJr Zparamiko.auth_handlerr Zparamiko.ssh_gssr Zparamiko.channelrZparamiko.commonrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;Zparamiko.compressr<r=Zparamiko.dsskeyr>Zparamiko.ed25519keyr?Zparamiko.kex_curve25519r@Zparamiko.kex_gexrArBZparamiko.kex_group1rCZparamiko.kex_group14rDrEZparamiko.kex_group16rFZparamiko.kex_ecdh_nistrGrHrIZparamiko.kex_gssrJrKrLZparamiko.messagerMZparamiko.packetrNrOZparamiko.primesrPZparamiko.py3compatrQrRrSrTrUrVZparamiko.rsakeyrWZparamiko.ecdsakeyrXZparamiko.serverrYZparamiko.sftp_clientrZZparamiko.ssh_exceptionr[r\r]r^Z paramiko.utilr_r`rarcrgÚatexitÚregisterr½rhrIr'rßrerererfÚs€      ¼/             TQ