ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/imaplib.cpython-311.opt-2.pyc

�

�fQ���j�	dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
m
Z
mZmZddl
mZ	ddlZdZn
#e$rdZYnwxYwgd�ZdZdZd	Zd
ZdZdZid
d�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�d d�d!d�d"d�id#d�d$d�d%d�d&d�d'd�d(d�d)d�d*d�d+d�d,d�d-d�d.d�d/d�d0d�d1d�d2d�d3d��ddddddddd4��Zejd5��Zejd6��Zejd7��Zejd8ej��Zejd9��Z ejd:��Z!ejd;��Z"ejd<ej��Z#d8Z$d<Z%Gd=�d>��Z&er#Gd?�d@e&��Z'e�(d@��GdA�dBe&��Z)GdC�dD��Z*dE�+dF��Z,dG�e-e,dHd���D��Z.dI�Z/dJ�Z0dK�Z1dL�Z2e3dMk�r?ddl4Z4ddl5Z5	e4j4ej6dHd�dN��\Z7Z8n#e4j9$rZ:dO\Z7Z8YdZ:[:ndZ:[:wwxYwdZ;e7D]$\Z<Z:e<dPkre=e:��Z�e<dQkre:Z;e8se;fZ8�%e8sdRZ8e8dZ>e5j?��Z@e5j5dSe@�dTe>pdU�dV���ZAdWe@dXdY�zZBdZe@eAffd[d\d]d^d_ddeBffd`dadbdcdddedfdgdhfZCdidjdkdld^dddeBffdgdmfZDdn�ZE	e;re)e;��ZFne&e>��ZFeFjGdokr
eCdHd�ZCeF�HdpeFjIz��eF�HdqeFjJ����eCD]\ZKZ8eEeKe8���eEdrds��D]RZLejMdteL��ZNeNreN�OdH��ZPneL�+��duZPeEdvePf���SeDD]O\ZKZ8eEeKe8��ZQeKe8fdkkr�eQdu�+��ZReRs�7eEdwddxeRduzdyf���PeSdz��dS#eSd{��eseSd|ej6dz���xYwdS)}z2.58�N)�datetime�timezone�	timedelta)�DEFAULT_BUFFER_SIZETF)�IMAP4�IMAP4_stream�Internaldate2tuple�Int2AP�
ParseFlags�Time2Internaldate�
�i�)�	IMAP4REV1ri@B�APPEND)�AUTH�SELECTED�AUTHENTICATE)�NONAUTH�
CAPABILITY)rrr�LOGOUT�CHECK)r�CLOSE�COPY�CREATE�DELETE�	DELETEACL�ENABLE)r�EXAMINE�EXPUNGE�FETCH�GETACL�
GETANNOTATION�GETQUOTA�GETQUOTAROOT�MYRIGHTS�LIST�LOGINr�LSUB�MOVE�	NAMESPACE�NOOP�PARTIAL�	PROXYAUTH�RENAME�SEARCH�SELECT�SETACL�
SETANNOTATION�SETQUOTA�SORT)�STARTTLS�STATUS�STORE�	SUBSCRIBE�THREAD�UID�UNSUBSCRIBE�UNSELECTs\+( (?P<data>.*))?s.*FLAGS \((?P<flags>[^\)]*)\)s�.*INTERNALDATE "(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9]) (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9]) (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])"s.*{(?P<size>\d+)}$s
\r\n|\r|\ns%\[(?P<type>[A-Z-]+)( (?P<data>.*))?\]s$\* (?P<type>[A-Z-]+)( (?P<data>.*))?s3\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?c�.�eZdZ	Gd�de��ZGd�de��ZGd�de��Zdedfd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zdedfd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Z d"�Z!d#�Z"d$�Z#d%�Z$d&�Z%d'�Z&d(�Z'dYd+�Z(d,�Z)d-�Z*d.�Z+d/�Z,dYd0�Z-d1�Z.d2�Z/d3�Z0d4�Z1d5�Z2d6�Z3d7�Z4dZd:�Z5d;�Z6d<�Z7d=�Z8d>�Z9d[d?�Z:d@�Z;dA�Z<dB�Z=dC�Z>dD�Z?dE�Z@dF�ZAdG�ZBdH�ZCdI�ZDdJ�ZEdK�ZFdL�ZGdM�ZHd\dN�ZIdO�ZJdP�ZKdQ�ZLdR�ZMdS�ZNdT�ZOdS)]rc��eZdZdS)�IMAP4.errorN��__name__�
__module__�__qualname__���./opt/alt/python311/lib64/python3.11/imaplib.py�errorr?���������rErGc��eZdZdS)�IMAP4.abortNr@rDrErF�abortrJ�rHrErKc��eZdZdS)�IMAP4.readonlyNr@rDrErF�readonlyrM�rHrErN�Nc�x�t|_d|_d|_i|_i|_d|_d|_d|_d|_	|�
��|�|||��	|���dS#t$r(	|���n#t$rYnwxYw�wxYw)NrrOFr)�Debug�debug�state�literal�tagged_commands�untagged_responses�continuation_response�is_readonly�tagnum�_tls_established�_mode_ascii�open�_connect�	Exception�shutdown�OSError��self�host�port�timeouts    rF�__init__zIMAP4.__init__�s�����
���
����!���"$���%'��"� ������ %���������	
�	�	�$��g�&�&�&�	��M�M�O�O�O�O�O���	�	�	�
��
�
�������
�
�
���
�����	���s0�1B�
B9�B'�&B9�'
B4�1B9�3B4�4B9c���d|_d|_tjttj��|_tjttj��|_dS)NF�ascii)	�utf8_enabled�	_encoding�re�compile�_Literal�ASCII�Literal�_Untagged_status�Untagged_status�rbs rFr[zIMAP4._mode_ascii�sC��!��� ����z�(�B�H�5�5���!�z�*:�B�H�E�E����rEc��d|_d|_tjt��|_tjt��|_dS)NT�utf-8)rirjrkrlrmrorprqrrs rF�
_mode_utf8zIMAP4._mode_utf8�s;�� ��� ����z�(�+�+���!�z�*:�;�;����rEc���ttjdd����|_t	jd|jzdztj��|_	|���|_d|jvrd|_n+d
|jvrd|_n|�|j���|���	t*D]}||jvr�||_dS|�d���)Nii��s(?P<tag>s"\d+) (?P<type>[A-Z]+) (?P<data>.*)F�
r�zimaplib version %sznew IMAP4 connection, tag=%s�PREAUTHr�OKr�zCAPABILITIES: zserver not IMAP4 compliant)r
�random�randint�tagprerkrlrn�tagre�_cmd_log_len�_cmd_log_idx�_cmd_logrR�_mesg�__version__�
_get_response�welcomerVrSrG�_get_capabilities�capabilities�AllowedVersions�PROTOCOL_VERSION)rb�versions  rFr]zIMAP4._connect�s���V�^�D�%�8�8�9�9����Z���+�!&�@�!A�BD�(�L�L��
�	I��)�)�+�+�����/�/�/��D�J�J�
�T�,�
,�
,�"�D�J�J��*�*�T�\�*�*�*���� � � �	F�'�	�	�G��d�/�/�/��$+�D�!��F�F��j�j�5�6�6�6rEc�|�|tvr"t||�����Std|z���)NzUnknown IMAP4 command: '%s')�Commands�getattr�lower�AttributeError)rb�attrs  rF�__getattr__zIMAP4.__getattr__
s9���8����4������.�.�.��:�T�A�B�B�BrEc��|S�NrDrrs rF�	__enter__zIMAP4.__enter__s���rEc�l�|jdkrdS	|���dS#t$rYdSwxYw�Nr)rS�logoutr`)rb�argss  rF�__exit__zIMAP4.__exit__sL���:��!�!��F�	��K�K�M�M�M�M�M���	�	�	��D�D�	���s�%�
3�3c���|�|std���|jsdn|j}tjd||j|j��||jf}|�tj||��Stj|��S)Nz0Non-blocking socket (timeout=0) is not supportedzimaplib.open)�
ValueErrorrc�sys�auditrd�socket�create_connection)rbrerc�addresss    rF�_create_socketzIMAP4._create_socket#s�����w���O�P�P�P��9�3�t�t�$�)���	�.�$��	�4�9�=�=�=����#�����+�G�W�=�=�=��'��0�0�0rEc��	||_||_|�|��|_|j�d��|_dS)N�rb)rcrdr��sock�makefile�fileras    rFr\z
IMAP4.open0sG��	�
��	���	��'�'��0�0��	��I�&�&�t�,�,��	�	�	rEc�8�	|j�|��Sr�)r��read�rb�sizes  rFr�z
IMAP4.read<s��,��y�~�~�d�#�#�#rEc��	|j�tdz��}t|��tkr|�dtz���|S)Nrxzgot more than %d bytes)r��readline�_MAXLINE�lenrG�rb�lines  rFr�zIMAP4.readlineAsL��$��y�!�!�(�Q�,�/�/���t�9�9�x����*�*�5��@�A�A�A��rEc�h�	tjd||��|j�|��dS)Nzimaplib.send)r�r�r��sendall�rb�datas  rF�sendz
IMAP4.sendIs5��"��	�.�$��-�-�-��	���$�����rEc�x�	|j���	|j�tj��nB#t$r5}|jtjkrt|dd��dkr�Yd}~nd}~wwxYw|j���dS#|j���wxYw)N�winerrorri&')
r��closer�r_r��	SHUT_RDWRr`�errno�ENOTCONNr�)rb�excs  rFr_zIMAP4.shutdownOs���.��	������
	��I���v�/�0�0�0�0���	�	�	��	�U�^�+�+��3�
�A�.�.�%�7�7�����������
	����
�I�O�O�������D�I�O�O�������s/�$A�B�
B�+A;�6B�;B�B�B9c��	|jSr�)r�rrs rFr�zIMAP4.socket_s��	��y�rEc��	d}|�ddg|��\}}|dr||fS|���\}}|�|||��S)N�RECENTrz���)�_untagged_response�noop�rb�name�typ�dats    rF�recentzIMAP4.recentksi��	����*�*�4�$���>�>���S��r�7�	���8�O��9�9�;�;���S��&�&�s�C��6�6�6rEc�X�	|�|dg|�����Sr�)r��upper)rb�codes  rF�responsezIMAP4.response|s+��	��&�&�t�d�V�T�Z�Z�\�\�B�B�BrEc��	d}|sd}|r|d|dfdkrd|z}nd}|rt|��}nd}t�t|��}|jrd|zdz}||_|�||||��S)	Nr�INBOXrr���(�)�(%s)sUTF8 (�))r�MapCRLF�sub�CRLFrirT�_simple_command)rb�mailbox�flags�	date_time�messager�rTs       rF�appendzIMAP4.append�s���	����	��G��	��a���r��#�y�0�0�������E��	�)�)�4�4�I�I��I��+�+�d�G�,�,����	1��'�)�D�0�G�����#�#�D�'�5�)�D�D�DrEc��	|���}t|��j|_|�d|��\}}|dkr/|�|d�dd�����d|_||fS)Nrrzr�rt�replacer)r��_Authenticator�processrTr�rG�decoderS)rb�	mechanism�
authobject�mechr�r�s      rF�authenticatezIMAP4.authenticate�s���	���� � ��
&�j�1�1�9����'�'���=�=���S��$�;�;��*�*�S��W�^�^�G�Y�?�?�@�@�@���
��C�x�rEc�f�	d}|�|��\}}|�|||��S)Nr�r�r�r�s    rF�
capabilityzIMAP4.capability�s=��	0����'�'��-�-���S��&�&�s�C��6�6�6rEc�.�	|�d��S)Nr�r�rrs rF�checkzIMAP4.check�s��	��#�#�G�,�,�,rEc�f�		|�d��\}}d|_n#d|_wxYw||fS)Nrr�r�rS�rbr�r�s   rFr�zIMAP4.close�sH��	�	 ��+�+�G�4�4�H�C���D�J�J���D�J������C�x���#�	,c�2�	|�d||��S)Nrr�)rb�message_set�new_mailboxs   rF�copyz
IMAP4.copy�s!��	��#�#�F�K��E�E�ErEc�0�	|�d|��S)Nrr��rbr�s  rF�createzIMAP4.create����	��#�#�H�g�6�6�6rEc�0�	|�d|��S)Nrr�r�s  rF�deletezIMAP4.delete�r�rEc�2�	|�d||��S)Nrr�)rbr��whos   rF�	deleteaclzIMAP4.deleteacl�s!��	��#�#�K��#�>�>�>rEc���	d|jvrt�d���|�d|��\}}|dkr*d|���vr|���||fS)NrzServer does not support ENABLErzzUTF8=ACCEPT)r�rrGr�r�ru)rbr�r�r�s    rF�enablezIMAP4.enable�s|��	��4�,�,�,��+�+�>�?�?�?��(�(��:�>�>�	��T��$�;�;�=�J�,<�,<�,>�,>�>�>��O�O�����D�y�rEc�f�	d}|�|��\}}|�|||��S)Nrr�r�s    rF�expungez
IMAP4.expunges=��	����'�'��-�-���S��&�&�s�C��6�6�6rEc�j�	d}|�|||��\}}|�|||��S)Nr r�)rbr��
message_partsr�r�r�s      rF�fetchzIMAP4.fetchsA��	����'�'��k�=�I�I���S��&�&�s�C��6�6�6rEc�d�	|�d|��\}}|�||d��S)Nr!�ACLr��rbr�r�r�s    rF�getaclzIMAP4.getacl(s:��	��'�'��'�:�:���S��&�&�s�C��7�7�7rEc�h�	|�d|||��\}}|�||d��S)Nr"�
ANNOTATIONr�)rbr��entry�	attributer�r�s      rF�
getannotationzIMAP4.getannotation1s>��	!��'�'���%��S�S���S��&�&�s�C��>�>�>rEc�d�	|�d|��\}}|�||d��S)Nr#�QUOTAr�)rb�rootr�r�s    rF�getquotazIMAP4.getquota9s:��	��'�'�
�D�9�9���S��&�&�s�C��9�9�9rEc��	|�d|��\}}|�||d��\}}|�||d��\}}|||gfS)Nr$r�	QUOTAROOTr�)rbr�r�r��quota�	quotaroots      rF�getquotarootzIMAP4.getquotarootDsh��	��'�'���@�@���S��,�,�S�#�w�?�?�
��U��0�0��c�;�G�G���Y��Y��&�&�&rE�""�*c�j�	d}|�|||��\}}|�|||��S)Nr&r��rb�	directory�patternr�r�r�s      rF�listz
IMAP4.listO�A��	����'�'��i��A�A���S��&�&�s�C��6�6�6rEc��	|�d||�|����\}}|dkr|�|d���d|_||fS)Nr'rzr�r)r��_quoterGrS)rb�user�passwordr�r�s     rF�loginzIMAP4.login[s_��	��'�'���t�{�{�8�7L�7L�M�M���S��$�;�;��*�*�S��W�%�%�%���
��C�x�rEc�X�	||c|_|_|�d|j��S)NzCRAM-MD5)r r!r��_CRAM_MD5_AUTH)rbr r!s   rF�login_cram_md5zIMAP4.login_cram_md5is2��	�$(�� ��	�4�=�� � ��T�-@�A�A�ArEc���	ddl}t|jt��r|j�d��n|j}|jdz|�||d�����zS)Nrrt� �md5)�hmac�
isinstancer!�str�encoder �HMAC�	hexdigest)rb�	challenger)�pwds    rFr$zIMAP4._CRAM_MD5_AUTHrso��?�����0:�4�=�#�0N�0N�@�t�}�#�#�G�,�,�,�26�-�	��y�3�����3�	�5�!A�!A�!K�!K�!M�!M�M�MrEc�r�	d|_|�d��\}}|���||fSr�)rSr�r_r�s   rFr�zIMAP4.logoutzs=��	���
��'�'��1�1���S��
�
�����C�x�rEc�j�	d}|�|||��\}}|�|||��S)Nr(r�rs      rF�lsubz
IMAP4.lsub�rrEc�d�	|�d|��\}}|�||d��S)Nr%r�rs    rF�myrightszIMAP4.myrights�s:��	��&�&�z�7�;�;���C��&�&�s�C��<�<�<rEc�f�	d}|�|��\}}|�|||��S)Nr*r�r�s    rF�	namespacezIMAP4.namespace�s=��	����'�'��-�-���S��&�&�s�C��6�6�6rEc�0�		|�d��S)NFr{r+)rR�_dump_urrVr�rrs rFr�z
IMAP4.noop�s"��	�	7��#�#�F�+�+�+rEc�n�	d}|�|||||��\}}|�||d��S)Nr,r r�)rb�message_num�message_part�start�lengthr�r�r�s        rF�partialz
IMAP4.partial�sF��	����'�'��k�<��PV�W�W���S��&�&�s�C��9�9�9rEc�4�	d}|�d|��S)Nr-r�)rbr r�s   rF�	proxyauthzIMAP4.proxyauth�s$��	����#�#�K��6�6�6rEc�2�	|�d||��S)Nr.r�)rb�
oldmailbox�
newmailboxs   rF�renamezIMAP4.rename�s!��	��#�#�H�j�*�E�E�ErEc���	d}|r5|jrt�d���|j|d|g|�R�\}}n|j|g|�R�\}}|�|||��S)Nr/z'Non-None charset not valid in UTF8 mode�CHARSET)rirrGr�r�)rb�charset�criteriar�r�r�s      rF�searchzIMAP4.search�s���	����	=�� �
M��k�k�"K�L�L�L�+�t�+�D�)�W�P�x�P�P�P�H�C���+�t�+�D�<�8�<�<�<�H�C���&�&�s�C��6�6�6rEr�Fc��	i|_||_|rd}nd}|�||��\}}|dkrd|_||fSd|_d|jvr|s	|�d	|z���||j�d
dg��fS)Nrr0rzrr�	READ-ONLYFrxz%s is not writable�EXISTS)rVrXr�rSrRr9rN�get)rbr�rNr�r�r�s      rF�selectzIMAP4.select�s���
	�#%���#����	��D�D��D��'�'��g�6�6���S��$�;�;��D�J���8�O���
��$�1�1�1� �2�
;��-�-� 4�w� >�?�?�?��D�+�/�/��4�&�A�A�A�ArEc�4�	|�d|||��S)Nr1r�)rbr�r��whats    rF�setaclzIMAP4.setacls#��	��#�#�H�g�s�D�A�A�ArEc�T�	|jdg|�R�\}}|�||d��S)Nr2r	r�)rbr�r�r�s    rF�
setannotationzIMAP4.setannotation
s?��	�(�4�'��?�$�?�?�?���S��&�&�s�C��>�>�>rEc�f�	|�d||��\}}|�||d��S)Nr3rr�)rbr�limitsr�r�s     rF�setquotazIMAP4.setquotas<��	��'�'�
�D�&�A�A���S��&�&�s�C��9�9�9rEc��	d}|d|dfdkrd|z}|j|||g|�R�\}}|�|||��S)Nr4rr�r�r�r�)rb�
sort_criteriarH�search_criteriar�r�r�s       rF�sortz
IMAP4.sortsn��	���
�!��]�2�.�/�9�<�<�"�]�2�M�'�4�'��m�W�W��W�W�W���S��&�&�s�C��6�6�6rEc�2�d}ts|�d���|jr|�d���||jvr|�d���|�tj��}|�|��\}}|dkra|�|j	|j
���|_	|j	�d��|_d|_|�
��n|�d	���|�|||��S)
Nr5zSSL support missingzTLS session already establishedzTLS not supported by serverrz��server_hostnamer�TzCouldn't establish TLS session)�HAVE_SSLrGrZrKr��ssl�_create_stdlib_contextr��wrap_socketr�rcr�r�r�r�)rb�ssl_contextr�r�r�s     rF�starttlszIMAP4.starttls)s�����	4��*�*�2�3�3�3�� �	@��*�*�>�?�?�?��t�(�(�(��*�*�:�;�;�;����4�6�6�K��'�'��-�-���S��$�;�;�#�/�/��	�@D�	�0�K�K�D�I��	�*�*�4�0�0�D�I�$(�D�!��"�"�$�$�$�$��*�*�=�>�>�>��&�&�s�C��6�6�6rEc�j�	d}|�|||��\}}|�|||��S)Nr6r�)rbr��namesr�r�r�s      rF�statuszIMAP4.status@sC��	����'�'��g�u�=�=���S��&�&�s�C��6�6�6rEc��	|d|dfdkrd|z}|�d|||��\}}|�||d��S)Nrr�r�r�r7r r�)rbr��commandr�r�r�s      rF�storezIMAP4.storeLs_��	�
�!�H�U�2�Y��9�,�,��U�N�E��'�'���g�u�M�M���S��&�&�s�C��9�9�9rEc�0�	|�d|��S)Nr8r�r�s  rF�	subscribezIMAP4.subscribeWs��	��#�#�K��9�9�9rEc�\�	d}|j|||g|�R�\}}|�|||��S)Nr9r�)rb�threading_algorithmrHrZr�r�r�s       rF�threadzIMAP4.thread_sI��	���'�4�'��.A�7�]�_�]�]�]���S��&�&�s�C��6�6�6rEc��	|���}|tvr|�d|z���|jt|vrA|�d|�d|j�dd�t|�������d}|j||g|�R�\}}|dvr|}nd}|�|||��S)	NzUnknown IMAP4 UID command: %s�command � illegal in state �, only allowed in states �, r:)r/r4r9r )r�r�rGrS�joinr�r�)rbrir�r�r�r�s      rF�uidz	IMAP4.uidis���	��-�-�/�/���(�"�"��*�*�<�w�F�G�G�G��:�X�g�.�.�.��*�*�*�%�g�g�t�z�z�z�"�i�i���(9�:�:�:�<�=�=�
=���'�4�'��g�=��=�=�=���S��2�2�2��D�D��D��&�&�s�C��6�6�6rEc�0�	|�d|��S)Nr;r�r�s  rF�unsubscribezIMAP4.unsubscribe�s��	��#�#�M�7�;�;�;rEc�f�		|�d��\}}d|_n#d|_wxYw||fS)Nr<rr�)rbr�r�s   rF�unselectzIMAP4.unselect�sI��	�	 ��,�,�Z�8�8�I�C���D�J�J���D�J������D�y�r�c�z�	|���}|tvr|jft|<|j|g|�R�Sr�)r�r�rSr��rbr�r�s   rF�xatomzIMAP4.xatom�sK��	��z�z�|�|���x���"�j�]�H�T�N�#�t�#�D�0�4�0�0�0�0rEc�l�|�d}|j}	||vr||�|��dS|g||<dS�NrE)rVrRr�r�rNr�)rbr�r��urs    rF�_append_untaggedzIMAP4._append_untagged�sO���;��C�
�
$��	9��"�9�9��s�G�N�N�3�������e�B�s�G�G�GrEc��|j�d��}|r4|�|d�|jd�����dS)N�BYEr�r�)rVrNrKr�rj)rb�byes  rF�
_check_byezIMAP4._check_bye�sS���%�)�)�%�0�0���	H��*�*�S��W�^�^�D�N�I�F�F�G�G�G�	H�	HrEc��|jt|vrHd|_|�d|�d|j�dd�t|�������dD]}||jvr|j|=�d|jvr|js|�d���|���}t||j
��}|dz|z}|D]7}|��t|t��rt||j
��}|dz|z}�8|j}|�Wd|_t|��t|j��ur|}n*d}|td	t|��z|j
��z}		|�|t(z��n*#t*$r}	|�d
|	z���d}	~	wwxYw|�|S	|���r#|j|r|S|����#|r||j��}		|�|��|�t(��n*#t*$r}	|�d
|	z���d}	~	wwxYw|sn��|S)Nrqrrrsrt�rz�NO�BADrLz#mailbox status changed to READ-ONLY� z {%s}F�z> %rzsocket error: %s)rSr�rTrGrurVrXrN�_new_tag�bytesrjr*r+�type�_commandr�rRr��_logr�r�r`rKr�rUrW)
rbr�r�r��tagr��argrT�	literator�vals
          rFr�zIMAP4._command�s����:�X�d�^�+�+��D�L��*�*�*�"�d�d�D�J�J�J�"�i�i����7�7�7�9�:�:�
:�
'�	1�	1�C��d�-�-�-��+�C�0���$�1�1�1�� �2��-�-� E�F�F�F��m�m�o�o���T�4�>�*�*���T�z�D� ���	%�	%�C��{�H��#�s�#�#�
1��C���0�0���$�;��$�D�D��,�����D�L��G�}�}��T�]� 3� 3�3�3�#�	�	� �	��e�G�c�'�l�l�$:�D�N�K�K�K��	)�	7��I�I�d�T�k�"�"�"�"���	7�	7�	7��*�*�/�#�5�6�6�6�����	7�����?��J�	��$�$�&�&�
��'��,���J��$�$�&�&�
��
@�#�)�D�$>�?�?��
G�
;��	�	�'�"�"�"��	�	�$�������
;�
;�
;��j�j�!3�c�!9�:�:�:�����
;�����
��/	�2�
s0�%F�
F*�
F%�%F*�=/H-�-
I�7I�Ic��|dk}|s|���	|�||���\}}nU#|j$r }|�d|�d|�����d}~w|j$r }|�d|�d|�����d}~wwxYw|s|���|dkr|�|�d|�d|�����||fS)Nr)�
expect_byez	command: � => r�z command error: r')r��_get_tagged_responserKrG)rbr�r�r�r�r�r�s       rF�_command_completezIMAP4._command_completes���(�"���	��O�O����	@��1�1�#�&�1�I�I�I�C�����z�	@�	@�	@��*�*�*�D�D�D�#�#�>�?�?�?������z�	@�	@�	@��*�*�*�D�D�D�#�#�>�?�?�?�����	@�����	��O�O�����%�<�<��*�*�$�$�$����T�T�J�K�K�K��D�y�s!�9�
B�A�
B�+B�Bc��|���\}}|dgkr|�d���t|d|j��}|���}t|�����|_dS)Nz"no CAPABILITY response from serverr�)r�rGr+rjr��tuple�splitr�r�s   rFr�zIMAP4._get_capabilities#ss���?�?�$�$���S��4�&�=�=��*�*�A�B�B�B��#�b�'�4�>�*�*���i�i�k�k��!�#�)�)�+�+�.�.����rEc��|���}|�|j|��r�|j�d��}||jvr|�d|z���|j�d��}t||j��}|j�d��}||gf|j|<�n�d}|�t|��s5|�|j
|��r|j�d��}|j�T|�t|��r!|j�d��|_dS|�d|z���|j�d��}t||j��}|j�d��}|�d}|r|dz|z}|�|j
|��r�t|j�d	����}	|�|��}|�|||f��|���}|�|j
|����|�||��|d
vrx|�t&|��r]|j�d��}t||j��}|�||j�d����	|S)Nr�zunexpected tagged response: %rr�r��data2zunexpected response: %rrEr�r�Fr�zread literal size %sr�)�	_get_line�_matchr�mo�grouprUrKr+rj�Untagged_responserq�ContinuationrWro�intrRr�r�r��
Response_code)rb�respr�r�r��dat2r�r�s        rFr�zIMAP4._get_response,s����~�~�����;�;�t�z�4�(�(�5	,��'�-�-��&�&�C��$�.�.�.��j�j�!A�D�!H�I�I�I��'�-�-��'�'�C��c�4�>�*�*�C��'�-�-��'�'�C�),�s�e��D� ��%�%��D��;�;�0�$�7�7�
2��;�;�t�3�T�:�:�2��7�=�=��1�1�D��w���;�;�|�T�2�2� �15����v�1F�1F�D�.��4��j�j�!:�T�!A�B�B�B��'�-�-��'�'�C��c�4�>�*�*�C��'�-�-��'�'�C��{�#�C��,�3��:��,�S��+�+�d�l�C�0�0�
'��4�7�=�=��0�0�1�1��B��y�y������%�%�c�C��;�7�7�7��n�n�&�&��!�+�+�d�l�C�0�0�
'�$
�!�!�#�s�+�+�+��%�%�%�$�+�+�m�S�*I�*I�%��'�-�-��'�'�C��c�4�>�*�*�C��!�!�#�t�w�}�}�V�'<�'<�=�=�=�	;��rEc��	|j|}|�
|j|=|S|r#d}|j�|d��}|�||fS|���	|���n#|j$r}	�d}~wwxYw�})Nrxr�)rUrV�popr�r�rKrR�	print_log)rbr�r��resultr�r�r�s       rFr�zIMAP4._get_tagged_response|s���	��)�#�.�F��!��(��-��
��
&����-�1�1�#�t�<�<���?���:�%�
�O�O����
��"�"�$�$�$�$���:�
�
�
�)������	
����1	s�A*�*
A;�4A6�6A;c���|���}|s|�d���|�d��s|�d|z���|dd�}	|S)Nzsocket error: EOFr
z#socket error: unterminated line: %r���)r�rK�endswithrRr�r�r�s  rFr�zIMAP4._get_line�sr���}�}�����	2��*�*�0�1�1�1��}�}�W�%�%�	K��*�*�B�T�I�J�J�J��C�R�C�y��	)�
�rEc�J�|�|��|_	|jduSr�)�matchr�rRr�r�groups)rb�cre�ss   rFr�zIMAP4._match�s*��
�)�)�A�,�,���	S��w�d�"�"rEc��|jtt|j��|j��z}|jdz|_d|j|<|S)Nrx)r~r�r+rYrjrU)rbr�s  rFr�zIMAP4._new_tag�sC���k�E�#�d�k�"2�"2�D�N�C�C�C���k�A�o���$(���S�!��
rEc�j�|�dd��}|�dd��}d|zdzS)N�\z\\�"z\")r�)rbr�s  rFrzIMAP4._quote�s6���k�k�$��'�'���k�k�#�u�%�%���S�y�3��rEc�F�|�||j|g|�R���Sr�)r�r�r|s   rFr�zIMAP4._simple_command�s,���%�%�d�M�D�M�$�,F��,F�,F�,F�G�G�GrEc�p�|dkr||fS||jvr|dgfS|j�|��}	||fS)Nr�)rVr�rRr�)rbr�r�r�r�s     rFr�zIMAP4._untagged_response�sV���$�;�;���8�O��t�.�.�.����;���&�*�*�4�0�0��	J��D�y�rEc��|�tj��}tjdtj|����}tj�d||dzdz|fz��tj���dS)Nz%M:%Sz
  %s.%02d %s
�d)�time�strftime�	localtimer��stderr�write�flush)rbr��secs�tms    rFr�zIMAP4._mesg�sr���|��y�{�{����w���t�(<�(<�=�=�B��J���-��d�3�h��^�Q�0G�G�H�H�H��J�������rEc��|sdSd�|���D��}|�dd�|��z��dS)Nc3�*K�|]\}}|�d|��V��dS)�: NrD)�.0�key�values   rF�	<genexpr>z!IMAP4._dump_ur.<locals>.<genexpr>�sP����B�B�"��U��(�(�u�(�(�B�B�B�B�B�BrEzuntagged responses dump:z
		)�itemsr�ru)rb�untagged_resp_dictr�s   rFr9zIMAP4._dump_ur�sh��%�
���B�B�&8�&>�&>�&@�&@�B�B�B�E��J�J�1�H�M�M�%�4H�4H�H�I�I�I�I�IrEc��|tj��f|j|j<|xjdz
c_|j|jkr	d|_dSdS)Nrxr)r�r�r�r�r�s  rFr�z
IMAP4._log�sW��04�d�i�k�k�/B�D�M�$�+�,�����"���� �D�$5�5�5�$%��!�!�!�6�5rEc���|�dt|j��z��|j|j}}|r9	|j|j|�n#YnxYw|dz
}||jkrd}|dz}|�7dSdS)Nzlast %d IMAP4 interactions:rxr)r�r�r�r�r�)rb�i�ns   rFr�zIMAP4.print_log�s����J�J�4�s�4�=�7I�7I�I�J�J�J��$�d�&7�q�A��
���D�J��
�a� 0�1�1�1����D�����Q�����)�)�)��A��Q����
�
�
�
�
s�A�A)rr)r�Fr�)F)TrArBrCr^rGrKrN�
IMAP4_PORTrfr[rur]r�r�r�r�r\r�r�r�r_r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrr"r%r$r�r3r5r7r�r?rArErJrOrRrTrWr[rdrgrjrlrorvrxrzr}r�r�r�r�r�r�r�r�r�r�rr�r�r�r9r�r�rDrErFrr�s������-�^!� � � � �	� � � ���������������5�����Z������2F�F�F�<�<�<�'7�'7�'7�TC�C�C�������1�1�1���T�	-�	-�	-�	-�$�$�$�
��� � � �
�
�
� ���7�7�7�"C�C�C�E�E�E�4���:7�7�7�-�-�-����F�F�F�7�7�7�7�7�7�?�?�?�
�
�
�7�7�7�7�7�7�8�8�8�?�?�?�:�:�:�'�'�'�	7�	7�	7�	7����B�B�B�N�N�N�
�
�
�	7�	7�	7�	7�=�=�=�7�7�7�,�,�,�	:�	:�	:�
7�
7�
7�F�F�F�7�7�7�$B�B�B�B�@B�B�B�?�?�?�:�:�:�7�7�7�7�7�7�7�.	7�	7�	7�:�:�:�:�:�:�7�7�7�7�7�7�2<�<�<�
�
�
� 1�1�1�,���H�H�H�J�J�J�Z���$/�/�/�M�M�M�`����B���&	#�	#�	#�������H�H�H�
	�	�	�"�"rErc�8�eZdZ	deddddfd�Zd�Zdedfd�ZdS)�	IMAP4_SSLrONc�.�|�|�td���|�|�td���|�|� ddl}|�dtd��||_||_|�t
j||���}||_t�
||||��dS)Nz8ssl_context and keyfile arguments are mutually exclusivez9ssl_context and certfile arguments are mutually exclusiverzEkeyfile and certfile are deprecated, use a custom ssl_context instead�)�certfile�keyfile)r��warnings�warn�DeprecationWarningr�r�r`rarcrrf)rbrcrdr�r�rcrer�s        rFrfzIMAP4_SSL.__init__s����&�7�+>� �"-�.�.�.��&�8�+?� �"-�.�.�.��"�h�&:������
�
�;�<N�PQ�S�S�S�"�D�L�$�D�M��"�!�8�(�AH�J�J�J��*�D���N�N�4��t�W�5�5�5�5�5rEc�z�t�||��}|j�||j���S)Nr])rr�rcrbrc)rbrer�s   rFr�zIMAP4_SSL._create_socket-sA���'�'��g�6�6�D��#�/�/��@D�	�0�K�K�
KrEc�B�	t�||||��dSr�)rr\ras    rFr\zIMAP4_SSL.open2s'��
�

�J�J�t�T�4��1�1�1�1�1rE)rArBrC�IMAP4_SSL_PORTrfr�r\rDrErFr�r�sl������	�&!#���"��d�	6�	6�	6�	6�(	K�	K�	K�
�^�T�	2�	2�	2�	2�	2�	2rEr�c�6�eZdZ	d�Zdd�Zd�Zd�Zd�Zd�ZdS)	rc�H�||_t�|��dSr�)rirrf)rbris  rFrfzIMAP4_stream.__init__Is!�����
���t�����rENc��	d|_d|_d|_d|_t	j|jttjtjdd���|_	|j	j
|_|j	j|_
dS)NT)�bufsize�stdin�stdout�shell�	close_fds)rcrdr�r��
subprocess�Popenrir�PIPEr�r��	writefiler��readfileras    rFr\zIMAP4_stream.openNsq��	���	���	���	���	�!�'���'��/�*�/��$�(�(�(�����+�����+��
�
�
rEc�8�	|j�|��Sr�)r�r�r�s  rFr�zIMAP4_stream.read^s��,��}�!�!�$�'�'�'rEc�6�	|j���Sr�)r�r�rrs rFr�zIMAP4_stream.readlinecs��$��}�%�%�'�'�'rEc�n�	|j�|��|j���dSr�)r�r�r�r�s  rFr�zIMAP4_stream.sendhs5��"�����T�"�"�"���������rEc��	|j���|j���|j���dSr�)r�r�r�r��waitrrs rFr_zIMAP4_stream.shutdownnsG��.��
���������������������rE)NNN)	rArBrCrfr\r�r�r�r_rDrErFrr=sx����������
,�,�,�,� (�(�(�
(�(�(�
�������rErc�(�eZdZ	d�Zd�Zd�Zd�ZdS)r�c��||_dSr�)r�)rb�mechinsts  rFrfz_Authenticator.__init__|s
����	�	�	rEc��|�|�|����}|�dS|�|��S)N�*)r�r�r,)rbr��rets   rFr�z_Authenticator.processs;���i�i����D�)�)�*�*���;��4��{�{�3���rEc��d}t|t��r|�d��}|rQt|��dkr|dd�}|dd�}n|}d}t	j|��}|r
||dd�z}|�Q|S)NrErt�0r�)r*r+r,r��binascii�
b2a_base64)rb�inp�oup�t�es     rFr,z_Authenticator.encode�s������c�3���	&��*�*�W�%�%�C��		#��3�x�x�"�}�}�����H���"�#�#�h��������#�A�&�&�A��
#��A�c�r�c�F�l���		#��
rEc�2�|sdStj|��Sr)r��
a2b_base64)rbr�s  rFr�z_Authenticator.decode�s ���	��3��"�3�'�'�'rEN)rArBrCrfr�r,r�rDrErFr�r�vsU���������� � � ����0(�(�(�(�(rEr�z0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Decr'c�D�i|]\}}|���|dz��S)rx)r,)r�r�r�s   rF�
<dictcomp>r�s*��
<�
<�
<�d�a��1�8�8�:�:�a��c�
<�
<�
<rErxc	��	t�|��}|sdSt|�d��}|�d��}t	|�d����}t	|�d����}t	|�d����}t	|�d����}t	|�d����}t	|�d����}	t	|�d	����}
|	d
z|
zd
z}|dkr|}||||||dddf	}tj|��|z
}
tj|
��S)
N�mon�zonen�day�year�hour�min�sec�zoneh�zonem�<�-r�)	�InternalDater��Mon2numr�r��calendar�timegmr�r�)r�r�rrrrrr	r
rr�zone�tt�utcs              rFr	r	�sX���
�	�	�D�	!�	!�B�
���t�
�"�(�(�5�/�/�
"�C��H�H�W���E�

�b�h�h�u�o�o�
�
�C��r�x�x���� � �D��r�x�x���� � �D�

�b�h�h�u�o�o�
�
�C�

�b�h�h�u�o�o�
�
�C������!�!�"�"�E������!�!�"�"�E�
�"�H�u��b� �D���}�}��u��
��S�$��S�"�b�"�	5�B�
�/�"�
�
��
$�C��>�#���rEc��	d}d}tt|����}|r%t|d��\}}|||dz�|z}|�%|S)NrEsABCDEFGHIJKLMNOP�rx)r��abs�divmod)�numr��AP�mods    rFr
r
�s`��7�

�C�'�r�

�c�#�h�h�-�-�C�

�"��#�r�?�?���S���S��U��m�c�!���"��JrEc��	t�|��}|sdSt|�d�������S)NrDr�)�Flagsr�r�r�r�)r�r�s  rFrr�sI��7�	���T�	�	�B�
���r�����'�"�"�(�(�*�*�+�+�+rEc��	t|ttf��r3tj|t
j�����}�n;t|t��r�	|j	}n�#t$rvtjrZ|d}|dkr,tj
tj|����d}tjtjf|}n
tj}YnwxYwt!|���}t|dd�dt|��i�}nht|t��r|j�t%d���|}n:t|t&��r|d|dfdkr|St%d	���d
�t*|j��}|�|��S)N�r�)�seconds��tzinfozdate_time must be awarer)r�r�zdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z")r*r��floatr�
fromtimestamprr�
astimezoner��	tm_gmtoffr�r��daylightr��mktime�altzonerr#r�r+�format�Months�monthr�)r��dt�gmtoff�dst�delta�fmts      rFrr�s���	��)�c�5�\�*�*�:�
�
#�I�$,�L�2�2�2<�*�,�,�	��	�I�u�	%�	%�:�		(��(�F�F���	(�	(�	(��}�
(���l���"�9�9��.���Y�)?�)?�@�@��C�C��=�$�,�7��<�<����-�����	(�����&�)�)�)��
�y��!��}�
=�X�e�_�_�
=�
=���	�I�x�	(�	(�:���#��6�7�7�7�
���	�I�s�	#�	#�:��1��i��m�(D�	�(Q�(Q����8�9�9�9�
"�
)�
)�&���*:�
;�
;�C�
�;�;�s���s�'A/�/A=C/�.C/�__main__zd:s:)rDrDz-dz-s)rOzIMAP password for z on �	localhostr�zJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s�
)r �lfr")r�)�
/tmp/xxx 1)rE)r7z/tmp/yyy)r��
/tmp/yyz 2r�r9)r)z/tmpzyy*)rOr8)rJ)N�SUBJECT�test)r)�1z(FLAGS INTERNALDATE RFC822))rj)r<�FLAGSz
(\Deleted))r7rD)rrD)r�rD)r�rD)rOrD)r�)�UIDVALIDITY)rv)r/�ALL)r�)rM)r�rDc���t�|�d|����tt|��|�\}}t�|�d|�d|����|dkr|d�|S)Nr'r�r�r)�Mr�r�)�cmdr�r�r�s    rF�runrCAsp��	���3�3�3���%�&�&�&�"�7�1�c�?�?�D�)���S�	������c�c�c�3�3�/�0�0�0��$�;�;�c�!�f���
rErzPROTOCOL_VERSION = %szCAPABILITIES = r)z/tmp/zyy%z.*"([^"]+)"$r�r�rvz%sz:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)z
All tests OK.z
Tests failed.z8
If you would like to see debugging output,
try: %s -d5
)Tr�r�r�r|rkr�r�r�r�rrrr�iorr`r_�ImportError�__all__r�rQr�r�r�r�r�rlr�rrrnror�r�r�rqrmrprr�r�rr�r�r,�	enumeraterr	r
rrrA�getopt�getpass�argv�optlistr�rGr��stream_command�optr�rc�getuser�USER�PASSWD�	test_mesg�	test_seq1�	test_seq2rCrArSr�r�r�rB�mlr�r�r��pathr�rv�printrDrErF�<module>rWs���
�,��K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�2�2�2�2�2�2�2�2�2�2�"�"�"�"�"�"���J�J�J��H�H�������H�H�H�����8�8�8��
��	��
�
���(����
,
��,�,
�	��,
�	�A�	,
�
	�
�,
�	�
�
,
�	�
�,
�	�,�,
�	�,�,
�	�,�,
�	�
�,
�	�,�,
�	�
�,
�	�
�,
�	�,�,
� 	�,�!,
�"	�,�#,
�$	�,�%,
�,
�&	�,�',
�(	�,�),
�*	��+,
�,	�A�-,
�.	�,�/,
�0	�
�1,
�2	�,�3,
�4	�A�5,
�6	�
�7,
�8	�	�9,
�:	�,�;,
�<	�
�=,
�>	�,�?,
�@	�,�A,
�B	�,�C,
�D	�,�E,
�F	�
�G,
�,
�H%�,�%�,�%�%�,�%�W,
�,
�,
��`�r�z�0�1�1����
�4�5�5���r�z������"�*�+�R�X�
6�
6��
�"�*�^�
$�
$����
�D�E�E�
��B�J�G�H�H���"�*�;�R�X�G�G��"��J��x�x�x�x�x�x�x�x�v#�8 �42�42�42�42�42�E�42�42�42�l�N�N�;����5�5�5�5�5�5�5�5�5�r*(�*(�*(�*(�*(�*(�*(�*(�X
<�	A�	A�#�	F�	F��
<�
<�i�i��q�r�r�
�&;�&;�
<�
<�
<�����F	�	�	�,�,�,�%�%�%�R�z������������%��
�c�h�q�r�r�l�F�;�;�
������<�����
�����������������N��2�2���C��$�;�;��C��H�H�E�E�
�D�[�[� �N��1�� 1���������7�D��7�?���D�
�W�_�_�t�t�t�T�EX�[�EX�EX�Y�
Z�
Z�F�\�gk�rv�_w�_w�w�I��t�V�n���*��
��d�D�)�4�5���)�3�,������I�$�!���
��d�D�)�,�-����I����)��	���^�,�,�A�A���d���A��7�f���!�!�"�"�
�I�	���'�!�*<�<�=�=�=�	����q�~�~�7�8�8�8�!�	�	�H�C���C��T�N�N�N�N��#�f�.�/�/�	#�	#�B����/�2�.�.�B��
(�"�(�(�1�+�+�4�4������B��$��C��4�'�"�"�"�"�!�		S�		S�H�C���#�c�4�.�.�C��D�z�7�7�7���b�'�-�-�/�/�C�� ���C�����B���P�R�
S�
S�
S�
S�	��� � � � � ��	�
��� � � ��	��E��
�h�q�k��
�
�
�
	����Q�s6�A�A
�	A
�=!H�
H8�)H3�3H8�
D8P�)P0

Zerion Mini Shell 1.0