
    7gQ                        d Z ddlZddlZddlZddlZddlmZ ddlm	Z	 ddl
ZddlmZ dZdZd	Zd
 Zd Z ej                    d         dk    rej        Znej        Z G d dej                  Zd Z G d d          ZdS )zP
Functions for communicating with Pageant, the basic windows ssh agent program.
    N)	zero_byte)b   )_winapil   P  i    J   c                  L    t           j        j                            dd          S )Ns   Pageant)ctypeswindlluser32FindWindowA     N/var/www/html/syslog/venv/lib/python3.11/site-packages/paramiko/win_pageant.py_get_pageant_window_objectr   +   s    =++J
CCCr   c                  8    t          t                                S )z
    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.
    )boolr   r   r   r   can_talk_to_agentr   /   s     *,,---r   64bitc                   F    e Zd ZdZdefdej        j        fdej        fgZ	dS )COPYDATASTRUCTzy
    ctypes implementation of
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms649010%28v=vs.85%29.aspx
    num_data	data_sizedata_locN)
__name__
__module____qualname____doc__	ULONG_PTRr	   wintypesDWORDc_void_p_fields_r   r   r   r   r   ?   s@          
Y	fo+,	V_%HHHr   r   c           	      >   t                      }|sdS dt          j                    d}t          j        |t
          t          j                              }|5  |                    |            t          j        dt          |          t          z             }|                                \  }}t          t          ||          }t          j        j                            |t$          t          j        |          t          j        |                    }|dk    ri|                    d           |                    d          }	t/          j        d|	          d         }
|	|                    |
          z   cddd           S 	 ddd           dS # 1 swxY w Y   dS )za
    Communication with the Pageant process is done through a shared
    memory-mapped file.
    NPageantRequest08xr   r      z>I)r   thread	get_identr   	MemoryMap_AGENT_MAX_MSGLEN get_security_attributes_for_userwritearrayr   r   buffer_infor   _AGENT_COPYDATA_IDr	   r
   r   SendMessageAwin32con_WM_COPYDATAsizeofbyrefseekreadstructunpack)msghwndmap_namepymapchar_bufferchar_buffer_addresschar_buffer_sizecdsresponsedatalenretlens              r   _query_pageantrC   L   s   
 &''D t 9 0 2 2888H#W%M%O%O E 
  Ck#q{{Y'>??0;0G0G0I0I-- 02E
 
 ='44&c(:(:FL<M<M
 
 a<<JJqMMMjjmmG]411!4FUZZ///%       & '                 s   DFFFFc                   *    e Zd ZdZd Zd Zd Zd ZdS )PageantConnectiona  
    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.
    c                     d | _         d S N	_responseselfs    r   __init__zPageantConnection.__init__z   s    r   c                 .    t          |          | _        d S rG   )rC   rI   )rK   datas     r   sendzPageantConnection.send}   s    '--r   c                     | j         dS | j         d |         }| j         |d          | _         | j         dk    rd | _         |S )N rH   )rK   nrets      r   recvzPageantConnection.recv   sJ    >!2nRaR +>R!DN
r   c                     d S rG   r   rJ   s    r   closezPageantConnection.close   s    r   N)r   r   r   r   rL   rO   rT   rV   r   r   r   rE   rE   r   sZ           . . .      r   rE   )r   r-   ctypes.wintypesr	   platformr6   paramiko.commonr   paramiko.utilr   _threadr'   rQ   r   r/   r*   r1   r   r   architecturec_uint64r   c_uint32	Structurer   rC   rE   r   r   r   <module>r`      sM  (         % % % % % %                      D D D. . . 81((III
 
 
 
 
V% 
 
 
# # #L         r   