%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.9/site-packages/cockpit/_vendor/ferny/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.9/site-packages/cockpit/_vendor/ferny/__pycache__/session.cpython-39.pyc

a

��h��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
ddlmZmZmZmZe�d�jZe�e�ZdZe��deeed�dd	��ZGd
d�d�ZGdd
�d
ee�ZdS)�N)�Mapping�Sequence�)�
ssh_errors)�InteractionAgent�InteractionError�InteractionHandler�write_askpass_to_tmpdir�x)�feature�teststr�returncCsFz*tjdd|�d|��ddgtjd�WdStjy@YdS0dS)	N�ssh�-o� z-GZnonexisting)�stderrTF)�
subprocessZcheck_output�DEVNULLZCalledProcessError)rr�r�A/usr/lib/python3.9/site-packages/cockpit/_vendor/ferny/session.py�has_feature%s
$rc@sDeZdZeeeed�dd�Zeeefeeefd�dd�ZdS)�SubprocessContext��argsr
cCs|S)a�Return the args required to launch a process in the given context.

        For example, this might return a vector with
            ["sudo"]
        or
            ["flatpak-spawn", "--host"]
        prepended.

        It is also possible that more substantial changes may be performed.

        This function is not permitted to modify its argument, although it may
        (optionally) return it unmodified, if no changes are required.
        r��selfrrrr�wrap_subprocess_args/sz&SubprocessContext.wrap_subprocess_args)�envr
cCs|S)ajReturn the envp required to launch a process in the given context.

        For example, this might set the "SUDO_ASKPASS" environment variable, if
        needed.

        As with wrap_subprocess_args(), this function is not permitted to
        modify its argument, although it may (optionally) return it unmodified
        if no changes are required.
        r)rrrrr�wrap_subprocess_env?s
z%SubprocessContext.wrap_subprocess_envN)�__name__�
__module__�__qualname__r�strrrrrrrrr.src@s�eZdZUdZded<dZded<dZded<deedddd	dd
ddd�
d
d�Z	ed�dd�Z
dd�dd�Zdd�dd�Zdd�dd�Z
eeeed�dd�ZdS)�SessionNz"tempfile.TemporaryDirectory | None�_controldirz
str | None�_controlsockz!asyncio.subprocess.Process | None�_processFzMapping[str, str] | Nonez
int | NonezInteractionHandler | None)
�destination�handle_host_key�
configfile�
identity_file�
login_name�options�pkcs11�port�interaction_responderr
c
�sltj�tj�dd�d�}
tj|
dd�tj|
d�|_|jj	�d�|_
t|jj	�}ttj�}||d<d	|d
<d|d<d
dd|j
dddd|��g}
|dur�|
�
d|���|dur�|
�
d|���|dur�|D]}|
�
d|�d||���q�|du�r|
�
d|���|du�r|
�
d|���|du�r8|
�
d|���|�rbtd��rb|
�dd|�d�ddg�t|	du�rt|	gng�}tjdg|
�|�R|dtjjtjj|dd�d ��IdH}z,|��IdHtj�|j
��s�J�||_Wn�t�y"}z*|��IdHt�t|��d�WYd}~nNd}~0t�yfz|��Wnt�yPYn0|��IdH�Yn0dS)!NZXDG_RUNTIME_DIRz/runZfernyT)�exist_ok)�dirz/socketZSSH_ASKPASS�forceZSSH_ASKPASS_REQUIRE�-ZDISPLAYz-Mz-N�-SrzPermitLocalCommand=yesz
LocalCommand=z-Fz-irz-Iz-pz-lZKnownHostsCommandzKnownHostsCommand=z %I %H %t %K %fzStrictHostKeyChecking=yesz/usr/bin/sshcSstttj�S�N)�prctl�PR_SET_PDEATHSIG�signal�SIGKILLrrrr�<lambda>��z!Session.connect.<locals>.<lambda>)rZstart_new_session�stdin�stdoutrZ
preexec_fn) �os�path�join�environ�get�makedirs�tempfileZTemporaryDirectoryr$�namer%r	�dict�appendr�extendr�asyncioZcreate_subprocess_execrrZcommunicate�existsr&r�waitrZget_exception_for_ssh_stderrr"�
BaseException�kill�ProcessLookupError)rr'r(r)r*r+r,r-r.r/ZrundirZaskpass_pathrr�keyZagentZprocess�excrrr�connectTsl


�


��
$zSession.connect)r
cCs
|jduSr5)r&�rrrr�is_connected�szSession.is_connectedc�s"|jdusJ�|j��IdHdSr5)r&rKrRrrrrK�szSession.waitcCs|jdusJ�|j��dSr5)r&Z	terminaterRrrr�exit�szSession.exitc�s|��|��IdHdSr5)rTrKrRrrr�
disconnect�szSession.disconnectrcCs*|jdusJ�dd|jdgttj|��RS)Nrr4�)r%�map�shlex�quoterrrrr�szSession.wrap_subprocess_args)FNNNNNNN)rr r!r$�__annotations__r%r&r"�boolrQrSrKrTrUrrrrrrr#Ls6
��Zr#)r
)rIZctypes�	functoolsZloggingr>rXr8rrD�typingrrrVrZinteraction_agentrrrr	ZCDLLr6Z	getLoggerr�loggerr7�	lru_cacher"r[rrr#rrrr�<module>s$


Zerion Mini Shell 1.0