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/spread/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/twisted/spread/__pycache__/banana.cpython-310.pyc
o

�b�/�@s�dZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZGd	d
�d
e�Zdd�Zd
d�ZdZdZdZdZdZdZdZdZdZdd�Zdaed�dZGdd�dejej �Z!e!�Z"e"�#�e"�$d�dd�Z%d d!�Z&dS)"z�
Banana -- s-exp based protocol.

Future Plans: This module is almost entirely stable.  The same caveat applies
to it as applies to L{twisted.spread.jelly}, however.  Read its future plans
for more details.

@author: Glyph Lefkowitz
�N)�BytesIO)�protocol)�styles)�log)�	iterbytes)�fullyQualifiedNamec@seZdZdS)�BananaErrorN)�__name__�
__module__�__qualname__�rr�7/usr/lib/python3/dist-packages/twisted/spread/banana.pyrsrcCsN|dkr
|d�dS|dksJd��|r%|t|d@f��|d?}|sdSdS)Nr�z!can only encode positive integers��)�bytes)�integer�streamrrr
�int2b128s�rcCs6d}d}t|�D]}t|�}|||7}|dK}q|S)z�
    Convert an integer represented as a base 128 string into an L{int}.

    @param st: The integer encoded in a byte string.
    @type st: L{bytes}

    @return: The integer value extracted from the byte string.
    @rtype: L{int}
    �rr)r�ord)�st�e�i�char�nrrr
�b1282int)s

r����������������cCs|adS)ak
    Set the limit on the prefix length for all Banana connections
    established after this call.

    The prefix length limit determines how many bytes of prefix a banana
    decoder will allow before rejecting a potential object as too large.

    @type limit: L{int}
    @param limit: The number of bytes of prefix for banana to allow when
    decoding.
    N)�
_PREFIX_LIMIT)�limitrrr
�setPrefixLimitKs
r'�@i
c@s(eZdZdZddgZdZeZdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dZdd�Zdd�Zidd�dd�dd�dd�dd�d d!�d"d#�d$d%�d&d'�d(d)�d*d+�d,d-�d.d/�d0d1�d2d3�d4d5�d6d7�d8d9d:d;d<d=d>d?d@dAdBdCdDdEdF��ZiZe��D]\ZZeee<q|dMdGdH�ZdIdJ�ZdKdL�ZdS)N�Bananaz�
    L{Banana} implements the I{Banana} s-expression protocol, client and
    server.

    @ivar knownDialects: These are the profiles supported by this Banana
        implementation.
    @type knownDialects: L{list} of L{bytes}
    �pb�noneNcCs<||_d|dd|_d|_d|_d|dd|_dS)zt
        Set the prefix limit for decoding done by this protocol instance.

        @see: L{setPrefixLimit}
        �rri�i���N)�prefixLimit�_smallestLongInt�_smallestInt�_largestInt�_largestLongInt)�selfr&rrr
r'rs
zBanana.setPrefixLimitcCsdS)zPSurrogate for connectionMade
        Called after protocol negotiation.
        Nr�r2rrr
�connectionReady~szBanana.connectionReadycCs||_|��dS�N)�currentDialectr4)r2�dialectrrr
�_selectDialect�szBanana._selectDialectcCs�|jr
|�|�dS|jr0|D]}||jvr#|�|�|�|�dSqt�d�|j�	�dS||jvr<|�|�dSt�d�|j�	�dS)NzSThe client doesn't speak any of the protocols offered by the server: disconnecting.zYThe client selected a protocol the server didn't suggest and doesn't know: disconnecting.)
r6�expressionReceived�isClient�
knownDialects�sendEncodedr8r�msg�	transport�loseConnection)r2�obj�	serverVerrrr
�callExpressionReceived�s&


��
�zBanana.callExpressionReceivedcCs*|�t�d|_|js|�|j�dSdSr5)r'r%r6r:r<r;r3rrr
�connectionMade�s

�zBanana.connectionMadecCs.|j}|r|dd�|�dS|�|�dS)N���r)�	listStack�appendrB)r2�item�lrrr
�gotItem�szBanana.gotItem�cCs�|j|}|j}|j}|�re|j|ks Jd�t|j�t|����||_d}t|�D]}|tkr1n|d}q)||jkrCtd|jf��dS|d|�}|||d�}||dd�}	t	|�|jkrjtd|jf��|t
kr�t|�}|tkrztd��|�
|gf�|	}n�|tkr�t|�}|tkr�td��t	|	�|kr�|	|d�}||	d|��n�dS|tkr�|	}t|�}||�n{|tkr�|	}t|�}||�nl|tkr�|	}t|�}||�n\|tkr�|	}t|�}||�nL|tk�r|	}t|�}|j|}
|jdk�r||
�n1td	|
����|tk�r.t	|	�d
k�r,|	d
d�}|t�d|	dd
��d�n	dStd|����|�rct	|d
d�|d
dk�rc|��d}
||
�|�rct	|d
d�|d
dk�sG|sd|_dS)NzThis ain't right: {} {}rrz1Security precaution: more than %d bytes of prefixz9Security precaution: longer than %d bytes worth of prefixz#Security precaution: List too long.z%Security precaution: String too long.r*zInvalid item for pb protocol ��!dzInvalid Type Byte rDrJ)�bufferrErI�format�reprr�HIGH_BIT_SETr-r�len�LISTr�
SIZE_LIMITrF�STRING�INT�LONGINT�LONGNEG�NEG�VOCAB�incomingVocabularyr6�NotImplementedError�FLOAT�struct�unpack�pop)r2�chunkrMrErI�pos�ch�num�typebyte�restrGrrr
�dataReceived�s�
�

����







$$��
MzBanana.dataReceivedcCst��)z=Called when an expression (list, string, or int) is received.)r[)r2�lstrrr
r9szBanana.expressionReceivedsNonersclassr,sdereference�s	reference�s
dictionary�sfunction�sinstancerslistrKsmodule�	s
persistent�
stuple�s
unpersistable�scopy�
scache�scached�sremote�slocal���������������)slcachesversionsloginspasswords	challenges	logged_ins
not_logged_inscachemessagesmessagesanswerserrorsdecrefsdecachesuncachecCs$g|_t�|j�|_d|_||_dS)Nr)rE�copy�outgoingVocabulary�outgoingSymbols�outgoingSymbolCountr:)r2r:rrr
�__init__4s
zBanana.__init__cCs,t�}|�||j�|��}|j�|�dS)a
        Send the encoded representation of the given object:

        @param obj: An object to encode and send.

        @raise BananaError: If the given object is not an instance of one of
            the types supported by Banana.

        @return: L{None}
        N)r�_encode�write�getvaluer>)r2r@�encodeStream�valuerrr
r<:szBanana.sendEncodedcCs�t|ttf�r.t|�tkrtdt|�f��tt|�|�|t�|D]}|�||�q#dSt|t	�r�||j
ks=||jkrDtd|f��||jkrUt||�|t
�dS|dkret||�|t�dS||jkrut||�|t�dSt||�|t�dSt|t�r�|t�|t�d|��dSt|t�r�|jdkr�||jvr�|j|}t||�|t�dSt|�tkr�tdt|�f��tt|�|�|t�||�dStd�tt|��|���)Nz#list/tuple is too long to send (%d)zint is too large to send (%d)rrLr*z$byte string is too long to send (%d)z#Banana cannot send {} objects: {!r})�
isinstance�list�tuplerQrSrrrRr��intr.r1r/rWrXr0rUrV�floatr\r]�packrr6r�rYrTrNr�type)r2r@r��elem�symbolIDrrr
r�JsT�








���zBanana._encode)r)r	r
r�__doc__r;r-rS�	sizeLimitr'r4r8rBrCrIrMrfr9r�rZ�items�k�vr�r<r�rrrr
r)as�S�������	�
���
�������%

r)r+cCst�}|t_t�|�|��S)zEncode a list s-expression.)r�_ir>r<r�)rgr�rrr
�encode�s
r�cCs8g}|jt_zt�|�Wdt_t`|dSdt_t`w)z)
    Decode a banana-encoded string.
    rJr)rFr�r9rfrM)rrHrrr
�decode�s�r�)'r�r�r]�ior�twisted.internetr�twisted.persistedr�twisted.pythonr�twisted.python.compatr�twisted.python.reflectr�	ExceptionrrrrRrUrTrXr\rVrWrYrPr'r%rS�Protocol�	Ephemeralr)r�rCr8r�r�rrrr
�<module>sB



Spamworldpro Mini