ó =OXc@sÿdZddlZddlmZddlmZddlmZmZddl m Z ddl m Z m Z mZddlmZed d ƒ\ZZged d ƒD]Ze eƒ^q©\ZZe d ƒed Zed Zdefd„ƒYZdS(s Standard SSH key exchange ("kex" if you wanna sound cool). Diffie-Hellman of 1024 bit key halves, using a known "p" prime and "g" generator. iÿÿÿÿN(tsha1(tutil(tmax_bytet zero_byte(tMessage(tbyte_chrtlongt byte_mask(t SSHExceptionii iiit KexGroup1cBsVeZdZdZdZeZd„Zd„Zd„Z d„Z d„Z d„Z RS( lEÿÿÿÿ8Ê{3If?ñE yéZô3¢Vý58nÛoP·eõ?a-û ÓtBLè ûy3W[<‘p¨6m5ÂÝPøß&aÌF!Í33*¾w& ãAR‘M;L}. c|&A“@”h\Š&&# -D¨v‡dÿÿÿÿisdiffie-hellman-group1-sha1cCs:||_tdƒ|_tdƒ|_tdƒ|_dS(Ni(t transportRtxtetf(tselfR ((s7/usr/lib/python2.7/site-packages/paramiko/kex_group1.pyt__init__2s cCs°|jƒ|jjrHt|j|j|jƒ|_|jjt ƒdSt|j|j|jƒ|_ t ƒ}|j t ƒ|j|j ƒ|jj|ƒ|jjtƒdS(N(t _generate_xR t server_modetpowtGR tPR t_expect_packett_MSG_KEXDH_INITR Rtadd_bytetc_MSG_KEXDH_INITt add_mpintt _send_messaget_MSG_KEXDH_REPLY(Rtm((s7/usr/lib/python2.7/site-packages/paramiko/kex_group1.pyt start_kex8s    cCs_|jjr%|tkr%|j|ƒS|jj rK|tkrK|j|ƒStd|ƒ‚dS(Ns(KexGroup1 asked to handle packet type %d(R RRt_parse_kexdh_initRt_parse_kexdh_replyR(RtptypeR((s7/usr/lib/python2.7/site-packages/paramiko/kex_group1.pyt parse_nextGs   cCsjxQtjdƒ}t|ddƒ|d}|d tkr|d tkrPqqtj|ƒ|_dS(Ni€iiii(tosturandomRtb7ffffffffffffffftb0000000000000000Rt inflate_longR (Rtx_bytes((s7/usr/lib/python2.7/site-packages/paramiko/kex_group1.pyRPscCs0|jƒ}|jƒ|_|jdks@|j|jdkrOtdƒ‚n|jƒ}t|j|j|jƒ}tƒ}|j |j j |j j |j j |j jƒ|j|ƒ|j|jƒ|j|jƒ|j|ƒ|j j|t|jƒƒjƒƒ|j j||ƒ|j jƒdS(NisServer kex "f" is out of range(t get_stringt get_mpintR RRt get_binaryRR RtaddR t local_versiontremote_versiontlocal_kex_inittremote_kex_initt add_stringRR t_set_K_HRtasbytestdigestt _verify_keyt_activate_outbound(RRthost_keytsigtKthm((s7/usr/lib/python2.7/site-packages/paramiko/kex_group1.pyR^s  %    %cCsˆ|jƒ|_|jdks4|j|jdkrCtdƒ‚nt|j|j|jƒ}|jjƒjƒ}t ƒ}|j |jj |jj |jj |jjƒ|j|ƒ|j|jƒ|j|jƒ|j|ƒt|jƒƒjƒ}|jj||ƒ|jjƒj|ƒ}t ƒ}|jtƒ|j|ƒ|j|jƒ|j|ƒ|jj|ƒ|jjƒdS(NisClient kex "e" is out of range(R)R RRRR R tget_server_keyR2RR+R-R,R/R.R0RR RR3R1t sign_ssh_dataRtc_MSG_KEXDH_REPLYRR5(RRR8tkeyR9tHR7((s7/usr/lib/python2.7/site-packages/paramiko/kex_group1.pyRrs,%       ( t__name__t __module__RRtnameRt hash_algoRRR!RRR(((s7/usr/lib/python2.7/site-packages/paramiko/kex_group1.pyR )s    (t__doc__R"thashlibRtparamikoRtparamiko.commonRRtparamiko.messageRtparamiko.py3compatRRRtparamiko.ssh_exceptionRtrangeRRtcRR<R$R%tobjectR (((s7/usr/lib/python2.7/site-packages/paramiko/kex_group1.pyts .