%PDF- %PDF-
| Direktori : /lib/python3/dist-packages/paramiko/__pycache__/ |
| Current File : //lib/python3/dist-packages/paramiko/__pycache__/agent.cpython-312.pyc |
�
�ec�3 � � � d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl
mZmZ ddl
mZ ddlmZmZ ddlmZ ddlmZ dd lmZ ed
� ZdZ ed� Zd
ZdZdZeed�Z G d� de� Z G d� dejB � Z" G d� de"� Z# G d� de"� Z$d� Z% G d� de� Z& G d� de � Z' G d� de� Z( G d � d!e � Z) G d"� d#e� Z*y)$z
SSH Agent interface
� N)�select)�asbytes�io_sleep)�byte_chr)�SSHException�AuthenticationException)�Message)�PKey)�retry_on_signal� � �
� � � )zrsa-sha2-256zrsa-sha2-512c �0 � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zy)�AgentSSHc � � d | _ d| _ y �N� )�_conn�_keys��selfs �0/usr/lib/python3/dist-packages/paramiko/agent.py�__init__zAgentSSH.__init__; s � ���
���
� c � � | j S )a4
Return the list of keys available through the SSH agent, if any. If
no SSH agent was running (or it couldn't be contacted), an empty list
will be returned.
:return:
a tuple of `.AgentKey` objects representing keys available on the
SSH agent
)r r s r �get_keyszAgentSSH.get_keys? s � � �z�z�r c �< � || _ | j t � \ }}|t k7 rt d� �g }t |j
� � D ]; }|j t | |j � � � |j � �= t |� | _ y )Nz!could not get keys from ssh-agent)
r �
_send_message�cSSH2_AGENTC_REQUEST_IDENTITIES�SSH2_AGENT_IDENTITIES_ANSWERr �range�get_int�append�AgentKey�
get_binary�
get_string�tupler )r �conn�ptype�result�keys�is r �_connectzAgentSSH._connectK s� � ���
��*�*�+J�K�
��v��0�0��B�C�C����v�~�~�'�(� �A��K�K���v�'8�'8�':�;�<����� � �4�[��
r c �l � | j �| j j � d | _ d| _ y r )r �closer r s r �_closezAgentSSH._closeV s* � ��:�:�!��J�J������
���
r c �H � t |� }| j j t j dt |� � |z � | j
d� }t | j
t j d|� d � � }t |j � � |fS )Nz>Ir r )r r �send�struct�pack�len� _read_allr �unpack�ord�get_byte)r �msg�datas r r! zAgentSSH._send_message\ sv � ��c�l���
�
������D�#�c�(�3�c�9�:��~�~�a� ���d�n�n�V�]�]�4��%>�q�%A�B�C���3�<�<�>�"�C�'�'r c �2 � | j j |� }t |� |k rmt |� dk( rt d� �| j j |t |� z
� }t |� dk( rt d� �||z
}t |� |k r�m|S )Nr �lost ssh-agent)r �recvr8 r )r �wantedr- �extras r r9 zAgentSSH._read_allc s� � �������(���&�k�F�"��6�{�a��"�#3�4�4��J�J�O�O�F�S��[�$8�9�E��5�z�Q��"�#3�4�4��e�O�F�
�&�k�F�"� �
r N) �__name__�
__module__�__qualname__r r r0 r3 r! r9 r r r r r : s � ��
� !��(� r r c �( � e Zd ZdZd� Zd� Zd� Zd� Zy)�AgentProxyThreadz@
Class in charge of communication between two channels.
c �v � t j j | | j �� || _ d| _ y )N)�targetF)� threading�Threadr �run�_agent�_exit�r �agents r r zAgentProxyThread.__init__t s- � ����!�!�$�t�x�x�!�8������
r c �^ � | j � \ }}|| _ || _ | j j � t | j t � sA| j j � t | j j d� st d� �| j � y # � xY w)N�filenozUnable to connect to SSH agent)�get_connection�_AgentProxyThread__inr�_AgentProxyThread__addrrN �connect�
isinstance�intr �hasattrr �_communicate)r �r�addrs r rM zAgentProxyThread.runy s� � � ��+�+�-�I�Q�� �D�J��D�K��K�K���!��d�k�k�3�/����!�!�)��t�{�{�0�0�(�;�-�.N�O�O������ ��s �B&B) �)B,c �v � dd l }|j | j |j � }|j | j |j |t j
z � | j �sJt | j j | j gg g d� }|d D ]� }| j j |k( ra| j j j d� }t |� dk7 r| j j |� �k| j � nr| j |k( s��| j j d� }t |� dk7 r&| j j j |� ��| j � n t j t � | j s��Iy y )Nr g �?i )�fcntlrU �F_GETFL�F_SETFL�os�
O_NONBLOCKrO r rN r rA r8 r5 r3 �time�sleepr )r r_ �oldflags�events�fdr>