%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/mail/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/mail/test/__pycache__/pop3testserver.cpython-312.pyc

�

Ϫ�f����ddlZddlmZddlmZddlmZdZdZdZ	da
dad	ad	a
d	ad	ad	ad	ad	ad	ad	a	d
Zgd�ZdZd
ZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#Gd�dejH�Z%dZ&d�Z'd�Z(d�Z)e*dk(re)�yy) �N)�reactor)�Factory)�basic�test�twistediLTFs(+OK POP3 localhost v2003.83 server ready)sTOPsLOGIN-DELAY 180�USERs
SASL LOGIN�STLS�UIDLs-ERR Unknown requests+OK Command Completeds-ERR LOGIN faileds+OK Mailbox open, 0 messagess*-ERR server side error start TLS handshakes+OK quit completeds'-ERR Unknown AUHORIZATION state commands+OK 0 0s +OK Unique-ID listing follows
.s#+OK Mailbox scan listing follows
.s+OK Capability list follows:c�J�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zy)
�POP3TestServerNc�<�d|_d|_d|_||_y)NF)�loggedIn�caps�tmpUser�ctx)�self�contextFactorys  �B/usr/lib/python3/dist-packages/twisted/mail/test/pop3testserver.py�__init__zPOP3TestServer.__init__6s����
���	����!���c�.�|jt�y�N)�sendLine�STAT�r�reqs  r�sendSTATRespzPOP3TestServer.sendSTATResp<����
�
�d�rc�.�|jt�yr)r�UIDLrs  r�sendUIDLRespzPOP3TestServer.sendUIDLResp?rrc�.�|jt�yr)r�LISTrs  r�sendLISTRespzPOP3TestServer.sendLISTRespBrrc�v�|j�tg|_tr|jjt�t
r|jjt�tD]}|jj|��dj|j�}|dz
}|j|�y)Ns
s
.)
r�	CAP_START�UIDL_SUPPORT�append�CAPABILITIES_UIDL�SSL_SUPPORT�CAPABILITIES_SSL�CAPABILITIES�joinr)r�cap�resps   r�sendCapabilitieszPOP3TestServer.sendCapabilitiesEs����9�9��"��D�I���I�I���.�/���I�I���-�.��	"�C��I�I���S�!�	"��|�|�D�I�I�&�������
�
�d�rc��tr|j�ytr!tjd|j
�y|j�y)N�)�DENY_CONNECTION�
disconnect�
SLOW_GREETINGr�	callLater�sendGreeting�rs r�connectionMadezPOP3TestServer.connectionMadeVs9����O�O�������b�$�"3�"3�4�
���rc�.�|jt�yr)r�CONNECTION_MADEr8s rr7zPOP3TestServer.sendGreetingas���
�
�o�&rc�@��|j���fd�}trytr|j�y|d�r-tr|jt�y|j�y|d�rtr|j�y|d�rPtr|jt�yd}	|jd�d|_t}|j|�y|d�rnd}	|jd�d}|j�|�t}n0|jt k(r|t"k(rt$}d	|_nt}|j|�y|d
�r-d|_|jt(�|j�yt*r|jt�y|j&s|jt,�y|d�r|jt�y|d
�rt.ry|jt0�y|d�rt.ry|jt2�y|d�r9t.ryt4s|jt�y|jt6�yy#t$r
t}Y���wxYw#t$r
t}Y��WwxYw)zError Conditionsc�,���j|�dk7S)N���)�find)�s�ulines �r�<lambda>z-POP3TestServer.lineReceived.<locals>.<lambda>hs������A��"�,�rNsCAPAr	r� �sPASSTsQUITFsNOOPsSTATsLISTr
)�upper�TIMEOUT_RESPONSE�DROP_CONNECTIONr4�INVALID_CAPABILITY_RESPONSEr�INVALID_RESPONSEr0r*�startTLS�INVALID_LOGIN_RESPONSE�splitr�VALID_RESPONSE�
BaseException�
AUTH_DECLINED�USER�PASS�
AUTH_ACCEPTEDr�LOGOUT_COMPLETE�INVALID_SERVER_RESPONSE�
NOT_LOGGED_IN�TIMEOUT_DEFERREDrr#r'r )r�liner?r/�pwdrAs     @r�lineReceivedzPOP3TestServer.lineReceivedds�����
�
���,������O�O���
�'�]�*��
�
�.�/��%�%�'�
�'�]�{��M�M�O�
�'�]�%��
�
�.�/���D�
%�#�z�z�#��q�1���%��
�M�M�$��
�'�]��D�
%��j�j��o�a�(���<�<�'�3�;�(�D��\�\�T�)�c�T�k�(�D�$(�D�M�(�D�
�M�M�$��
�'�]�!�D�M��M�M�/�*��O�O��
$��M�M�*�+�����M�M�-�(�
�'�]��M�M�.�)�
�'�]����M�M�$��
�'�]����M�M�$��
�'�]���!��
�
�.�/���M�M�$����]!�
%�$��
%��"!�
%�$��
%�s%�0I4�,AJ
�4J�J�
J�Jc��trC|j�7|jd�|jj	|j�y|jd�y)Ns+OK Begin TLS negotiation nows-ERR TLS not available)r*rr�	transportrJr8s rrJzPOP3TestServer.startTLS�s>���4�8�8�/��M�M�:�;��N�N�#�#�D�H�H�-��M�M�3�4rc�8�|jj�yr)r[�loseConnectionr8s rr4zPOP3TestServer.disconnect�s�����%�%�'rr)
�__name__�
__module__�__qualname__rrr!r$r0r9r7rYrJr4�rrrr5s6��"�����"	 �'�U �n5�(rra�popServer.py [arg] (default is Standard POP Server with no messages)
no_ssl  - Start with no SSL support
no_uidl - Start with no UIDL support
bad_resp - Send a non-RFC compliant response to the Client
bad_cap_resp - send a non-RFC compliant response when the Client sends a 'CAPABILITY' request
bad_login_resp - send a non-RFC compliant response when the Client sends a 'LOGIN' request
deny - Deny the connection
drop - Drop the connection after sending the greeting
bad_tls - Send a bad response to a STARTTLS
timeout - Do not return a response to a Client request
to_deferred - Do not return a response on a 'Select' request. This
              will test Deferred callback handling
slow - Wait 20 seconds after the connection is made to return a Server Greeting
c� �td|z�y)NzServer Starting in %s mode)�print)�msgs r�printMessagere�s��	�
&��
,�-rc��|j�dk(rdatd�y|j�dk(rdatd�y|j�dk(rdatd�y|j�d	k(rdatd
�y|j�dk(rdatd
�y|j�dk(rdatd
�y|j�dk(rdatd�y|j�dk(rda	td�y|j�dk(rda
td�y|j�dk(rdatd�y|j�dk(rdatd�y|j�dk(r$tt�tj �ytt�tj �y)N�no_sslFzNON-SSL�no_uidlzNON-UIDL�bad_respTzInvalid Server Response�bad_cap_respzInvalid Capability Response�bad_login_resp�denyzDeny Connection�dropzDrop Connection�bad_tlszBad TLS Response�timeoutzTimeout Response�to_deferredzTimeout Deferred Response�slowz
Slow Greetingz--help)�lowerr*rer'rTrHrKr3rG�BAD_TLS_RESPONSErFrVr5rc�usage�sys�exit)�args r�
processArgrx�sj��
�y�y�{�h�����Y��	����	�	!����Z� �	����
�	"�"&���.�/�	�����	&�&*�#��2�3�	����(�	(�!%���2�3�	�����	����&�'�	�����	����&�'�	����	�	!����'�(�	����	�	!����'�(�	����
�	%����0�1�	�����	��
��_�%�	�����	 �
�e�����
�	�e�����
rc�$�ttj�dkrtd�n%tjdd}|D]
}t	|��t�}t|_tjt|�tj�y)N�zPOP3 with no messagesrD)�lenru�argvrerxrr�protocolr�	listenTCP�PORT�run)�argsrw�fs   r�mainr�si��
�3�8�8�}�q���,�-��x�x���|���	�C��s�O�	�	�	�A��A�J����d�A���K�K�Mr�__main__)+ru�twisted.internetr�twisted.internet.protocolr�twisted.protocolsrrPrQrr*r'rTrHrKr3rGrsrFrVr5r;r,r+r)rIrMrOrR�	TLS_ERRORrSrUrr r#r&�LineReceiverrrtrerxr�r^rarr�<module>r�s����$�-�#�
������������#���������������
��=��C������+��)��$�
�/�
�9�	�'��:�
���,��/��+�	�N(�U�'�'�N(�b
	�� .�>�B��z���F�r

Zerion Mini Shell 1.0