ó =OXc@sdZddlZddlZddlZddlZddlTddlmZyddl Z Wne k rddl Z nXddl m Z dZdZd Zd „Zd „Zejƒd d krÓejnejZdejfd„ƒYZd„Zdefd„ƒYZdS(sP Functions for communicating with Pageant, the basic windows ssh agent program. iÿÿÿÿN(t*(tbi(t_winapilºPœi iJcCs"tjjjtdƒtdƒƒS(NtPageant(tctypestwindlltuser32t FindWindowAR(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyt_get_pageant_window_object.scCs ttƒƒS(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. (tboolR(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pytcan_talk_to_agent2sit64bittCOPYDATASTRUCTcBs8eZdZdefdejjfdejfgZRS(sy ctypes implementation of http://msdn.microsoft.com/en-us/library/windows/desktop/ms649010%28v=vs.85%29.aspx tnum_datat data_sizetdata_loc( t__name__t __module__t__doc__t ULONG_PTRRtwintypestDWORDtc_void_pt_fields_(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyR ?s c Cstƒ}|sdSdtjƒ}tj|ttjƒƒ}|Õ|j|ƒt j dt |ƒt ƒ}|j ƒ\}}t t||ƒ}tjjj|ttj|ƒtj|ƒƒ}|dkr|jdƒ|jdƒ} tjd| ƒd} | |j| ƒSdSWdQXdS(sa Communication with the Pageant process is done through a shared memory-mapped file. sPageantRequest%08xRiis>IN(RtNonetthreadt get_identRt MemoryMapt_AGENT_MAX_MSGLENt get_security_attributes_for_usertwritetarrayRt zero_bytet buffer_infoR t_AGENT_COPYDATA_IDRRRt SendMessageAtwin32con_WM_COPYDATAtsizeoftbyreftseektreadtstructtunpack( tmsgthwndtmap_nametpymapt char_buffertchar_buffer_addresstchar_buffer_sizetcdstresponsetdatalentretlen((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyt_query_pageantKs(     !  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(Rt _response(tself((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyt__init__wscCst|ƒ|_dS(N(R6R8(R9tdata((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pytsendzscCsO|jdkrdS|j| }|j||_|jdkrKd|_n|S(Nt(R8R(R9tntret((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pytrecv}s  cCsdS(N((R9((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pytclose†s(RRRR:R<R@RA(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyR7os    (RRtctypes.wintypesRtplatformR)t paramiko.utiltparamiko.py3compatRt_threadRt ImportErrorR=RR"RR$RR t architecturetc_uint64tc_uint32Rt StructureR R6tobjectR7(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyts(        ( $