Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/conch/ssh/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/twisted/conch/ssh/__pycache__/agent.cpython-310.pyc
o

�b,%�@s�dZddlZddlmZmZddlmZddlmZm	Z	m
Z
ddlmZm
Z
Gdd�de
j�ZGd	d
�d
e
j�ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZiZe�� ��!�D]\Z"Z#e"dd�dkroe"dd�ee#<q[dS)z�
Implements the SSH v2 key agent protocol.  This protocol is documented in the
SSH source code, in the file
U{PROTOCOL.agent<http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.agent>}.

Maintainer: Paul Swartz
�N)�
ConchError�MissingKeyStoreError)�keys)�NS�getMP�getNS)�defer�protocolc@sbeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�SSHAgentClientz�
    The client side of the SSH agent protocol.  This is equivalent to
    ssh-add(1) and can be used with either ssh-agent(1) or the SSHAgentServer
    protocol, also in this package.
    cCsd|_g|_dS�N�)�buf�	deferreds��self�r�9/usr/lib/python3/dist-packages/twisted/conch/ssh/agent.py�__init__s
zSSHAgentClient.__init__cCs�|j|7_	t|j�dkrdSt�d|jdd��d}t|j�d|kr)dS|jdd|�|jd|d�}|_t|dd��}|j�d�}|tkrW|�t	d��n|t
kra|�d�n|�|�q)N���!Lrz
agent failurer)r
�len�struct�unpack�ordr�pop�
AGENT_FAILURE�errbackr�
AGENT_SUCCESS�callback)r�data�packLen�packet�reqType�drrr�dataReceived s (
�zSSHAgentClient.dataReceivedcCs>t�dt|�d|�|}|j�|�t��}|j�|�|S�Nz!LBr)	r�packr�	transport�writer�Deferredr�append)rr#r r'r$rrr�sendRequest2s
zSSHAgentClient.sendRequestcCs|�td�}|�|j�|S)z�
        @return: A L{Deferred} which will fire with a list of all keys found in
            the SSH agent. The list of keys is comprised of (public key blob,
            comment) tuples.
        r)r,�AGENTC_REQUEST_IDENTITIES�addCallback�_cbRequestIdentities)rr$rrr�requestIdentities9sz SSHAgentClient.requestIdentitiescCs�t|dd��tkrtdt|dd����t�d|dd��d}g}|dd�}t|�D]}t|�\}}t|�\}}|�||f�q.|S)z}
        Unpack a collection of identities into a list of tuples comprised of
        public key blobs and comments.
        rrzunexpected response: %ir�N)r�AGENT_IDENTITIES_ANSWERrrr�rangerr+)rr �numKeys�result�i�blob�commentrrrr/Csz#SSHAgentClient._cbRequestIdentitiesrcCs|}|t|�7}|�t|�S)zK
        Add a private key blob to the agent's collection of keys.
        )rr,�AGENTC_ADD_IDENTITY)rr7r8�reqrrr�addIdentitySszSSHAgentClient.addIdentitycCs0t|�}|t|�7}|d7}|�t|��|j�S)a�
        Request that the agent sign the given C{data} with the private key
        which corresponds to the public key given by C{blob}.  The private
        key should have been added to the agent already.

        @type blob: L{bytes}
        @type data: L{bytes}
        @return: A L{Deferred} which fires with a signature for given data
            created with the given key.
        �)rr,�AGENTC_SIGN_REQUESTr.�_cbSignData)rr7r r:rrr�signData[szSSHAgentClient.signDatacCsDt|dd��tkrtdt|dd����t|dd��d}|S)Nrrzunexpected data: %i)r�AGENT_SIGN_RESPONSErr)rr �	signaturerrrr>kszSSHAgentClient._cbSignDatacCst|�}|�t|�S)zp
        Remove the private key corresponding to the public key in blob from the
        running agent.
        )rr,�AGENTC_REMOVE_IDENTITY)rr7r:rrr�removeIdentityqszSSHAgentClient.removeIdentitycCs|�td�S)z9
        Remove all keys from the running agent.
        r)r,�AGENTC_REMOVE_ALL_IDENTITIESrrrr�removeAllIdentitiesysz"SSHAgentClient.removeAllIdentitiesN)r)�__name__�
__module__�__qualname__�__doc__rr%r,r0r/r;r?r>rCrErrrrr
s

r
c@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�SSHAgentServerz�
    The server side of the SSH agent protocol.  This is equivalent to
    ssh-agent(1) and can be used with either ssh-add(1) or the SSHAgentClient
    protocol, also in this package.
    cCs
d|_dSr)r
rrrrr�s
zSSHAgentServer.__init__cCs�|j|7_	t|j�dkrdSt�d|jdd��d}t|j�d|kr)dS|jdd|�|jd|d�}|_t|dd��}t�|d�}|sT|�td�n!t	|d|�}t	|j
dd�durm|�td�t��||dd��q)Nrrrrrz	agentc_%sr)r
rrrr�messages�get�sendResponser�getattr�factoryr)rr r!r"r#�reqName�frrrr%�s$(�zSSHAgentServer.dataReceivedcCs*t�dt|�d|�|}|j�|�dSr&)rr'rr(r))rr#r r'rrrrM�szSSHAgentServer.sendResponsecCsz|dksJ�t|jj�}g}|�t�d|��|jj��D]\}}|�t|����|�t|��q|�	t
d�|��dS)zQ
        Return all of the identities that have been added to the server
        rrN)rrOrr+rr'�valuesrr7rMr2�join)rr r4�resp�keyr8rrr�agentc_REQUEST_IDENTITIES�sz(SSHAgentServer.agentc_REQUEST_IDENTITIEScCsbt|�\}}||jjvr|�td�St|�\}}|dksJ�|�tt|jj|d�|���dS)z�
        Data is a structure with a reference to an already added key object and
        some data that the clients wants signed with that key.  If the key
        object wasn't loaded, return AGENT_FAILURE, else return the signature.
        rr<rN)rrOrrMrr@r�sign)rr r7r?rrr�agentc_SIGN_REQUEST�s�z"SSHAgentServer.agentc_SIGN_REQUESTcCs�t|�\}}|dkr
d}n|dkrd}nt�d|��t||�d}t|�\}}tjj|dd�}||f|jj|��<|�t	d	�d
S)z�
        Adds a private key to the agent's collection of identities.  On
        subsequent interactions, the private key can be accessed using only the
        corresponding public key.
        sssh-rsa�sssh-dssr1zunknown blob type: %s����private_blob��typerN)
rr�BadKeyErrorr�Key�
fromStringrOr7rMr)rr �keyType�rest�nmpr8�krrr�agentc_ADD_IDENTITY�s�z"SSHAgentServer.agentc_ADD_IDENTITYcCs:t|�\}}tjj|dd�}|jj|��=|�td�dS)zR
        Remove a specific key from the agent's collection of identities.
        r7r\rN)rrr_r`rOr7rMr)rr r7�_rdrrr�agentc_REMOVE_IDENTITY�sz%SSHAgentServer.agentc_REMOVE_IDENTITYcCs$|dksJ�i|j_|�td�dS)zL
        Remove all keys from the agent's collection of identities.
        rN)rOrrMr�rr rrr�agentc_REMOVE_ALL_IDENTITIES�sz+SSHAgentServer.agentc_REMOVE_ALL_IDENTITIEScCs|�tt�dd��dS)z�
        v1 message for listing RSA1 keys; superseded by
        agentc_REQUEST_IDENTITIES, which handles different key types.
        rrN)rM�AGENT_RSA_IDENTITIES_ANSWERrr'rhrrr�agentc_REQUEST_RSA_IDENTITIES�sz,SSHAgentServer.agentc_REQUEST_RSA_IDENTITIEScC�|�td�dS)z�
        v1 message for removing RSA1 keys; superseded by
        agentc_REMOVE_IDENTITY, which handles different key types.
        rN�rMrrhrrr�agentc_REMOVE_RSA_IDENTITY��z)SSHAgentServer.agentc_REMOVE_RSA_IDENTITYcCrl)z�
        v1 message for removing all RSA1 keys; superseded by
        agentc_REMOVE_ALL_IDENTITIES, which handles different key types.
        rNrmrhrrr� agentc_REMOVE_ALL_RSA_IDENTITIES�roz/SSHAgentServer.agentc_REMOVE_ALL_RSA_IDENTITIESN)rFrGrHrIrr%rMrVrXrergrirkrnrprrrrrJ�s	rJr�r1rY��	���
������AGENTC_)$rIr�twisted.conch.errorrr�twisted.conch.sshr�twisted.conch.ssh.commonrrr�twisted.internetrr	�Protocolr
rJ�AGENTC_REQUEST_RSA_IDENTITIESrjrr�AGENTC_REMOVE_RSA_IDENTITY� AGENTC_REMOVE_ALL_RSA_IDENTITIESr-r2r=r@r9rBrDrK�locals�copy�items�name�valuerrrr�<module>s8	k��

Spamworldpro Mini