403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/__pycache__/sshpeer.cpython-39.opt-1.pyc
a

�+�b@Z�@s�ddlmZddlZddlZddlmZddlmZddlm	Z	mZm
Z
mZmZm
Z
ddlmZmZmZdd	�Zddd�ZGd
d�de�Zdd�Zddd�Zdd�Zdd�ZGdd�dej�Zd dd�Zd!dd�ZdS)"�)�absolute_importN�)�_)�getattr)�error�pycompat�util�wireprototypes�wireprotov1peer�wireprotov1server)�procutil�
stringutil�urlutilcCs(|s|St�d|�r|Sd|�dd�S)z=quote a string for the remote shell ... which we assume is shs[a-zA-Z0-9@%_+=:,./-]*$s'%s'�'s'\'')�re�match�replace)�s�r�7/usr/lib64/python3.9/site-packages/mercurial/sshpeer.py�_serverquotes
rFcCsJ|rF|jsFt�|�}|rF|r"|jn|j}|��D]}|td�|d�q0dS)zYdisplay all data currently available on pipe as remote output.

    This is non blocking.�remote: �
N)�closedrZreadpipe�warn�status�
splitlinesr)�ui�piperrZdisplay�lrrr�_forwardoutput's

r c@sfeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	ddd�Z
dd�Zedd��Z
dd�ZdS)�
doublepipea3Operate a side-channel pipe in addition of a main one

    The side-channel pipe contains server output to be forwarded to the user
    input. The double pipe will behave as the "main" pipe, but will ensure the
    content of the "side" pipe is properly processed while we wait for blocking
    call on the "main" pipe.

    If large amounts of data are read from "main", the forward will cease after
    the first bytes start to appear. This simplifies the implementation
    without affecting actual output of sshpeer too much as we rarely issue
    large read for data not yet emitted by the server.

    The main pipe is expected to be a 'bufferedinputpipe' from the util module
    that handle all the os specific bits. This class lives in this module
    because it focus on behavior specific to the ssh protocol.cCs||_||_||_dS�N)�_ui�_main�_side)�selfr�mainZsiderrr�__init__Dszdoublepipe.__init__cCspt|jtj�r|jjrdS|j��|j��g}zt�|�}WntyR|}Yn0|j��|v|j��|vfS)z�wait until some data are available on main or side

        return a pair of boolean (ismainready, issideready)

        (This will only wait for data if the setup is supported by `util.poll`)
        )TT)	�
isinstancer$r�bufferedinputpipeZ	hasbuffer�filenor%Zpoll�NotImplementedError)r&ZfdsZactrrr�_waitIs��
zdoublepipe._waitcCs|�d|�S)Nswrite��_call)r&�datarrr�write_szdoublepipe.writecCs*|�d|�}|dkr&|s&t|j|j�|S)Nsreadr�r/r r#r%�r&�size�rrrr�readbszdoublepipe.readcCs*|�d|�}|dkr&|s&t|j|j�|S)Nsunbufferedreadrr2r3rrr�unbufferedreadmszdoublepipe.unbufferedreadcCs
|�d�S)Nsreadliner.�r&rrr�readlinexszdoublepipe.readlineNcCsp|dur|r|jjr&t|j|j�dS|��\}}|rDt|j|j�|r&t|j|�}|durb|�S||�Sq&dS)zBcall <methname> on "main", forward output of "side" while blockingN�)r$rr r#r%r-r)r&Zmethnamer0Z	mainreadyZ	sideready�methrrrr/{szdoublepipe._callcCs
|j��Sr")r$�closer8rrrr<�szdoublepipe.closecCs|jjSr")r$rr8rrrr�szdoublepipe.closedcCs
|j��Sr")r$�flushr8rrrr=�szdoublepipe.flush)N)�__name__�
__module__�__qualname__�__doc__r(r-r1r6r7r9r/r<�propertyrr=rrrrr!3s

r!c	Cs�d}|r|jsd}|��|r0|js0d}|��|r||js|d}z|D]}|�td�|�qDWnttfyrYn0|��|r�|dur�|�d|�dS)z)Clean up pipes used by an SSH connection.FTrNs.missing close on SSH connection created at:
%s)rr<rr�IOError�
ValueErrorZ	develwarn)rZpipeiZpipeoZpipeerZdidsomethingrrrr�
_cleanuppipes�s"


rEc	CsVd||t�dt|�t|�f�f}|�d|�tj|d|d�\}}}	}
|
|||	fS)z�Create an SSH connection to a server.

    Returns a tuple of (process, stdin, stdout, stderr) for the
    spawned process.
    �%s %s %ss%s -R %s serve --stdio�running %s
r)�bufsize�env)r�
shellquoter�debugZpopen4)r�sshcmd�args�	remotecmd�path�sshenv�cmd�stdin�stdout�stderr�procrrr�_makeconnection�s���	rVcCs6dh}dd�tj�tj�D�}|�dd�|��|S)zwReturn list of capabilities of this client.

    Returns a list of capabilities that are supported by this client.
    spartial-pullcSsg|]}|��j�qSr)Zwireprotosupport�name)�.0�errr�
<listcomp>�s�z'_clientcapabilities.<locals>.<listcomp>scomp=%s�,)rZcompenginesZsupportedwireenginesZ
CLIENTROLE�add�join)Zprotoparams�compsrrr�_clientcapabilities�s�r_cs��fdd�}��dd�}t�tt����}zldd}ddd	t|�|g}|rj��d
���dt|����d���d
�|�d�	|��|�
�Wnty�|�Yn0tj
}	t�dt�|��}
ddg}d}|d�r�|�r�z�|��}
t��dd�|
�|
�}|�r.|�d�}	��d|	�W�q�|ddk�rL|
dk�rLW�q�|
�r^��d|
�|�|
�|d8}Wq�t�y�|�Yq�0q�|�t�}|	tj
k�r�t|�D]8}
|
�d��r�|�|
dd��d�d����q�q�|�s�|�t��dd�|	|fS)Ncs4t��dd�td�}��dd�}tj||d��dS)NT�rs#no suitable response from remote hg�uisssherrorhint��hint)r r�configr�	RepoError)�msgrc�rTrrr�badresponse�sz&_performhandshake.<locals>.badresponse�devel�debug.peer-requests%s-%s)�(0000000000000000000000000000000000000000rkshello
sbetween
s	pairs %d
s"devel-peer-request: hello+between
s&devel-peer-request:   pairs: %d bytes
ssending hello command
ssending between command
r:s^upgraded %s (.*)$sdummyi����Tr`rsprotocol upgraded to %s
s1
rrs
capabilities:�:)�
configboolrZsysbytes�str�uuidZuuid4�lenrKr1r]r=rCr	�SSHV1r�compiler
Zreescaper9r r�group�append�set�reversed�
startswith�update�split)rrRrSrTrhZ
requestlog�tokenZpairsargZ	handshake�	protonameZ
reupgraded�linesZ	max_noiser�m�capsrrgr�_performhandshake�sf@
�





 
r�c@s�eZdZd-dd�ZdhZdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zd.dd�Z
dd�Zd/dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd0d+d,�ZdS)1�	sshv1peerTc		Csh||_||_||_|r4t|t�|�|�}t|||�}||_||_||_||_	||_
d�t�d��|_
dS)a�Create a peer from an existing SSH connection.

        ``proc`` is a handle on the underlying SSH process.
        ``stdin``, ``stdout``, and ``stderr`` are handles on the stdio
        pipes for that process.
        ``caps`` is a set of capabilities supported by the remote.
        ``autoreadstderr`` denotes whether to automatically read from
        stderr and to forward its output.
        r:rN)�_urlrZ_subprocessr!rr*�_pipeo�_pipei�_pipee�_caps�_autoreadstderrr]Zgetstackframes�
_initstack)	r&r�urlrUrRrSrTr�autoreadstderrrrrr(wszsshv1peer.__init__sbatchcCs|jSr")r�r8rrrr��sz
sshv1peer.urlcCsdSr"rr8rrr�local�szsshv1peer.localcCs|Sr"rr8rrr�peer�szsshv1peer.peercCsdS)NTrr8rrr�canpush�szsshv1peer.canpushcCs|��dSr"��_cleanupr8rrrr<�szsshv1peer.closecCs|jSr")r�r8rrr�capabilities�szsshv1peer.capabilitiescCst|j|j�dSr")r rr�r8rrr�_readerr�szsshv1peer._readerrcCs|��|�dSr"r�)r&�	exceptionrrr�_abort�szsshv1peer._abortNcCst|j|j|j|j|d�dS�Nr`)rErr�r�r�)r&rrrrr��szsshv1peer._cleanupcCs|j|jd�dSr�)r�r�r8rrr�__del__�szsshv1peer.__del__FcCs�|jjr�|j�dd�r�|jj}d}|||�t|���D]\\}}t|t�sf||d|t|�f�q:t|���D]"\}}	||d||t|	�f�qrq:|j�d|�|j	�
d|�tj|\}
}|�
�}i}
|D].}|dkr�||
d<�qq�|||
|<||=q�tt�|
��D]v\}}|j	�
d	|t|�f�t|t��r|t�|�D].\}}	|j	�
d	|t|	�f�|j	�
|	��qJn|j	�
|��q|j	��|�r�|��}t�|j|�S|jS)
Nrirjsdevel-peer-request: %s
s  %s: %d bytess  %s-%s: %dssending %s command
s%s
�*s%s %d
)rZ	debugflagrnrK�sorted�itemsr)�dictrqr�r1rZcommandsrzrZ	iteritemsr=�
_getamountrZcappedreaderr�)r&rQrM�framedZdbg�line�key�valueZdkZdvZ_func�names�keysZwireargs�k�v�amountrrr�_sendrequest�sD�

zsshv1peer._sendrequestcKs t�|�}|j||||jvd�S�N�r��r�byteskwargsr��_FRAMED_COMMANDS�r&rQrMrrr�_callstream�s
zsshv1peer._callstreamcKs t�|�}|j||||jvd�Sr�r�r�rrr�_callcompressable�s
zsshv1peer._callcompressablecKst�|�}|j||dd���S)NTr�)rr�r�r6r�rrrr/�s
zsshv1peer._callcsn|j|fi|��}|rd|fSt�fdd�d�D]}|�|�q0|jddd�|��}|rbd|fS|��dfS)Nr:cs
��d�S�Ni�r6r��fprr�<lambda>r:z%sshv1peer._callpush.<locals>.<lambda>T�r=)r/�iter�_writeframed�_readframed�r&rQr�rMr5�drr�r�	_callpush�szsshv1peer._callpushcs^|j|fi|��}|r(t�td�|��t�fdd�d�D]}|�|�q:|jddd�|jS)Nsunexpected remote reply: %scs
��d�Sr�r�rr�rrr�r:z-sshv1peer._calltwowaystream.<locals>.<lambda>r:Tr�)r/rZAbortrr�r�r�r�rr�r�_calltwowaystreamszsshv1peer._calltwowaystreamc	Cs�|j��}|dkr:|jr |��td�}|�tj|d��|jrH|��z
t|�WSt	yz|�t�
td�|��Yn0dS)Nrscheck previous remote outputrbsunexpected response:)r�r9r�r�rr�rZOutOfBandError�intrDZ
ResponseError)r&rrfrrrr�!s

zsshv1peer._getamountcCs|��}|sdS|j�|�S)Nr:)r�r�r6)r&r4rrrr�/szsshv1peer._readframedcCsD|j�dt|��|r$|j�|�|r2|j��|jr@|��dS)Ns%d
)r�r1rqr=r�r�)r&r0r=rrrr�6s
zsshv1peer._writeframed)T)N)F)F)r>r?r@r(r�r�r�r�r�r<r�r�r�r�r�r�r�r�r/r�r�r�r�r�rrrrr�vs.�
"�

-r�Tc	
Cs�zt||||�\}}Wn&ty<t||||dd��Yn0|tjkr`t||||||||d�St||||dd�t�td�|��dS)a�Make a peer instance from existing pipes.

    ``path`` and ``proc`` are stored on the eventual peer instance and may
    not be used for anything meaningful.

    ``stdin``, ``stdout``, and ``stderr`` are the pipes connected to the
    SSH server's stdio handles.

    This function is factored out to allow creating peers that don't
    actually spawn a new process. It is useful for starting SSH protocol
    servers and clients via non-standard means, which can be useful for
    testing.
    Nr`)r�s#unknown version of SSH protocol: %s)	r��	ExceptionrEr	rrr�rrer)	rrOrUrRrSrTr�r|rrrr�makepeer@s(
�
�r�c	Cs�tj|ddd�}|jdks*|jr*|jdur<t�td�|��t�|�|j	dur^t�td���|�
dd�}|�
dd�}t|�d	��}t
�|�}	|jp�d
}
t
�||j|j|j�}|�r |r�t�td���d||t
�d
t|�t|
�f�f}|�d|�|j|d|	d�}
|
dk�r t�td���t|||||
|	�\}}}}t||||||�}d|��v�r�z|jdd�tt���d�Wn*t�y�|��t�td���Yn0|S)ziCreate an SSH peer.

    The returned object conforms to the ``wireprotov1peer.wirepeer`` interface.
    F)Z
parsequeryZ
parsefragmentssshNscouldn't parse location %sspassword in URL not supportedras	remotecmdssshenv�.s8cannot create remote SSH repositories with extra optionsrFs
%s init %srGssshpeer)Z
blockedtag�environrscould not create remote repos	protocaps� )rscapability exchange failed)rr��scheme�hostrOrrerZchecksafessh�passwdrdr�ZconfigitemsrZshellenvironZsshargs�user�portrJrrK�systemrVr�r�r/r]r�r_rCr�)rrOZcreateZintentsZ
createopts�urLrNZ	sshaddenvrPZ
remotepathrMrQ�resrUrRrSrTr�rrr�instancefsZ



�����
��
r�)F)N)T)NN)Z
__future__rrrpZi18nrrr�rrr	r
rZutilsrr
rrr �objectr!rErVr_r�Zwirepeerr�r�r�rrrr�<module>s$ 	
d
K
&

Youez - 2016 - github.com/yon3zu
LinuXploit