ó õùPc@sédZddlZddlZddlZddlZddlZeZeZyddl Z e ZWn;e k r¡yddl Z e ZWq¢e k rq¢XnXdZ dZdZd„Zd„Zd„Zd efd „ƒYZdS( sP Functions for communicating with Pageant, the basic windows ssh agent program. iÿÿÿÿNlºPœi iJcCsZtr:ytjddƒ}|SWqVtjk r6qVXntrVtjjjddƒSdS(NtPageant( t _has_win32alltwin32guit FindWindowterrort _has_ctypestctypestwindlltuser32t FindWindowAtNone(thwnd((s/..\python\site-packages\paramiko\win_pageant.pyt_get_pageant_window_object5scCsts trtƒrtStS(s Check to see if there is a "Pageant" agent we can talk to. This checks both if we have the required libraries (win32all or ctypes) and if there is a Pageant currently running. (RRR tTruetFalse(((s/..\python\site-packages\paramiko\win_pageant.pytcan_talk_to_agentBscCs½tƒ}|sdStjdƒ}tjj|ƒ}t|dƒ}|j|ƒ|jdt t |ƒƒt j |j ƒt d|dt j ƒ}ztjd|dƒ}|jƒ\}}tjdt||ƒ} trütj|tt | ƒ| ƒ} nQtrGtjd| ƒ} | jƒ\} } tjjj|t| | ƒ} nd } | d kr|jd ƒ}tjd |ƒd }||j|ƒSdSWd|jƒ|jƒtj|ƒXdS( Ns.pagsw+btttagnametaccesstctLLPtBiis>I( R R ttempfiletmktemptostpathtbasenametopentwritet_AGENT_MAX_MSGLENtlentmmaptfilenot ACCESS_WRITEtarrayt buffer_infotstructtpackt_AGENT_COPYDATA_IDRRt SendMessagetwin32con_WM_COPYDATARRRRt SendMessageAtreadtunpacktclosetunlink(tmsgR tfilenamet map_filenametftpymapt char_buffertchar_buffer_addresstchar_buffer_sizetcdstresponset_buft_addrt_sizetdatalentretlen((s/..\python\site-packages\paramiko\win_pageant.pyt_query_pageantNs8  '!!   tPageantConnectioncBs2eZdZd„Zd„Zd„Zd„ZRS(s Mock "connection" to an agent which roughly approximates the behavior of a unix local-domain socket (as used by Agent). Requests are sent to the pageant daemon via special Windows magick, and responses are buffered back for subsequent reads. cCs d|_dS(N(R t _response(tself((s/..\python\site-packages\paramiko\win_pageant.pyt__init__„scCst|ƒ|_dS(N(R=R?(R@tdata((s/..\python\site-packages\paramiko\win_pageant.pytsend‡scCsO|jdkrdS|j| }|j||_|jdkrKd|_n|S(Nt(R?R (R@tntret((s/..\python\site-packages\paramiko\win_pageant.pytrecvŠs  cCsdS(N((R@((s/..\python\site-packages\paramiko\win_pageant.pyR,“s(t__name__t __module__t__doc__RARCRGR,(((s/..\python\site-packages\paramiko\win_pageant.pyR>|s    (RJRR$RRR"RRRRR t ImportErrorRR&RR(R RR=tobjectR>(((s/..\python\site-packages\paramiko\win_pageant.pyts.            .