Z[c@sdZddlmZddlZddlZddlZddlZddlZddlZddl 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;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGdd lHmIZImJZJdd lKmLZLddlMmNZNmOZOddlPmQZQddlRmSZSddlTmUZUmVZVmWZWmXZXddlYmZZZddl[m\Z\m]Z]ddl^m_Z_ddl`maZambZbmcZcmdZdmeZemfZfddlgmhZhddlimjZjddlkmlZlddlmmnZnddlompZpmqZqmrZrmsZsddltmuZumvZvmwZwgZxdZyddlzZzezj{eydej|evfdYZ}de~fd YZd!e~fd"YZdS(#s Core protocol implementation i(tprint_functionN(tmd5tsha1tsha256tsha512(tdefault_backend(t algorithmstCiphertmodes(tutil(t AuthHandler(tGSSAuth(tChannel(+t xfffffffftcMSG_CHANNEL_OPENt cMSG_IGNOREtcMSG_GLOBAL_REQUESTtDEBUGt MSG_KEXINITt MSG_IGNOREtMSG_DISCONNECTt MSG_DEBUGtERRORtWARNINGtcMSG_UNIMPLEMENTEDtINFOt cMSG_KEXINITt cMSG_NEWKEYSt MSG_NEWKEYStcMSG_REQUEST_SUCCESStcMSG_REQUEST_FAILUREtCONNECTION_FAILED_CODEt'OPEN_FAILED_ADMINISTRATIVELY_PROHIBITEDtOPEN_SUCCEEDEDtcMSG_CHANNEL_OPEN_FAILUREtcMSG_CHANNEL_OPEN_SUCCESStMSG_GLOBAL_REQUESTtMSG_REQUEST_SUCCESStMSG_REQUEST_FAILUREtMSG_CHANNEL_OPEN_SUCCESStMSG_CHANNEL_OPEN_FAILUREtMSG_CHANNEL_OPENtMSG_CHANNEL_SUCCESStMSG_CHANNEL_FAILUREtMSG_CHANNEL_DATAtMSG_CHANNEL_EXTENDED_DATAtMSG_CHANNEL_WINDOW_ADJUSTtMSG_CHANNEL_REQUESTtMSG_CHANNEL_EOFtMSG_CHANNEL_CLOSEtMIN_WINDOW_SIZEtMIN_PACKET_SIZEtMAX_WINDOW_SIZEtDEFAULT_WINDOW_SIZEtDEFAULT_MAX_PACKET_SIZEtHIGHEST_USERAUTH_MESSAGE_ID(tZlibCompressortZlibDecompressor(tDSSKey(tKexGext KexGexSHA256(t KexGroup1(t KexGroup14(t KexGSSGext KexGSSGroup1t KexGSSGroup14t NullHostKey(tMessage(t PacketizertNeedRekeyException(t ModulusPack(t string_typestlongtbyte_ordtbtinputtPY2(tRSAKey(tECDSAKey(tServerInterface(t SFTPClient(t SSHExceptiontBadAuthenticationTypetChannelExceptiontProxyCommandFailure(tretry_on_signaltClosingContextManagert clamp_valuecCsxtD]}|jqWdS(N(t_active_threadst stop_thread(tthr((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_join_lingering_threadsMs t Transportc BseZdZeZeZdZdejZ dZ dZ de e jZdZdZi iejd6ejd6dd6dd6d6iejd6ejd6dd6dd6d6iejd6ejd6dd6d d6d6iejd6ejd6d!d6dd6d6iejd6ejd6dd6dd6d6iejd6ejd6dd6dd6d6iejd6ejd6dd6d d6d 6iejd6ejd6d!d6dd6d 6iejd6dd6d!d6dd6d 6iejd6dd6d!d6d d6d 6Ziied6d"d#6d6ied6d$d#6d6ied6d d#6d 6ied6d%d#6d6ied6dd#6d6ied6d$d#6d6Z ie!d6e"d6e d&6Z#ie$d6e%d6e&d6e'd6e(d'6e)d(6e*d)6Z+ie,e-fd*6e,e-fd+6dd6Z.dZ/d,Z0e1e2e3e4d-Z5d.Z6d/Z7d0Z8d1Z9ddd2Z:ddd3Z;d4Z<d5Z=e>dd6Z?d7Z@d8ZAd9ZBdddd:ZCdd;ZDd<ZEd=ZFdddddd>ZGdd?ZHd@ZIdAZJddBZKdCZLdDZMde4dEZNddFZOddGddde3e3e4dHZPdIZQdJZRdKZSdLZTdMZUdNZVde4dOZWddPZXdGdQZYddGdRZZdSZ[dTZ\dUZ]dVZ^dWZ_dXZ`e4dYZadZZbd[Zcd\Zdd]Zed^Zfd_Zgd`ZhdaZidbZjdcZkddZldeZmdfZndgZodhZpdiZqdjZrdkZsdlZtdmZudnZvdoZwdpZxdqZydrZzdsZ{dtZ|duZ}dvZ~dwZdxZdyZdzZd{Zd|Zd}Zd~ZdZie~e6ee6ee6ee6ee6ee6ee6ewe6Zieje6eje6eje6eje6eje6eje6eje6eje6ZRS(s 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. s2.0s paramiko_%ss aes128-ctrs aes192-ctrs aes256-ctrs aes128-cbcs blowfish-cbcs aes192-cbcs aes256-cbcs3des-cbct arcfour128t arcfour256s hmac-sha2-256s hmac-sha2-512shmac-md5s hmac-sha1-96s hmac-md5-96s hmac-sha1sssh-rsasssh-dsssdiffie-hellman-group1-sha1sdiffie-hellman-group14-sha1s"diffie-hellman-group-exchange-sha1s$diffie-hellman-group-exchange-sha256tnonetclasstmodeis block-sizeskey-sizeii iitsizei i@secdsa-sha2-nistp256s(gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==s)gss-group14-sha1-toWM5Slw5Ew8Mqkay+al2g==s%gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==szlib@openssh.comtzlibg?cst|_ttrljdd}t|dkrO|ddfql|dt|dfnttkrW\d}xt j t j t j D]\}} } } } | t j kr|} | }t j | t j yt fdWn"t jk r5}t|}q:XPqqWtd|fntjj||jt|_y|jj|jWntk rnXt|_d|jd |j|_d |_d |_ |_!d|_#|_$d|_%|_&d|_'|_(d|_)d|_*d|_+||_,t|_-d|_.d|_/|j,rt0d ||_.d|_1nd|_2d|_3d|_4t|_5t|_6t|_7t|_8tj9|_:t;|_<i|_=i|_>d|_?||_@||_Ad|_Bd|_Cd|_Dd|_EtjF|_Gtj9|_Hd|_Id|_JtKjL|jJ|_M|jjN|jMd|_Od|_Pd|_Qd|_Rd|_St|_Td|_Ui|_Vg|_WtjX|j:|_Yi|_ZdS(s- 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) .. versionchanged:: 1.15 Added the ``default_window_size`` and ``default_max_packet_size`` arguments. t:iiisNo suitable address familycsjfS(N(tconnect((thostnametporttsock(s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt1ssUnable to connect to %s: %ssSSH-t-ts gssapi-keyexs%gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==s)gss-group14-sha1-toWM5Slw5Ew8Mqkay+al2g==s(gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==s"diffie-hellman-group-exchange-sha1sdiffie-hellman-group14-sha1sdiffie-hellman-group1-sha1g>@sparamiko.transportiN(s%gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==s)gss-group14-sha1-toWM5Slw5Ew8Mqkay+al2g==s(gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==s"diffie-hellman-group-exchange-sha1sdiffie-hellman-group14-sha1sdiffie-hellman-group1-sha1([tFalsetactivet isinstanceRGtsplittlentintttypettupletsockett getaddrinfot AF_UNSPECt SOCK_STREAMRUterrortstrRQt threadingtThreadt__init__t setDaemontTrueRht settimeoutt_active_check_timeouttAttributeErrorRDt packetizert _PROTO_IDt _CLIENT_IDt local_versiontremote_versiont local_ciphert remote_ciphertNonetlocal_kex_inittremote_kex_initt local_mact remote_mactlocal_compressiontremote_compressiont session_idt host_key_typethost_keyt use_gss_kext gss_kex_usedt kexgss_ctxttgss_hostR t_preferred_kext kex_enginetHtKtinitial_kex_donetin_kext authenticatedt_expected_packettLocktlockt ChannelMapt _channelstchannel_eventst channels_seent_channel_countertdefault_max_packet_sizetdefault_window_sizet_forward_agent_handlert _x11_handlert _tcp_handlertsaved_exceptiontEventt clear_to_sendtclear_to_send_locktclear_to_send_timeouttlog_nameR t get_loggertloggertset_logt auth_handlertglobal_responsetcompletion_eventtbanner_timeoutthandshake_timeoutt server_modet server_objecttserver_key_dicttserver_acceptst Conditiontserver_accept_cvtsubsystem_table(tselfRhRRtgss_kextgss_deleg_credsthltreasontfamilytsocktypetprotot canonnametsockaddrtaftaddrte((RfRgRhs6/usr/lib/python2.7/site-packages/paramiko/transport.pyR|s2  4                                         cCsdttt|t@}|js6|d7}n|jdkrq|d|j|j|jddf7}n|jr|dt|j 7}n |j r|d7}n |d 7}|d 7}|S( sP Returns a string representation of this object, for debugging. s( thexRHtidR RmRt _cipher_infotis_authenticatedRpRR(Rtout((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt__repr__s          cCs|jj|jdS(s 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(Rhtclose(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytatforks cCs t|S(s  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. (tSecurityOptions(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytget_security_optionsscCstj||_dS(s Setter for C{gss_host} if GSS-API Key Exchange is performed. :param str gss_host: The targets name in the kerberos database Default: The name of the host to connect to :rtype: Void N(RttgetfqdnR(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt set_gss_hosts cCst|_|dk r,||_|jdStj|_}|j|dk retj|nd}x~tr|jd|js|j }|dk r|nt dn|j s|dk rntj|krnPqnqnWdS(sj 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) Ng?sNegotiation failed.( R~RmRRtstartRzRttimetwaitt get_exceptionRQtis_set(Rteventttimeouttmax_timeR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt start_clients""     "      *cCs|dkrt}nt|_||_t|_|dk rV||_|jdStj |_}|jx`tr|j d|js|j }|dk r|nt dn|j rvPqvqvWdS(s] 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 negotation 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) Ng?sNegotiation failed.(RROR~RRRmRRRzRRRRQR(RRtserverR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt start_servers()                cCs||j|jtk roq>Xq>Wdt_tS(s (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. s/etc/ssh/modulis/usr/local/etc/moduliiN( RFR\t _modulus_packRtinsertt read_fileR~tIOErrorRl(tfilenamet file_listtfn((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytload_server_moduli]s      cCsR|js dS|jx't|jjD]}|jq-W|jjdS(sP Close this session, and any open channels that are tied to it. N(RmRYtlistRtvaluest_unlinkRhR(Rtchan((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs   cCs*|j s|j r#tdn|jS(s 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 sNo existing session(RmRRQR(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytget_remote_server_keys cCs|jS(s Return true if this session is active (open). :return: True if the session is still active (open); False if the session is closed (Rm(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt is_activescCs|jdd|d|d|S(s 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. tsessiont window_sizetmax_packet_sizeR(t open_channel(RRRR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt open_sessions cCs|jdd|S(s 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 tx11tsrc_addr(R(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytopen_x11_channels cCs |jdS(s< 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 sauth-agent@openssh.com(R(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytopen_forward_agent_channels cCs|jd||S(sD 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 sforwarded-tcpip(R(RRt dest_addr((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytopen_forwarded_tcpip_channels c Cs|jstdn|dkr*dn|}|jjzh|j|}|j|}|j}t}|j t |j ||j ||j ||j ||dks|dkr|j |d|j |d|j |d|j |dn1|dkrD|j |d|j |dnt |} |jj|| tj|j|<} t|j|<| j|| j||Wd|jjX|j|tj} xtrV| jd |js|j} | dkrtd } n| n| jr.Pq| |tjkrtd qqW|jj|} | dk ry| S|j} | dkrtd } n| dS( sa 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. sSSH session not activeisforwarded-tcpips direct-tcpipiiRNg?sUnable to open channel.sTimeout openning channel.(RmRQRRtacquiret_sanitize_window_sizet_sanitize_packet_sizet _next_channelRCtadd_byteRt add_stringtadd_intR RtputRzRRR~Rt_set_transportt _set_windowtreleaset_send_user_messageRRRRtget( RtkindRRRRRtchanidtmRRtstart_tsR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRsb)                         csjstdnt|}jd||fdt}|dkr]tdn|dkrx|j}n|dkrfd}|}n|_|S(sm 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 sSSH session not actives tcpip-forwardRsTCP forwarding request deniedicsj|dS(N(t_queue_incoming_channel(tchannelRtdest_addr_port(R(s6/usr/lib/python2.7/site-packages/paramiko/transport.pytdefault_handlerssN(RmRQRqtglobal_requestR~Rtget_intR(RtaddressRgthandlertresponseR((Rs6/usr/lib/python2.7/site-packages/paramiko/transport.pytrequest_port_forwardNs       cCs6|js dSd|_|jd||fdtdS(s. 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 Nscancel-tcpip-forwardR(RmRRRR~(RRRg((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytcancel_port_forward{s  cCs tj|S(sE 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 (RPtfrom_transport(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytopen_sftp_clients cCsit}|jt|dkrBttjddd}n|jtj||j|dS(s 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. ii i N( RCRRRRItosturandomt add_bytesR(Rt byte_countR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt send_ignores    cCstj|_|jxftr|jjd|jsk|j}|dk r\|nt dn|jj rPqqWdS(s9 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) g?sNegotiation failed.N( RzRRt_send_kex_initR~RRmRRRQR(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytrenegotiate_keyss       cCs&|jj|tj|ddS(s 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|jddtS(Nskeepalive@lag.netR(RRl(tx((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRisN(Rt set_keepalivetweakreftproxy(Rtinterval((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR)s cCs|rtj|_nt}|jt|j||j||dk rd|j |n|j t d||j ||sdSx:t r|jjd|jsdS|jjrPqqW|jS(s 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. sSending global request "%s"g?N(RzRRRCRRRt add_booleanRtaddt_logRRR~RRmRR(RRtdataRR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs&        cCs|jjznt|jdkr:|jjd}n@|jj|t|jdkrt|jjd}nd}Wd|jjX|S(sW 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 iN( RRRpRtpopRRRR (RRR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytaccepts  Rkc Cs|d k r!|jg|_n|j|d k r| r|j} | j|jksz| j|jkr|jtd|jtd|jt|jf|jtd| jt| jft dn|jtd|jn|d k s2|d k s2|s2|r|r^|jtd|j |||q|r|jtd|j |q|d k r|jtd|j ||q|jtd|j ||nd S( s 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. :raises SSHException: if the SSH2 negotiation fails, the host key supplied by the server is incorrect, or authentication fails. sBad host key from serversExpected: %s: %ssGot : %s: %ssHost key verified (%s)s,Attempting GSS-API auth... (gssapi-with-mic)s)Attempting GSS-API auth... (gssapi-keyex)sAttempting public-key auth...sAttempting password auth...N(RRt_preferred_keysRRtasbytesR/RtreprRQtauth_gssapi_with_mictauth_gssapi_keyextauth_publickeyt auth_password( RthostkeytusernametpasswordtpkeyRtgss_authRRR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRe s0+   0,,$ cCs<|jjz|j}d|_|SWd|jjXdS(sy 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(RRRRR (RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRXs   cOs<z'|jj|||f|j|tj}n|}t||_|jj|||dk rygSy|jj |SWnlt k r}| sd|j krny#fd}|j ||SWqtk r|qXnXdS(sh 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 sNo existing sessionskeyboard-interactivecs>t|dkr!tdnt|dkr7gSgS(NisFallback authentication failed.i(RpRQ(ttitlet instructionstfields(R<(s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs N( RmRRQRRzRR RR9RGRRt allowed_typestauth_interactive(RR;R<RtfallbackRHRR((R<s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR9s&-    cCs|j s|j r#tdn|dkr>tj}n|}t||_|jj||||dk rygS|jj |S(s` 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 sNo existing sessionN( RmRRQRRzRR RR8RG(RR;RRRH((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR8 s!  cCsg|j s|j r#tdntj}t||_|jj|||||jj|S(s 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 sNo existing session( RmRRQRzRR RRMRG(RR;Rt submethodsRH((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRM<s + cCs%|sd}n|j|||S(s 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. cSsyg}|rt|jn|r8t|jnx:|D]2\}}t|jdd|jtq?W|S(Ntendt (tprinttstriptappendRK(RIRJt prompt_listtanswerstpromptt show_input((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRxs(RM(RR;RRO((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytauth_interactive_dumbos cCsg|j s|j r#tdntj}t||_|jj|||||jj|S(s 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) :rtype: list :raise BadAuthenticationType: if gssapi-with-mic isn't allowed by the server (and no event was passed in) :raise AuthenticationException: if the authentication failed (and no event was passed in) :raise SSHException: if there was a network error sNo existing session( RmRRQRzRR RR6RG(RR;RRRH((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR6s  cCsa|j s|j r#tdntj}t||_|jj|||jj|S(sJ 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 sNo existing session( RmRRQRzRR RR7RG(RR;RH((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR7s  cCs2||_tj||_|jj|jdS(sg 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(RR RRRR(RR?((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytset_log_channels cCs|jS(s Return the channel name used for this transport's logging. :return: channel name as a `str` .. versionadded:: 1.2 (R(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytget_log_channelscCs|jj|dS(sa 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(Rt set_hexdump(Rthexdump((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR\s cCs |jjS(s 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 (Rt get_hexdump(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR^s cCs|rd|_n d|_dS(s 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 szlib@openssh.comRcR_N(szlib@openssh.comszlibR_(R_(t_preferred_compression(Rtcompress((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytuse_compressions  cCs,t|jdd}|dkr%dS|S(s 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. t getpeernametunknowniN(sunknowni(tgetattrRhR(Rtgp((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRbs  cCst|_|jjtrQx~|jrM|tjk rM|jdqWnLxI|jr|tjk r|j j r|jj r|jdqTWdS(Ni g?( RlRmRRRLtis_aliveRztcurrent_threadtjoinRht_closedtclosed(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRYs  !cGsVtt|tr<x:|D]}|jj||qWn|jj|||dS(N(t issubclassRrRRtlog(RtleveltmsgtargsR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR/s cCs|jS(s0used by KexGex to find primes for group exchange(R(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_get_modulus_pack"scCs]|j}x9|jj|dk rD|jdd@|_|j}q W|jdd@|_|S(syou are holding the lockiiN(RRRR(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR&s   cCs|jj|dS(s?used by a Channel to remove itself from the active channel listN(Rtdelete(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_unlink_channel/scCs|jj|dS(N(Rt send_message(RR0((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt _send_message3scCstj}xtr|jjd|jsB|jtddS|jj|jj rbPn|jj tj||j krt dqqWz|j |Wd|jj XdS(s{ send a message, but block if we're in key negotiation. this is used for user-initiated requests. g?s0Dropping user packet because connection is dead.Ns2Key-exchange timed out waiting for key negotiation(RR~RRRmR/RRRRR RRQRt(RR0R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR6s     cCs1||_||_|jdkr-||_ndS(sBused by a kex object to set the K (root key) and H (exchange hash)N(RRRR(Rtkth((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_set_K_HLs  cGst||_dS(sGused by a kex object to register the next packet type it expects to seeN(RsR(Rtptypes((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_expect_packetSscCsu|j|jt|}|dkr7tdn|j|jt|shtd|jn||_dS(NsUnknown host key types#Signature verification (%s) failed.(t _key_infoRRCRRQtverify_ssh_sigRR(RRtsigR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt _verify_keyWs  c Csjt}|j|j|j|j|jt||j|jt|j dd}d|j j j |f}|dkrt }|d7}nt|ds|jt|t|dtn||jj}}xxt||krat}|j|j|j|j|j|||jj}||7}||7}qW|| S(s0id is 'A' - 'F' for the various keys used by ssht hash_algos$kex engine %s specified hash_algo %rs, falling back to sha1t_logged_hash_selectionN(RCt add_mpintRR#RRRJRRdRRt __class__t__name__RthasattrR/RtsetattrR~R4tdigestRp( RRtnbytesRR~thash_select_msgRtsofarR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt _compute_key_s.      cCs||jkr"td|n|d krt|j|d|ddt}||jkru|j}n |j}|jdd|St|j|d||j|d|dt}||jkr|jS|jSdS( NsUnknown client cipher R]R^R`tbackendRQiRa(R]R^( RRQRRRt_ENCRYPTt encryptort decryptortencrypt(RR?Rtivt operationtciphertengine((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt _get_cipher{s&     cs4|dkr'fd}|_n |_dS(Ncsj|dS(N(R(R(R(s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs(RR(RRR((Rs6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_set_forward_agent_handlers  cs4|dkr'fd}|_n |_dS(Ncsj|dS(N(R(Rt src_addr_port(R(s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs(RR(RRR((Rs6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_set_x11_handlers  cCsC|jjz!|jj||jjWd|jjXdS(N(RRRRTRtnotifyR (RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs  cCs(|dkr|j}ntt|tS(N(RRRWR2R4(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs  cCs(|dkr|j}ntt|tS(N(RRRWR3R4(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs  cCs|j s"|tks"|jr&dSt}|tkrK|jtnh|tkr|j }|j }|jt |j ||j t |jd|jdn|S(so 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. RktenN(RR7RRRCR$RRR)tget_textRR"R R R(RtptypetmessagetreplyRR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_ensure_autheds            c Cs*t|_tj||jrL|jtdttt|t @n*|jtdttt|t @yy9|j j t |j d|jtd|j |j|j j|j|j|jtx|jr|j jr|j r|jny|j j\}}Wntk rEqnX|tkrXqnR|tkr|j|t|_|j jPn|tkr|j|qnt |j!dkr*||j!krt"d|j!|fnt#|_!|dkr*|dkr*|j$j%||qq*n||j&krx|j'||}|ra|j(|q|j&|||n(||j)kr|j*}|j+j,|}|dk r|j)|||q||j.kr|jtd |q|jt/d |t|_|j jn|j0dk rY||j0j&krY|j0j&||j0|nG|jt1d |t2}|j3t4|j5|j6|j(||j j7qWWnWt"k r}|jt/d t8||jt/t9j:||_;n t<k r+}|jtd ||_;nt=j>k r}t?|j@t#kr|j@r|d|j@d|j@df}qt8|ptA|}n |j@}|jt/d|||_;nLtBk r }|jt/dt8||jt/t9j:||_;nXtjC|x'tD|j+jED]}|jFq/W|jrt|_|j j|jGdk r|jGjHn|j0dk r|j0jInx!|jJjED]} | jHqWz|jKjL|jMjNWd|jKjOXn|jPjWn|jjQdk r&q&nXdS(Ns!starting thread (server mode): %ss!starting thread (client mode): %ss sLocal version/idstring: %sis Expecting packet from %r, got %dii)s$Ignoring message for dead channel %ds&Channel request for unknown channel %dsOops, unhandled type %ds Exception: sEOF in transport threads%s (%d)isSocket exception: sUnknown exception: (RtsysRXRTRR/RRRHRR Rt write_allRJRt _check_bannertstart_handshakeRR&RyRRmt need_rekeyRt read_messageRERRt_parse_disconnectRlRRt _parse_debugRpRRQRsRt parse_nextt_handler_tableRRtt_channel_handler_tableRRRRRRRRRCRRR tseqnotcomplete_handshakeRyR t tb_stringsRtEOFErrorRtRxRrRoR5t ExceptiontremoveRRRRtsettabortRRRRRR Rhtmodules( RRRt error_msgRRRnRtemsgR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytruns   -*                  !      !        cCsRdj|}||kr(||7}n|dj||7}|jt|dS(Ns {0} agreed: slocal={0}, remote={1}(tformatR/R(RtwhichtlocaltremoteRn((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_log_agreementfs   cCsi|jjz|jjWd|jjX|jdkrK|jn|j||j j dS(N( RRRtclearR RRR&t_parse_kex_initRt start_kex(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_negotiate_keysss   c CsxtdD]}|dkr+|j}nd}y|jj|}Wn<tk r]n)tk r}tdt|nX|d dkrPn|jt d|q W|d dkrtd|d n||_ |jt d |d }|j d }|dkr2||d }|| }n|j dd}t |dkretdn|d }|d}|dkr|dkrtd|fn|jtd||fdS(Nidiis!Error reading SSH protocol bannerisSSH-sBanner: s!Indecipherable protocol version "t"sRemote version/idstring: %sRkRQiRjisInvalid SSH banners1.99s2.0s(Incompatible version (%s instead of 2.0)s!Connected (version %s, client %s)(trangeRRtreadlineRTRRQRyR/RRtfindRoRpR( RtiRtbufRtcommenttsegstversiontclient((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs<        cCs|jjz|jjWd|jjXt|_|jrd}g|jD]}|j |rQ|^qQ}|j dkrt |dkrg|j jD]}|j |s|^q}||j _nttt|jjj|j}n |j}t}|jt|jtjd|j|j|j||j|j|j|j|j|j|j|j|j|j|j|j|jt |jt |j!t"|j#d|j$|_%|j&|dS(s announce to the other side that we'd like to negotiate keys, and what kind of key negotiation we support. Ns!diffie-hellman-group-exchange-shaii('RRRRR R~RRRt startswithRRRpRtkexRtfilterRtkeyst __contains__R3RCRRR#R!R"tadd_listt_preferred_cipherst_preferred_macsR_RtbytesR-RlR R4RRt(Rtmp_required_prefixRutkex_mptpkextavailable_server_keysR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR&s@   +!      c Csn|jd}|j}|j}|j}|j}|j}|j}|j} |j} |j} |j} |j} |j}|jtdt|dt|dt|dt|dt|dt|dt| d t| d t| d t| d t| |jrltt |j j |}ntt |j |j }t |d krt dn|j|d ||_|jtd|d |jr(tt t|jjj |j}tt |j |}ntt |j |j}t |d krdt dn|d |_|jr|jdkrt dn|jrtt |jj |}tt |jj |}n6tt |j |j}tt |j |j}t |d ks7t |d krFt dn|d |_|d |_|jdd|jd|j|jrtt |jj |}tt |jj |}n6tt |j |j}tt |j |j}t |d kst |d kr*t dn|d |_|d |_|jdd|jd|j|jrtt |jj | }tt |jj | }n6tt | j |j}tt | j |j}t |d kst |d krt d|||jfn|d |_|d |_|jdd|jd|jt |j!|_"dS(Nis kex algos:s server key:s client encrypt:s server encrypt:s client mac:s server mac:s client compress:s server compress:s client lang:s server lang:s kex follows?is3Incompatible ssh peer (no acceptable kex algorithm)sKex agreed: %ss.Incompatible ssh peer (no acceptable host key)s;Incompatible ssh peer (can't match requested host key type)s/Incompatible ssh server (no acceptable ciphers)RRRs,Incompatible ssh server (no acceptable macs)tMACs<Incompatible ssh server (no acceptable compression) %r %r %rt Compression(#t get_bytestget_listt get_booleanRR/RRyRRRRRRpRQt _kex_infoRRRR3RRRRRRRRRRR_RRRt get_so_farR(RRtcookiet kex_algo_listtserver_key_algo_listtclient_encrypt_algo_listtserver_encrypt_algo_listtclient_mac_algo_listtserver_mac_algo_listtclient_compress_algo_listtserver_compress_algo_listtclient_lang_listtserver_lang_listt kex_followstunusedt agreed_kexRt agreed_keystagreed_local_cipherstagreed_remote_cipherstagreed_remote_macstagreed_local_macstagreed_remote_compressiontagreed_local_compression((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs                     $   $   $    c Cs|j|jd}|jrR|jd|}|jd|j|jd}n2|jd|}|jd|j|jd}|j|j|||j}|j|jd}|j|jd}|jr|jd |j}n|jd |j}|j j ||||||j |j d }|dk r|j d ksZ|jr|jtd |j j|ndS(sDswitch on newly negotiated encryption parameters for inbound traffics block-sizetAtCskey-sizetBtDRbR`tEtFiszlib@openssh.coms$Switching on inbound compression ...N(RRRRRt_DECRYPTt _mac_infoRt digest_sizeRtset_inbound_ciphert_compression_infoRRRR/Rtset_inbound_compressor( Rt block_sizetIV_intkey_inRtmac_sizet mac_enginetmac_keyt compress_in((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_activate_inboundBs" #  $c Cst}|jt|j||j|jd}|jru|jd|}|jd|j|jd}n2|jd|}|jd|j|jd}|j|j|||j }|j |j d}|j |j d}|jr|jd |j }n|jd |j }|jj d } |jj|||||| |j|jd } | dk r|jd ks|jr|jtd|jj| n|jjst|_n|jtdS(sEswitch on newly negotiated encryption parameters for outbound traffics block-sizeRRskey-sizeRRRbR`RRs-ctriszlib@openssh.coms%Switching on outbound compression ...N(RCRRRtRRRRRRRRRtendswithRtset_outbound_cipherRRRRR/Rtset_outbound_compressorRRlRRyR( RRRtIV_outtkey_outRRRRtsdctrt compress_out((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_activate_outboundZs0    #  $ cCst|_|jdkrR|j|jd}|jtd|jj|n|jdkr|j|jd}|jtd|jj |ndS(Nszlib@openssh.comis%Switching on outbound compression ...is$Switching on inbound compression ...( R~RRRR/RRRRR(RR R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt _auth_triggerzs cCs|jtd|jd|_|_d|_d|_|jrf|j dkrft ||_ n|j s{t |_ n|j dk r|j jn|jjst|_n|jjz|jjWd|jjXdS(NsSwitch to new keys ...(R/RRRRRRRRRR RR~RRRRRlRRRRR (RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_parse_newkeyss$       cCs6|j}|j}|jtd||fdS(NsDisconnect (code %d): %s(RRR/R(RRtcodetdesc((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRs  c Cso|j}|jtd||j}|jsR|jtd|t}n|dkr|j}|j}|jj||}|r|f}qnU|dkr|j}|j}|jj ||t }n|jj ||}d}t |t kr|}t }n|rkt}|rN|jt|j|n |jt|j|ndS(NsReceived global request "%s"s*Rejecting "%s" global request from server.s tcpip-forwardscancel-tcpip-forward((RR/RRRRlRRtcheck_port_forward_requesttcancel_port_forward_requestR~tcheck_global_requestRrRsRCRRR.RRt( RRRt want_replytokRRgtextraRn((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_parse_global_requests:               cCs<|jtd||_|jdk r8|jjndS(NsGlobal request successful.(R/RRRRR(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_parse_request_successs cCs<|jtdd|_|jdk r8|jjndS(NsGlobal request denied.(R/RRRRR(RR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_parse_request_failures cCs|j}|j}|j}|j}|jj|}|dkrb|jtddS|jjzX|j||||jt d|||j kr|j |j |j |=nWd|jj XdS(Ns%Success for unrequested channel! [??]sSecsh channel %d opened.( RRRRR/RRRt_set_remote_channelRRRR (RRRt server_chanidtserver_window_sizetserver_max_packet_sizeR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_parse_channel_open_successs"      cCs|j}|j}|j}|j}tj|d}|jtd|||f|jjzet|||_ ||j kr|j j |||j kr|j |j |j |=qnWd|jjXdS(Ns(unknown code)s$Secsh channel %d open FAILED: %s: %s(RRRRR/RRRRSRRRRqRR (RRRRt reason_strtlangt reason_text((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_parse_channel_open_failures      cCs|j}|j}|j}|j}t}|dkr|jdk r|jtd|jjz|j }Wd|jj Xn|dkr|j dk r|j}|j} |jtd|| f|jjz|j }Wd|jj Xn|dkr|j dk r|j} |j} |j}|j} |jtd|| f|jjz|j }Wd|jj Xn|j s|jtd|t}t} n|jjz|j }Wd|jj X|dkrc|j} |j}|j}|j} |jj||| f| |f} n|jj||} | tkr|jtd |t}n|rt}|jt|j||j| |jd |jd |j|dSt|}|jjzZ|jj||t|j|<|j||j|j |j!|j"|||Wd|jj Xt}|jt#|j||j||j|j |j|j!|j||jtd |||dkr|j|no|dkr:|j ||| fnJ|dkrw|| f|_$|j ||| f| | fn |j%|dS( Nsauth-agent@openssh.coms!Incoming forward agent connectionRs"Incoming x11 connection from %s:%dsforwarded-tcpips,Incoming tcp forwarded connection from %s:%ds+Rejecting "%s" channel request from server.s direct-tcpips+Rejecting "%s" channel request from client.RkRsSecsh channel %d (%s) opened.(&RRRlRRR/RRRRR RRRR~R Rt"check_channel_direct_tcpip_requesttcheck_channel_requestR!RCRR"R RRtR RR RR R RRRR#t origin_addrR(RRRRtinitial_window_sizeRtrejectt my_chanidR%t origin_portt server_addrt server_portRRt dest_portRnR((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_parse_channel_opens                                           "cCsJ|j}|j}|j}|jtdjtj|dS(NsDebug msg: {0}(Rt get_stringR/RRR t safe_string(RRtalways_displayRnR ((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRW s   cCsMz8|jj||jkr,dgifS|j|SWd|jjXdS(N(RRRRR (RR?((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_get_subsystem_handler] s   ( s aes128-ctrs aes192-ctrs aes256-ctrs aes128-cbcs blowfish-cbcs aes192-cbcs aes256-cbcs3des-cbcs arcfour128s arcfour256(s hmac-sha2-256s hmac-sha2-512shmac-md5s hmac-sha1-96s hmac-md5-96s hmac-sha1(sssh-rsasssh-dss(sdiffie-hellman-group1-sha1sdiffie-hellman-group14-sha1s"diffie-hellman-group-exchange-sha1s$diffie-hellman-group-exchange-sha256(snoneN(NN(Rt __module__t__doc__tobjectRRRtparamikot __version__RRRRsRNt supported_key_format_identifiersR3RR_RtAESRtCTRtBlowfishtCBCt TripleDEStARC4RRRRRRRRMR:RzR=R>R;R<R@RAR?RR8R9RRRR5R6RlR~R|RRRRRRRRt staticmethodRRRRRRRRRRRR R%R'R)RR2ReRRBRRCRERFR9R8RMRYR6R7RZR[R\R^RaRbRYR/RpRRrRtRRwRyR}RRRRRRRRRRRRR&RRR R RRRRRRR"R-RR1RR$R%R&R'R(R)RRR t_request_successR*t_request_failedR+t_feedR,t_feed_extendedR-t_window_adjustR.t_handle_requestR/t _handle_eofR0t _handle_closeR1R(((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR\Us                                      7A  (      V -    %  K   O / 3                     & ' + p    !     ^          RcBseZdZdZdZdZdZedZej dZedZ e j dZ ed Z e j d Z ed Z e j d Z ed Z e j dZ RS(s: 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. t _transportcCs ||_dS(N(RG(Rt transport((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR| scCsdt|jS(sP Returns a string representation of this object, for debugging. s!(R5RG(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR scCst|tkr!t|}nt|tk rBtdntt|j|j}g|D]}||krg|^qg}t|dkrtdnt |j||dS(Nsexpected tuple or listisunknown cipher( RrRRst TypeErrorRdRGRRpt ValueErrorR(RR?torigR(tpossibletnt forbidden((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt_set s%cCs |jjS(sSymmetric encryption ciphers(RGR(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytciphers scCs|jdd|dS(NRR(RO(RR(((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRP scCs |jjS(s Digest (one-way hash) algorithms(RGR(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytdigests scCs|jdd|dS(NRR(RO(RR(((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRQ scCs |jjS(sPublic-key algorithms(RGR3(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt key_types scCs|jdd|dS(NR3Rz(RO(RR(((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRR scCs |jjS(sKey exchange algorithms(RGR(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR scCs|jdd|dS(NRR(RO(RR(((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR scCs |jjS(sCompression algorithms(RGR_(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyt compression scCs|jdd|dS(NR_R(RO(RR(((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyRS s(RR2R3t __slots__R|RROtpropertyRPtsetterRQRRRRS(((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR} s    RcBs>eZdZdZdZdZdZdZRS(cCs"tj|_tj|_dS(N(R*tWeakValueDictionaryt_mapRzRt_lock(R((s6/usr/lib/python2.7/site-packages/paramiko/transport.pyR| scCs3|jjz||j|tparamiko.kex_gssR?R@RARBtparamiko.messageRCtparamiko.packetRDREtparamiko.primesRFtparamiko.py3compatRGRHRIRJRKRLtparamiko.rsakeyRMtparamiko.ecdsakeyRNtparamiko.serverROtparamiko.sftp_clientRPtparamiko.ssh_exceptionRQRRRSRTt paramiko.utilRURVRWRXR[tatexittregisterR{R\R4RR(((s6/usr/lib/python2.7/site-packages/paramiko/transport.pytsb      "  "."   1R