%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/
Upload File :
Create Path :
Current File : //proc/self/root/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyc

�
��Abc@s dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZmZmZmZmZddlmZmZddlmZmZddlmZd	�Zd
efd��YZd�Zd
efd��YZ dS(s
Packet handling
i����N(tHMAC(tutil(t
linefeed_bytet
cr_byte_valuetasbytest	MSG_NAMEStDEBUGt	xfffffffft	zero_byte(tutbyte_ord(tSSHExceptiontProxyCommandFailure(tMessagecCst|||�j�S(N(Rtdigest(tkeytmessagetdigest_class((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytcompute_hmac.stNeedRekeyExceptioncBseZdZRS(s1
    Exception indicating a rekey is needed.
    (t__name__t
__module__t__doc__(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyR2scCsDd}t|j�tkr@t|j�dkr@|jd}n|S(Ni(tNonettypetargsttupletlen(tetarg((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyt	first_arg:s*t
PacketizercBsXeZdZedd�Zedd�Zedd�Zedd�Zd�Ze	d��Z
d�Zeed�Z
ed�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%RS(s9
    Implementation of the base SSH packet protocol.
    iicCsf||_d|_t|_t|_t|_d|_t�|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_d|_d|_d|_t|_d|_d|_t�|_t�|_d|_d|_d|_d|_t|_t|_ t!j"�|_#d|_$t%j%�|_&d|_'d|_(t|_)t|_*dS(Nii(+t_Packetizer__socketRt_Packetizer__loggertFalset_Packetizer__closedt_Packetizer__dump_packetst_Packetizer__need_rekeyt_Packetizer__init_counttbytest_Packetizer__remaindert_Packetizer__sent_bytest_Packetizer__sent_packetst_Packetizer__received_bytest_Packetizer__received_packetst$_Packetizer__received_bytes_overflowt&_Packetizer__received_packets_overflowt_Packetizer__block_size_outt_Packetizer__block_size_int_Packetizer__mac_size_outt_Packetizer__mac_size_int_Packetizer__block_engine_outt_Packetizer__block_engine_int_Packetizer__sdctr_outt_Packetizer__mac_engine_outt_Packetizer__mac_engine_int_Packetizer__mac_key_outt_Packetizer__mac_key_int _Packetizer__compress_engine_outt_Packetizer__compress_engine_int _Packetizer__sequence_number_outt_Packetizer__sequence_number_int_Packetizer__etm_outt_Packetizer__etm_int	threadingtRLockt_Packetizer__write_lockt_Packetizer__keepalive_intervalttimet_Packetizer__keepalive_lastt_Packetizer__keepalive_callbackt_Packetizer__timert_Packetizer__handshake_completet_Packetizer__timer_expired(tselftsocket((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyt__init__QsJ																															cCs|jS(N(R#(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytclosed�scCs
||_dS(s?
        Set the Python log object to use for logging.
        N(R!(RJtlog((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytset_log�scCs�||_||_||_||_||_||_d|_d|_||_|j	dO_	|j	dkr�d|_	t
|_ndS(sd
        Switch outbound data cipher.
        :param etm: Set encrypt-then-mac from OpenSSH
        iiiN(R3R5R/R6R1R8R)R*R>R&R"R%(RJtblock_enginet
block_sizet
mac_enginetmac_sizetmac_keytsdctrtetm((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytset_outbound_cipher�s										cCs�||_||_||_||_||_d|_d|_d|_d|_||_	|j
dO_
|j
dkr�d|_
t|_ndS(sc
        Switch inbound data cipher.
        :param etm: Set encrypt-then-mac from OpenSSH
        iiiN(
R4R0R7R2R9R+R,R-R.R?R&R"R%(RJRPRQRRRSRTRV((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytset_inbound_cipher�s
											cCs
||_dS(N(R:(RJt
compressor((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytset_outbound_compressor�scCs
||_dS(N(R;(RJRY((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytset_inbound_compressor�scCst|_|jj�dS(N(tTrueR#R tclose(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyR]�s	cCs
||_dS(N(R$(RJthexdump((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytset_hexdump�scCs|jS(N(R$(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytget_hexdump�scCs|jS(N(R2(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytget_mac_size_in�scCs|jS(N(R1(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytget_mac_size_out�scCs|jS(s�
        Returns ``True`` if a new set of keys needs to be negotiated.  This
        will be triggered during a packet read or write, so it should be
        checked after every read or write, or at least after every few.
        (R%(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyt
need_rekey�scCs%||_||_tj�|_dS(s�
        Turn on/off the callback keepalive.  If ``interval`` seconds pass with
        no data read from or written to the socket, the callback will be
        executed and the timer will be reset.
        N(RCRFRDRE(RJtintervaltcallback((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyt
set_keepalive�s		cCs
t|_dS(N(R\RI(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyt
read_timer�scCs;|js7tjt|�|j�|_|jj�ndS(s�
        Tells `Packetizer` that the handshake process started.
        Starts a book keeping timer that can signal a timeout in the
        handshake process.

        :param float timeout: amount of seconds to wait before timing out
        N(RGR@tTimertfloatRgtstart(RJttimeout((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytstart_handshake�s	cCs!|js
tS|jrtS|jS(sR
        Checks if the handshake has timed out.

        If `start_handshake` wasn't called before the call to this function,
        the return value will always be `False`. If the handshake completed
        before a timeout was reached, the return value will be `False`

        :return: handshake time out status, as a `bool`
        (RGR"RHRI(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pythandshake_timed_out�s

		cCs/|jr+|jj�t|_t|_ndS(sF
        Tells `Packetizer` that the handshake has completed.
        N(RGtcancelR"RIR\RH(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytcomplete_handshakes	
	cCs�t�}t|j�dkrN|j| }|j||_|t|�8}nxQ|dkr�t}|j�r{t��nyN|jj|�}t|�dkr�t��n||7}|t|�8}Wn}tj	k
r�t
}ndtjk
rH}t|�}|t
jkrt
}qI|t
jkr-qI|jrBt��qI�nX|rQ|jrdt��n|r�t|�dkr�|jr�t��n|j�qQqQW|S(s&
        Read as close to N bytes as possible, blocking as long as necessary.

        :param int n: number of bytes to read
        :return: the data read, as a `str`

        :raises:
            ``EOFError`` -- if the socket was closed before all the bytes could
            be read
        i(R'RR(R"RmtEOFErrorR trecvRKRkR\terrorRterrnotEAGAINtEINTRR#R%Rt_check_keepalive(RJtntcheck_rekeytouttgot_timeouttxRR((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytread_allsB	

				!cCsotj�|_d}xSt|�dkrjt}y|jj|�}Wn�tjk
rbt}n�tj	k
r�}t
|�}|tjkr�t}q�|tj
kr�t}q�d}n*tk
r��ntk
r�d}nX|rd}|jr/d}q/n+|dkr%|dkr%d}n|d7}|dkrGt��n|t|�kr]Pn||}qWdS(Nii����i
i(RDRERR"R tsendRKRkR\RrRRsRtRuRt	ExceptionR#Rp(RJRyt#iteration_with_zero_as_return_valuetretry_writeRwRR((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyt	write_allJs@				


		
cCs�|j}x#t|kr.||j|�7}qW|jt�}||d|_|| }t|�dkr�|dtkr�|d }nt|�S(s�
        Read a line from the socket.  We assume no data is pending after the
        line, so it's okay to attempt large reads.
        iii����(R(Rt
_read_timeouttindexRRR	(RJRktbufRw((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytreadlineus	
"
cCsdt|�}t|d�}|tkr5t|}ndj|�}t|�}|jj�z�|jd	k	r�|j|�}n|j	|�}|j
r�|jtdj||��|jtt
j|d��n|jd	k	r%|jr|dd!|jj|d�}q+|jj|�}n|}|jd	k	r�tjd|j�}||jra|n|}|t|j||j�|j 7}n|jdt@|_|j|�|jt|�7_|jd7_|j|jkp�|j|jk}	|	rN|jrNd}
|jt|
j|j|j��d|_ d|_!|j"�nWd	|jj#�Xd	S(
sR
        Write a block of data using the current cipher, as an SSH block.
        is${:x}sWrite packet <{}>, length {}sOUT: is>Iis(Rekeying (hit {} packets, {} bytes sent)N($RR
RtformatRRBtacquireR:Rt
_build_packetR$t_logRRt
format_binaryR3R>tupdatetstructtpackR<RR8R6R1RR�R)R*t
REKEY_PACKETStREKEY_BYTESR%R-R.t_trigger_rekeytrelease(RJtdatatcmdtcmd_nametorig_lentpacketRytpackedtpayloadt
sent_too_muchtmsg((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytsend_message�sV

		


		cCs�|j|jdt�}|jr�tjd|d �d}||jd}|d|j|dt�}|j|jdt�}tjd|j	|�|}t
|j||j�|j }t
j||�s�td��n|}n|jdk	r
|jj|�}n|jr2|jtt
j|d��n|jrD|}n�tjd|d �d}|d}|t|�|jdkr�td��n|j||jt|��}	|	|t|� }|	|t|�}
|jdk	r|jj|�}n||}|jr2|jtt
j|d��n|jdkr�|jr�|
|j }tjd|j	|�|}t
|j||j�|j }t
j||�s�td��q�nt|d�}|d	||!}|jr|jtd
j||��n|jdk	r!|j|�}nt|d	�}
|j	|
_|j	d	t@|_	||jd}|j|7_|jd	7_|j r�|j!|7_!|j"d	7_"|j"|j#ks�|j!|j$krHtd��qHnk|j|j%ks|j|j&krHd}|jt|j|j|j��d|_!d|_"|j'�nt|d�}|t(krqt(|}nd
j|�}|jr�|jtdj|t|���n||
fS(s�
        Only one thread should ever be in this function (no other locking is
        done).

        :raises: `.SSHException` -- if the packet is mangled
        :raises: `.NeedRekeyException` -- if the transport should rekey
        Rxs>Iiis>IIsMismatched MACsIN: sInvalid packet blockingis"Got payload ({} bytes, {} padding)s+Remote transport is ignoring rekey requestss,Rekeying (hit {} packets, {} bytes received)s${:x}sRead packet <{}>, length {}N()R|R0R\R?R�tunpackR"R2R�R=RR9R7Rtconstant_time_bytes_eqRR4RR�R$R�RR�RR
R�R;R
tseqnoRR+R,R%R-R.tREKEY_PACKETS_OVERFLOW_MAXtREKEY_BYTES_OVERFLOW_MAXR�R�R�R(RJtheadertpacket_sizet	remainingR�tmactmac_payloadtmy_mactleftoverR�tpost_packettpaddingR�R�traw_packet_sizeterrR�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pytread_message�s�	
				

	

				

	cCsf|jdkrdStt|�t�rOx7|D]}|jj||�q/Wn|jj||�dS(N(R!Rt
issubclassRtlistRN(RJtlevelR�tm((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyR�Es
cCs]|js|js|jr!dStj�}||j|jkrY|j�||_ndS(N(RCR3R%RDRERF(RJtnow((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyRvNs

	
cCs�tj�}x�tr�y5|jjd�}t|�dkrHt��nPWnAtjk
r`n.tk
r�}t	|�t
jkr�q��nX|jr�t��ntj�}|||krtj��qqW|S(Ni�i(
RDR\R RqRRpRKRktEnvironmentErrorRRsRuR#(RJRkRjR{RR�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyR�[s&		cCs�|j}|jrdnd}d|t|�||}tjdt|�|d|�}||7}|js|jdkr�|t|7}n|t	j
|�7}|S(Niiis>IBi(R/R>RR�R�R5R3RRtosturandom(RJR�tbsizetaddlenR�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyR�qs	#
cCs
t|_dS(N(R\R%(RJ((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyR��s(&RRRtpowR�R�R�R�RLtpropertyRMROR"RWRXRZR[R]R_R`RaRbRcRfRgRlRmRoR|R�R�R�R�R�RvR�R�R�(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyRAsD	0	
									
					3	+		?	�			
		(!RRsR�RKR�R@RDthmacRtparamikoRtparamiko.commonRRRRRRRtparamiko.py3compatR	R
tparamiko.ssh_exceptionRRtparamiko.messageR
RR~RRtobjectR(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/packet.pyt<module>s 4			

Zerion Mini Shell 1.0