%PDF- %PDF-
Mini Shell

Mini Shell

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

�
��Abc@s�dZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(ddl)m*Z*m+Z+ddl,m-Z-m.Z.m/Z/m0Z0ddl1m2Z2ddl3m4Z4m5Z5d	e6fd
��YZ7de6fd��YZ8dS(
s
`.AuthHandler`
i����N(#tcMSG_SERVICE_REQUESTtcMSG_DISCONNECTt DISCONNECT_SERVICE_NOT_AVAILABLEt)DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLEtcMSG_USERAUTH_REQUESTtcMSG_SERVICE_ACCEPTtDEBUGtAUTH_SUCCESSFULtINFOtcMSG_USERAUTH_SUCCESStcMSG_USERAUTH_FAILUREtAUTH_PARTIALLY_SUCCESSFULtcMSG_USERAUTH_INFO_REQUESTtWARNINGtAUTH_FAILEDtcMSG_USERAUTH_PK_OKtcMSG_USERAUTH_INFO_RESPONSEtMSG_SERVICE_REQUESTtMSG_SERVICE_ACCEPTtMSG_USERAUTH_REQUESTtMSG_USERAUTH_SUCCESStMSG_USERAUTH_FAILUREtMSG_USERAUTH_BANNERtMSG_USERAUTH_INFO_REQUESTtMSG_USERAUTH_INFO_RESPONSEtcMSG_USERAUTH_GSSAPI_RESPONSEtcMSG_USERAUTH_GSSAPI_TOKENtcMSG_USERAUTH_GSSAPI_MICtMSG_USERAUTH_GSSAPI_RESPONSEtMSG_USERAUTH_GSSAPI_TOKENtMSG_USERAUTH_GSSAPI_ERRORtMSG_USERAUTH_GSSAPI_ERRTOKtMSG_USERAUTH_GSSAPI_MICt	MSG_NAMEStcMSG_USERAUTH_BANNER(tMessage(tbtu(tSSHExceptiontAuthenticationExceptiontBadAuthenticationTypetPartialAuthentication(tInteractiveQuery(tGSSAuthtGSS_EXCEPTIONStAuthHandlercBsreZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	dd	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z iee!6ee"6ee#6Z$iee%6ee&6ee'6ee(6ee)6Z*e+d ��Z,RS(!sC
    Internal class to handle the mechanics of authentication.
    cCs�tj|�|_d|_t|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_t|_dS(Nti(tweakreftproxyt	transporttNonetusernametFalset
authenticatedt
auth_eventtauth_methodtbannertpasswordtprivate_keytinteractive_handlert
submethodst
auth_usernametauth_fail_counttgss_hosttTruetgss_deleg_creds(tselfR1((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt__init__Ps												cGs|jj|�S(N(R1t_log(RBtargs((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyRDbscCs|jS(N(R5(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pytis_authenticatedescCs|jjr|jS|jSdS(N(R1tserver_modeR=R3(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pytget_usernamehscCsQ|jjj�z)||_d|_||_|j�Wd|jjj�XdS(Ntnone(R1tlocktacquireR6R7R3t
_request_authtrelease(RBR3tevent((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt	auth_nonens			cCsZ|jjj�z2||_d|_||_||_|j�Wd|jjj�XdS(Nt	publickey(	R1RJRKR6R7R3R:RLRM(RBR3tkeyRN((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pytauth_publickeyxs				cCsZ|jjj�z2||_d|_||_||_|j�Wd|jjj�XdS(NR9(	R1RJRKR6R7R3R9RLRM(RBR3R9RN((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt
auth_password�s				R.cCsc|jjj�z;||_d|_||_||_||_|j�Wd|jjj	�XdS(sK
        response_list = handler(title, instructions, prompt_list)
        skeyboard-interactiveN(
R1RJRKR6R7R3R;R<RLRM(RBR3thandlerRNR<((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pytauth_interactive�s					cCsc|jjj�z;||_d|_||_||_||_|j�Wd|jjj	�XdS(Nsgssapi-with-mic(
R1RJRKR6R7R3R?RARLRM(RBR3R?RARN((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pytauth_gssapi_with_mic�s					cCsQ|jjj�z)||_d|_||_|j�Wd|jjj�XdS(Nsgssapi-keyex(R1RJRKR6R7R3RLRM(RBR3RN((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pytauth_gssapi_keyex�s			cCs#|jdk	r|jj�ndS(N(R6R2tset(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pytabort�scCs7t�}|jt�|jd�|jj|�dS(Nsssh-userauth(R#tadd_byteRt
add_stringR1t
_send_message(RBtm((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyRL�s	

cCs^t�}|jt�|jt�|jd�|jd�|jj|�|jj�dS(NsService not availableten(	R#RZRtadd_intRR[R1R\tclose(RBR]((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt!_disconnect_service_not_available�s	



cCs^t�}|jt�|jt�|jd�|jd�|jj|�|jj�dS(NsNo more auth methods availableR^(	R#RZRR_RR[R1R\R`(RBR]((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_disconnect_no_more_auth�s	



cCs3|jr|jj|jjfS|j�|fSdS(s�
        Given any key, return its type/algorithm & bits-to-sign.

        Intended for input to or verification of, key signatures.
        N(tpublic_blobtkey_typetkey_blobtget_name(RBRQ((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_get_key_type_and_bits�s	cCs�t�}|j|jj�|jt�|j|�|j|�|jd�|jt�|j|�\}}|j|�|j|�|j	�S(NRP(
R#R[R1t
session_idRZRtadd_booleanR@Rgtasbytes(RBRQtserviceR3t	algorithmR]t_tbits((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_get_session_blob�s	






cCs8d}|jjdk	r1tj�|jj}nx�tr�|jd�|jj�s�|jj�}|dks�t|j	t
�r�td�}n|�n|j�r�Pn|dk	r4|tj�kr4td��q4q4W|j
�s4|jj�}|dkrtd�}nt|j	t�r+|jS|�ngS(Ng�������?sAuthentication failed.sAuthentication timeout.(R2R1tauth_timeoutttimeR@twaitt	is_activet
get_exceptiont
issubclasst	__class__tEOFErrorR'tis_setRFR)t
allowed_types(RBRNtmax_tste((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pytwait_for_response�s,	
		cCs�|j�}|jjr�|dkr�t�}|jt�|j|�|jj|�|jjj	�\}}|r�t�}|jt
�|j|�|j|�|jj|�ndS|j�dS(Nsssh-userauth(tget_textR1RGR#RZRR[R\t
server_objectt
get_bannerR"Ra(RBR]RkR8tlanguage((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_parse_service_requests	

	


cCsa|jj}|jdd�|krGd}|jt|j|��dS|jj|t|��S(Ns-cert-v01@openssh.comR.s<Auth rejected: pubkey algorithm '{}' unsupported or disabled(	R1tpreferred_pubkeystreplaceRDRtformatR2t	_key_infoR#(RBRltkeyblobtoptionsterr((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_generate_key_from_requestsc
Cs�d|kr|S|jtdj|��g|jjD]}d|kr6|^q6}|jtdj|��|s�td��nt|jjjdt	d���}d}|rL|jd�}|jtdj|��tt
|j|��}|r|d	}|jtd
j|��q�|jtd�d}t|j|���n9|d	}d
}	|jt|	j|��|jtd�|jd�r�|d7}n||j_|S(Ntrsas0Finalizing pubkey algorithm for key of type {!r}sOur pubkey algorithm list: {}sFAn RSA key was specified, but no RSA pubkey algorithms are configured!sserver-sig-algsR.t,sServer-side algorithm list: {}is!Agreed upon {!r} pubkey algorithms)No common pubkey algorithms exist! Dying.s=Unable to agree on a pubkey algorithm for signing a {!r} key!sYServer did not send a server-sig-algs list; defaulting to our first preferred algo ({!r})s�NOTE: you may use the 'disabled_algorithms' SSHClient/Transport init kwarg to disable that or other algorithms if your server does not support them!s-cert-v01@openssh.com(RDRR�R1R�R&R%tserver_extensionstgetR$R2tsplittlisttfiltert__contains__R'tendswitht_agreed_pubkey_algorithm(
RBRdtxtmy_algostserver_algo_strtpubkey_algotserver_algost	agreementR�tmsg((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_finalize_pubkey_algorithm#sJ
+!


cCs|j�}|dkr�|jtd�t�}|jt�|j|j�|jd�|j|j�|jdkr�|j	t
�t|j�}|j|�n+|jdkrF|j	t
�|j|j�\}}|j|�}|j|�|j|�|j|jd|j|�}|jj||�}|j|�n�|jdkru|jd�|j|j�n\|jdkrKt|j|j�}	|j|	j��|jj|�|jjj�\}
}|
tkr|j|�|jjj�\}
}n|
tkr�|j�}t�}|jt �y&|j|	j!|j"||j��Wnt#k
r{}|j$|�SX|jj|�x�t
rP|jjj�\}
}|
t%kr�|j�}
y"|	j!|j"||j|
�}Wnt#k
r}|j$|�SX|dkrPqMt�}|jt �|j|�|jj'|�q�q�Wt(d	j)t*|
���t�}|jt+�|j|	j,|jj-��q�|
t.kr�t(d
��q�|
t/kr|j0�}|j0�}|j�}|j�t(dj)|||���q�|
t1kr/|j2|�dSt(d	j)t*|
���n�|jdkr�|jj3r�|jj4}|j5|j�|j,|jj-�}|j|�n*|jd
kr�nt(dj)|j���|jj|�n|jtdj)|��dS(Nsssh-userauthsuserauth is OKsssh-connectionR9RPskeyboard-interactiveR.sgssapi-with-micsReceived Package: {}sServer returned an error tokensCGSS-API Error:
Major Status: {}
Minor Status: {}
Error Message: {}
sgssapi-keyexRIsUnknown auth method "{}"s!Service request "{}" accepted (?)(6R}RDRR#RZRR[R3R7RiR4R$R9R@RgR:R�Rot
sign_ssh_dataR<R+RAt	add_bytestssh_gss_oidsR1R\t
packetizertread_messageRt_parse_userauth_bannerRt
get_stringRtssh_init_sec_contextR?R,t_handle_local_gss_failureRR2tsend_messageR&R�R!Rtssh_get_micRhRRtget_intRt_parse_userauth_failuretgss_kex_usedtkexgss_ctxttset_username(RBR]RkR9RdRnRltblobtsigtsshgsstptypetmechR{t	srv_tokent
next_tokent
maj_statust
min_statusterr_msgtkexgsst	mic_token((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_parse_service_accept]s�	





	

	
	
	

	


cCs
t�}|tkrG|jtdj|��|jt�t|_nz|jtdj|��|jt	�|j
|jjj
|��|tkr�|jt�n|jt�|jd7_|jj|�|jdkr�|j�n|tkr	|jj�ndS(NsAuth granted ({}).sAuth rejected ({}).ii
(R#RRDRR�RZR	R@R5R
R[R1R~tget_allowed_authsRRiR4R>R\Rbt
_auth_trigger(RBR3tmethodtresultR]((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_send_auth_result�s$	



cCs�t�}|jt�|j|j�|j|j�|jt��|jt|j	��x3|j	D](}|j|d�|j
|d�qfW|jj|�dS(Nii(
R#RZRR[tnametinstructionstbytesR_tlentpromptsRiR1R\(RBtqR]tp((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_interactive_query�s	
cCs�|jjsPt�}|jt�|jd�|jt�|jj|�dS|j	r]dS|j
�}|j
�}|j
�}|jtdj
|||��|dkr�|j�dS|jdk	r�|j|kr�|jtd�|j�dS||_|jjj�}|dkr5|jjj|�}n�|dkr�|j�}|j�}y|jd�}Wntk
rnX|r�|jtd�|j�}	y|	jdd�}	Wntk
r�nXt}q�|jjj||�}n�|d	kr�|j�}
|j
�}|j�}y|j||�}
Wnxtk
rp}|jtd
j
t|���d}
nAt k
r�}d}|jt|j
|j!j"|��d}
nX|
dkr�|j�dS|jjj#||
�}|tkr�|
s9t�}|jt$�|j|�|j|�|jj|�dSt|j��}|j%|
|||�}|
j&||�s�|jtd�t}q�q�n*|d
kr�|j'�}|jjj(||�}t)|t*�r�|j+|�dSn�|dkr�|r�t,|�}|j-�}|dkr:|jtd�|j�n|j'�}|j.|�}|sx|jtd�|j�n|j/d�}t�}|jt0�|j1|�t2||�|j_3t4t5t6f|j_7|jj|�dS|dkr�|r�|j'�}|jj8}|dkr:t}|j9|||�ny |j:||jj;|j�Wn-t k
r�t}|j9|||��nXt<}|jjj=||�n|jjj|�}|j9|||�dS(NRIs.Auth request (type={}) service={}, username={}sssh-connectionsKAuth rejected because the client attempted to change username in mid-flightR9sUTF-8s+Auth request to change passwords (rejected)R�RPsAuth rejected: public key: {}s9Auth rejected: unsupported or mangled public key ({}: {})s Auth rejected: invalid signatureskeyboard-interactivesgssapi-with-micis8Disconnect: Received more than one GSS-API OID mechanisms5Disconnect: Received an invalid GSS-API OID mechanismtserversgssapi-keyex(>R1RGR#RZR
R[RiR4R\R5R}RDRR�RaR=R2R
RbR~tenable_auth_gssapitcheck_auth_nonetget_booleant
get_binarytdecodetUnicodeErrorRtcheck_auth_passwordR�R&Rtstrt	ExceptionRvt__name__tcheck_auth_publickeyRRotverify_ssh_sigR�tcheck_auth_interactivet
isinstanceR*R�R+R�tssh_check_mechR�RR�tGssapiWithMicAuthHandlertauth_handlerRRRt_expected_packetR�R�t
ssh_check_micRhRtcheck_auth_gssapi_keyex(RBR]R3RkR�tgss_authR�t	changereqR9tnewpasswordtsig_attachedRlR�RQR{R�R�R�R<R�tmechstdesired_mechtmech_oktsupported_mechR�((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_parse_userauth_request
s	


	

	

		"

	





	



cCsU|jtdj|j��t|_|jj�|jdk	rQ|jj
�ndS(NsAuthentication ({}) successful!(RDRR�R7R@R5R1R�R6R2RX(RBR]((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_parse_userauth_success�s	
cCs|j�}|j�}|r]|jtd�|jtdt|��t|�|j_n|j	|kr�x9dj
|j	�dj
|�fD]}|jt|�q�Wtd|�|j_n|jtdj
|j	��t|_
d|_|jdk	r
|jj�ndS(NsAuthentication continues...s	Methods: s'Authentication type ({}) not permitted.sAllowed methods: {}sBad authentication typesAuthentication ({}) failed.(tget_listR�RDRRR�R)R1tsaved_exceptionR7R�R(R4R5R2R3R6RX(RBR]tauthlisttpartialR�((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR��s(			cCs2|j�}||_|jtdj|��dS(NsAuth banner: {}(R�R8RDRR�(RBR]R8((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR��s	c	Cs�|jdkrtd��n|j�}|j�}|j�|j�}g}x3t|�D]%}|j|j�|j�f�q_W|j|||�}t	�}|j
t�|jt
|��x|D]}|j|�q�W|jj|�dS(Nskeyboard-interactives Illegal info request from server(R7R&R}R�R�trangetappendR�R;R#RZRR_R�R[R1R\(	RBR]ttitleR�R�tprompt_listtit
response_listtr((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_parse_userauth_info_request�s"
#	

cCs�|jjstd��n|j�}g}x't|�D]}|j|j��q:W|jjj|�}t	|t
�r�|j|�dS|j|j
d|�dS(Ns!Illegal info response from serverskeyboard-interactive(R1RGR&R�R�R�R}R~tcheck_auth_interactive_responseR�R*R�R�R=(RBR]tnt	responsesR�R�((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_parse_userauth_info_response�s	
cCsv||j_|jtdj|��|jtdj|j��t|_d|_
|jdk	rr|jj�ndS(NsGSSAPI failure: {}sAuthentication ({}) failed.(
R1R�RDRR�RR7R4R5R2R3R6RX(RBR{((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR�s		cCs|jjr|jS|jSdS(N(R1RGt_server_handler_tablet_client_handler_table(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_handler_table2s(-R�t
__module__t__doc__RCRDRFRHRORRRSRURVRWRYRLRaRbRgRoR|R�R�R�R�R�R�R�R�R�R�R�R�R�RRRR�RRRRRR�tpropertyR�(((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR-KsT					
				
								
				:	�		
	�							

R�cBs�eZdZdZd�Zd�Zed��Zed��Zed��Z	ed��Z
d�Zd	�Zd
�Z
d�Zd�Ziee6ee6ee6e
e6Zed
��ZRS(s�A specialized Auth handler for gssapi-with-mic

    During the GSSAPI token exchange we need a modified dispatch table,
    because the packet type numbers are not unique.
    sgssapi-with-miccCs||_||_dS(N(t	_delegateR�(RBtdelegateR�((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyRCCs	cCs|j�|jj�S(N(t_restore_delegate_auth_handlerR�RY(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyRYGs
cCs
|jjS(N(R�R1(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR1KscCs
|jjS(N(R�R�(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR�OscCs
|jjS(N(R�R=(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR=SscCs
|jjS(N(R�R?(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR?WscCs|j|j_dS(N(R�R1R�(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR�[scCs�|j�}|j}y|j|j||j�}WnKtk
r�}||j_t}|j	�|j
|j|j|��nX|dk	r�t
�}|jt�|j|�tttf|j_|jj|�ndS(N(R�R�tssh_accept_sec_contextR?R=R�R1R�RR�R�R�R2R#RZRR[RR RR�R\(RBR]tclient_tokenR�ttokenR{R�((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_parse_userauth_gssapi_token^s&	
	

cCs�|j�}|j}|j}|j�y|j||jj|�Wn>tk
r�}||j_t	}|j
||j|��nXt}|jj
j||�|j
||j|�dS(N(R�R�R=R�R�R1RhR�R�RR�R�RR~tcheck_auth_gssapi_with_mic(RBR]R�R�R3R{R�((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt_parse_userauth_gssapi_micxs 		

cCs|j�|jj|�S(N(R�R�R�(RBR]((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR��s
cCs|j�|jj|�S(N(R�R�R�(RBR]((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR��s
cCs|jS(N(t(_GssapiWithMicAuthHandler__handler_table(RB((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR��s(R�R�R�R�RCRYR�R1R�R=R?R�RRR�R�RRRR RR�(((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyR�:s&							
(9R�R/Rqtparamiko.commonRRRRRRRRRR	R
RRR
RRRRRRRRRRRRRRRRRRR R!R"tparamiko.messageR#tparamiko.py3compatR$R%tparamiko.ssh_exceptionR&R'R(R)tparamiko.serverR*tparamiko.ssh_gssR+R,tobjectR-R�(((sJ/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/auth_handler.pyt<module>s�%"���

Zerion Mini Shell 1.0