ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/smtpd.cpython-311.pyc

�

�f�y��F�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZm
Z
gd�ZdZe	eed���ddlZddlZejdZd	ZGd
�d��Ze��adZd
ZdZd%d�ZGd�dej��ZGd�dej��ZGd�de��Z Gd�de��Z!Gd�d��Z"d�Z#edk�rMe#��Z$e$j%Z%de%vrJe%�&d��Z'e(e%de'�e)��e*��dg��Z+e%e'dzd�Z%nddl,Z+e-e+e%��Z.e.e$j/e$j0fe$j1e$j2fe$j3e$j4���Z5e$j6r�	ddl7Z7n-#e8$r%e9d ej:�!��ej;d��YnwxYwe7j<d"��d#Z=	ej6e=��n-#e>$r%e9d$ej:�!��ej;d��YnwxYw	ej?��dS#e@$rYdSwxYwdS)&a�An RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions.

Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]]

Options:

    --nosetuid
    -n
        This program generally tries to setuid `nobody', unless this flag is
        set.  The setuid call will fail if this program is not run as root (in
        which case, use this flag).

    --version
    -V
        Print the version number and exit.

    --class classname
    -c classname
        Use `classname' as the concrete SMTP proxy class.  Uses `PureProxy' by
        default.

    --size limit
    -s limit
        Restrict the total size of the incoming message to "limit" number of
        bytes via the RFC 1870 SIZE extension.  Defaults to 33554432 bytes.

    --smtputf8
    -u
        Enable the SMTPUTF8 extension and behave as an RFC 6531 smtp proxy.

    --debug
    -d
        Turn on debugging prints.

    --help
    -h
        Print this message and exit.

Version: %(__version__)s

If localhost is not given then `localhost' is used, and if localport is not
given then 8025 is used.  If remotehost is not given then `localhost' is used,
and if remoteport is not given, then 25 is used.
�N)�_deprecated�warn)�
get_addr_spec�get_angle_addr)�SMTPChannel�
SMTPServer�DebuggingServer�	PureProxyz�The {name} module is deprecated and unmaintained and will be removed in Python {remove}.  Please see aiosmtpd (https://aiosmtpd.readthedocs.io/) for the recommended replacement.)��)�removezPython SMTP proxy version 0.3c��eZdZd�Zd�ZdS)�Devnullc��dS�N���self�msgs  �,/opt/alt/python311/lib64/python3.11/smtpd.py�writez
Devnull.writei�����c��dSrr�rs r�flushz
Devnull.flushjrrN)�__name__�
__module__�__qualname__rrrrrrrhs"�������������rr�
z, i�c���ttt��ztj���|rt|tj���tj|��dS)N��file)�print�__doc__�globals�sys�stderr�exit)�coders  r�usager,ssN��	�'�G�I�I�
�C�J�/�/�/�/�
�$�
�c��
�#�#�#�#��H�T�N�N�N�N�Nrc�*�eZdZdZdZdZejefd���Ze	d���Z
edddfd�Zd	�Z
d
�Ze	d���Zejd���Ze	d
���Zejd���Ze	d���Zejd���Ze	d���Zejd���Ze	d���Zejd���Ze	d���Zejd���Ze	d���Zejd���Ze	d���Zejd���Ze	d���Zejd���Ze	d���Zejd���Ze	d���Zejd ���Zd!�Zd"�Zd#�Zd$�Zd%�Zd&�Z d'�Z!d(�Z"d)�Z#d*�Z$d+�Z%d,�Z&d-�Z'd.�Z(d/�Z)d0�Z*d1�Z+dS)2rr�ic��|Srr)�xs r�<lambda>zSMTPChannel.<lambda>s��q�rc�~�	t|j�����S#t$r
|jcYSwxYwr)�max�command_size_limits�values�
ValueError�command_size_limitrs r�max_command_size_limitz"SMTPChannel.max_command_size_limit�sN��	+��t�/�6�6�8�8�9�9�9���	+�	+�	+��*�*�*�*�	+���s�%(�<�<NFc�Z�tj�|||���||_||_||_||_||_||_|r|rtd���|r"d|_
d|_d|_t|_n)d|_
d|_td��|_d	|_|���d|_d
|_|j���t+j��|_	|���|_nB#t4$r5}|���|jt8jkr�Yd}~dSd}~wwxYwt=dt?|j��t@���|�!d
|j�dtD����dS)N��map�Fdecode_data and enable_SMTPUTF8 cannot be set to True at the same timer!�
�.r�
�.�
FzPeer:r#z220 � )#�asynchat�
async_chat�__init__�smtp_server�conn�addr�data_size_limit�enable_SMTPUTF8�_decode_datar6�_emptystring�_linesep�_dotsep�NEWLINE�_newline�ord�_set_rset_state�
seen_greeting�
extended_smtpr4�clear�socket�getfqdn�fqdn�getpeername�peer�OSError�close�errno�ENOTCONNr%�repr�DEBUGSTREAM�push�__version__)	r�serverrGrHrIr;rJ�decode_data�errs	         rrEzSMTPChannel.__init__�s�����$�$�T�4�S�$�9�9�9�!�����	���	�.���.���'����	A�{�	A��@�A�A�
A��		"� "�D��"�D�M��D�L�#�D�M�M� #�D��#�D�M��t�9�9�D�L�!�D�M����������"���� �&�&�(�(�(��N�$�$��	�	��(�(�*�*�D�I�I���	�	�	�
�J�J�L�L�L��y�E�N�*�*���F�F�F�F�F�����
	����	�g�t�D�I���[�9�9�9�9��	�	�	�����K�K�8�9�9�9�9�9s�D�
E�%*E�Ec��|j|_d|_g|_d|_d|_|�d��dS)z/Reset state variables to their post-DATA state.NFrr?)�COMMAND�
smtp_state�mailfrom�rcpttos�require_SMTPUTF8�	num_bytes�set_terminatorrs r�_set_post_data_statez SMTPChannel._set_post_data_state�sB���,�����
���� %���������G�$�$�$�$�$rc�J�|���d|_g|_dS)z.Reset all state variables except the greeting.r!N)rn�
received_data�received_linesrs rrRzSMTPChannel._set_rset_state�s*���!�!�#�#�#���� ����rc�<�tdtd��|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead��r�DeprecationWarningrFrs r�__serverzSMTPChannel.__server�s*���(�);�Q�	@�	@�	@���rc�@�tdtd��||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadrsrt�r�values  rrvzSMTPChannel.__server�s/���(�);�Q�	@�	@�	@� ����rc�<�tdtd��|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadrs�rrurqrs r�__linezSMTPChannel.__line�s*���+�,>��	C�	C�	C��"�"rc�@�tdtd��||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadrsr{rxs  rr|zSMTPChannel.__line�s/���+�,>��	C�	C�	C�#����rc�<�tdtd��|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadrs�rrurhrs r�__statezSMTPChannel.__state�s&���'�(:�A�	?�	?�	?���rc�@�tdtd��||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadrsrrxs  rr�zSMTPChannel.__state�s)���'�(:�A�	?�	?�	?�����rc�<�tdtd��|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadrs�rrurSrs r�
__greetingzSMTPChannel.__greeting��*���*�+=�q�	B�	B�	B��!�!rc�@�tdtd��||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadrsr�rxs  rr�zSMTPChannel.__greeting��/���*�+=�q�	B�	B�	B�"����rc�<�tdtd��|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadrs�rrurirs r�
__mailfromzSMTPChannel.__mailfrom�s&���%�&8�!�	=�	=�	=��}�rc�@�tdtd��||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadrsr�rxs  rr�zSMTPChannel.__mailfrom�s)���%�&8�!�	=�	=�	=���
�
�
rc�<�tdtd��|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadrs�rrurjrs r�	__rcpttoszSMTPChannel.__rcpttos�s&���$�%7��	<�	<�	<��|�rc�@�tdtd��||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadrsr�rxs  rr�zSMTPChannel.__rcpttos�s)���$�%7��	<�	<�	<�����rc�<�tdtd��|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadrs�rrurprs r�__datazSMTPChannel.__datar�rc�@�tdtd��||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadrsr�rxs  rr�zSMTPChannel.__datar�rc�<�tdtd��|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadrs�rrurXrs r�__fqdnzSMTPChannel.__fqdn
�&���!�"4�a�	9�	9�	9��y�rc�@�tdtd��||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadrsr�rxs  rr�zSMTPChannel.__fqdn�)���!�"4�a�	9�	9�	9���	�	�	rc�<�tdtd��|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadrs�rrurZrs r�__peerzSMTPChannel.__peerr�rc�@�tdtd��||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadrsr�rxs  rr�zSMTPChannel.__peerr�rc�<�tdtd��|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadrs�rrurGrs r�__connzSMTPChannel.__conn#r�rc�@�tdtd��||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadrsr�rxs  rr�zSMTPChannel.__conn(r�rc�<�tdtd��|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadrs�rrurHrs r�__addrzSMTPChannel.__addr.r�rc�@�tdtd��||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadrsr�rxs  rr�zSMTPChannel.__addr3r�rc�z�tj�|t|dz|jrdnd����dS)Nr=�utf-8�ascii)rCrDra�bytesrkrs  rrazSMTPChannel.push:sQ���� � ��u��&�L�T�%:�G�'�'��(I�(I�	J�	J�	J�	J�	Jrc�Z�d}|j|jkr|j}n|j|jkr|j}|r
|j|krdS|r|xjt
|��z
c_|jr*|j�	t|d����dS|j�	|��dS)Nr�)rhrgr8�DATArIrl�lenrKrq�append�str)r�data�limits   r�collect_incoming_dataz!SMTPChannel.collect_incoming_data?s������?�d�l�*�*��/�E�E�
�_��	�
)�
)��(�E��	(�T�^�e�+�+��F�
�	(��N�N�c�$�i�i�'�N�N���	-���&�&�s�4��'9�'9�:�:�:�:�:���&�&�t�,�,�,�,�,rc���|j�|j��}tdt	|��t
���g|_|j|jk�r!|jdc}|_|s|�	d��dS|j
st|d��}|�d��}|dkr|�
��}d}n;|d|��
��}||dzd����}|jr
|j|n|j}||kr|�	d��dSt%|d	|zd��}|s|�	d
|z��dS||��dS|j|jkr|�	d��d|_dS|jr.|j|jkr|�	d��d|_dSg}|�|j��D]H}	|	r/|	d|jkr|�|	dd����3|�|	���I|j�|��|_|j|j|j|jf}
i}|j
s|j|jd
�}|j j!|
i|��}|�"��|s|�	d��dS|�	|��dS)NzData:r#rz500 Error: bad syntaxr�rBr.z500 Error: line too long�smtp_z&500 Error: command "%s" not recognizedz451 Internal confusionz552 Error: Too much mail data)�mail_options�rcpt_options�250 OK)#rL�joinrqr%r_r`rhrgrlrarKr��find�upper�striprTr4r7�getattrr�rI�splitrMrNr�rPrprZrirjr�r�rF�process_messagern)
r�line�sz�i�command�arg�max_sz�methodr��text�args�kwargs�statuss
             r�found_terminatorzSMTPChannel.found_terminatorOs��� �%�%�d�&9�:�:��
�g�t�D�z�z��4�4�4�4� ����?�d�l�*�*�!%����B����
��	�	�1�2�2�2����$�
*��4��)�)���	�	�#���A��1�u�u��*�*�,�,������r��r�(�.�.�*�*���1�Q�3�4�4�j�&�&�(�(���-�K�d�.�w�7�7�37�3J�
��F�{�{��	�	�4�5�5�5����T�7�W�#4�d�;�;�F��
��	�	�B�W�L�M�M�M����F�3�K�K�K��F���$�)�+�+��	�	�2�3�3�3�!"������#�
����9M�(M�(M��	�	�9�:�:�:�!"������D��
�
�4�=�1�1�
&�
&���&�D��G�t�|�3�3��K�K��Q�R�R��)�)�)�)��K�K��%�%�%�%�!%��!3�!3�D�!9�!9�D���I�t�}�d�l�D�<N�O�D��F��$�
�$(�$5�$(�$5����6�T�%�5�t�F�v�F�F�F��%�%�'�'�'��
"��	�	�(�#�#�#�#�#��	�	�&�!�!�!�!�!rc���|s|�d��dS|jr|�d��dS|���||_|�d|jz��dS)Nz501 Syntax: HELO hostname�503 Duplicate HELO/EHLOz250 %s)rarSrRrX�rr�s  r�	smtp_HELOzSMTPChannel.smtp_HELO�s~���	��I�I�1�2�2�2��F���	��I�I�/�0�0�0��F������� ����	�	�(�T�Y�&�'�'�'�'�'rc�(�|s|�d��dS|jr|�d��dS|���||_d|_|�d|jz��|jr2|�d|jz��|jdxxdz
cc<|js|�d��|jr*|�d	��|jdxxd
z
cc<|�d��dS)Nz501 Syntax: EHLO hostnamer�Tz250-%sz250-SIZE %s�MAIL�z250-8BITMIMEz250-SMTPUTF8�
z250 HELP)	rarSrRrTrXrIr4rKrJr�s  r�	smtp_EHLOzSMTPChannel.smtp_EHLO�s5���	��I�I�1�2�2�2��F���	��I�I�/�0�0�0��F������� ���!����	�	�(�T�Y�&�'�'�'���	3��I�I�m�d�&:�:�;�;�;��$�V�,�,�,��2�,�,�,�� �	&��I�I�n�%�%�%���	3��I�I�n�%�%�%��$�V�,�,�,��2�,�,�,��	�	�*�����rc�b�|r|�d��dS|�d��dS)Nz501 Syntax: NOOPr��rar�s  r�	smtp_NOOPzSMTPChannel.smtp_NOOP�s;���	 ��I�I�(�)�)�)�)�)��I�I�h�����rc�X�|�d��|���dS)Nz221 Bye)ra�close_when_doner�s  r�	smtp_QUITzSMTPChannel.smtp_QUIT�s,���	�	�)�����������rc��t|��}|d|����|kr||d����SdS)Nr!)r�r�r�)r�keywordr��keylens    r�_strip_command_keywordz"SMTPChannel._strip_command_keyword�sK���W�����w��w�<�����7�*�*��v�w�w�<�%�%�'�'�'��rrc��|sdS|����d��rt|��\}}nt|��\}}|s||fS|j|fS)N)r!r!�<)�lstrip�
startswithrr�	addr_spec)rr��address�rests    r�_getaddrzSMTPChannel._getaddr�sq���	��6��:�:�<�<�"�"�3�'�'�	/�*�3�/�/�M�G�T�T�)�#�.�.�M�G�T��	!��D�=� �� �$�&�&rc��i}|D]?}|�d��\}}}|���r|r|sdS|r|nd||<�@|S)N�=T)�	partition�isalnum)r�params�result�param�eqrys      r�
_getparamszSMTPChannel._getparams�sn�����	2�	2�E�$���s�3�3��E�2�u��=�=�?�?�
�b�
��
��t�t�%'�1�E�E�T�F�5�M�M��
rc���|�rNd}|���}|dkr|�d��dS|dkr|�d��dS|dkr%d}|jr||z
}|�|��dS|dkr%d	}|jr||z
}|�|��dS|d
kr|�d��dS|dkr|�d
��dS|dkr|�d��dS|dkr|�d��dS|dkr|�d��dS|�d��dS|�d��dS)N� [SP <mail-parameters>]�EHLOz250 Syntax: EHLO hostname�HELOz250 Syntax: HELO hostnamer�z 250 Syntax: MAIL FROM: <address>�RCPTz250 Syntax: RCPT TO: <address>r�z250 Syntax: DATA�RSETz250 Syntax: RSET�NOOPz250 Syntax: NOOP�QUITz250 Syntax: QUIT�VRFYz250 Syntax: VRFY <address>zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)r�rarT)rr��extended�lc_argrs     r�	smtp_HELPzSMTPChannel.smtp_HELP�s���� 	-�0�H��Y�Y�[�[�F������	�	�5�6�6�6�6�6��6�!�!��	�	�5�6�6�6�6�6��6�!�!�8���%�$��8�O�C��	�	�#�������6�!�!�6���%�$��8�O�C��	�	�#�������6�!�!��	�	�,�-�-�-�-�-��6�!�!��	�	�,�-�-�-�-�-��6�!�!��	�	�,�-�-�-�-�-��6�!�!��	�	�,�-�-�-�-�-��6�!�!��	�	�6�7�7�7�7�7��	�	�5�6�6�6�6�6�
�I�I�,�
-�
-�
-�
-�
-rc���|rK|�|��\}}|r|�d��dS|�d|z��dS|�d��dS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY <address>)r�ra)rr�r�r�s    r�	smtp_VRFYzSMTPChannel.smtp_VRFY�s����	4�"�m�m�C�0�0�O�G�V��
9��	�	�1�2�2�2�2�2��	�	�1�C�7�8�8�8�8�8��I�I�2�3�3�3�3�3rc�V�|js|�d��dStd|t���d}|jr|dz
}|�|�|��dS|�d|��}|�|��\}}|s|�|��dS|js|r|�|��dS|jr|�d��dS|����	��|_
|�|j
��}|�|�|��dS|js1|�
dd	��}|d
vr|�d��dS|jr=|�
dd
��}|durd|_n|d
ur|�d��dS|�
dd��}|ra|���s|�|��dS|jr/t%|��|jkr|�d��dSt'|�����dkr|�d��dS||_td|jt���|�d��dS)N�503 Error: send HELO firstz	===> MAILr#z 501 Syntax: MAIL FROM: <address>r�zFROM:z503 Error: nested MAIL command�BODY�7BIT)r��8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIME�SMTPUTF8FTz&501 Error: SMTPUTF8 takes no arguments�SIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:r�)rSrar%r`rTr�r�rir�r�r�r�rK�poprJrk�isdigitrI�intr��keys)rr��	syntaxerrr�r��body�smtputf8�sizes        r�	smtp_MAILzSMTPChannel.smtp_MAILs����!�	��I�I�2�3�3�3��F�
�k�3�[�1�1�1�1�6�	���	3��2�2�I��;��I�I�i� � � ��F��)�)�'�3�7�7���-�-��,�,�����	��I�I�i� � � ��F��!�	�f�	��I�I�i� � � ��F��=�	��I�I�6�7�7�7��F�"�L�L�N�N�0�0�2�2�������!2�3�3���>��I�I�i� � � ��F�� �	��:�:�f�f�-�-�D��/�/�/��	�	�M�N�N�N�����	��z�z�*�e�4�4�H��4���(,��%�%���&�&��	�	�B�C�C�C����z�z�&�$�'�'���	��<�<�>�>�
��	�	�)�$�$�$����%�
�#�d�)�)�d�6J�*J�*J��	�	�V�W�W�W����v�{�{�}�}����!�!��I�I�R�S�S�S��F���
�
�i���[�9�9�9�9��	�	�(�����rc��|js|�d��dStd|t���|js|�d��dSd}|jr|dz
}|�|�|��dS|�d|��}|�|��\}}|s|�|��dS|js|r|�|��dS|����	��|_
|�|j
��}|�|�|��dSt|�
����dkr|�d	��dS|j�|��td
|jt���|�d��dS)Nr�z	===> RCPTr#z503 Error: need MAIL commandz501 Syntax: RCPT TO: <address>r�zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:r�)rSrar%r`rirTr�r�r�r�r�r�r�rrjr�)rr�rr�r�s     r�	smtp_RCPTzSMTPChannel.smtp_RCPT:s����!�	��I�I�2�3�3�3��F�
�k�3�[�1�1�1�1��}�	��I�I�4�5�5�5��F�4�	���	3��2�2�I��;��I�I�i� � � ��F��)�)�%��5�5���-�-��,�,�����	��I�I�i� � � ��F��!�	�f�	��I�I�i� � � ��F�"�L�L�N�N�0�0�2�2�������!2�3�3���>��I�I�i� � � ��F��v�{�{�}�}����!�!��I�I�P�Q�Q�Q��F�����G�$�$�$�
�i���K�8�8�8�8��	�	�(�����rc��|r|�d��dS|���|�d��dS)Nz501 Syntax: RSETr�)rarRr�s  r�	smtp_RSETzSMTPChannel.smtp_RSET]sL���	��I�I�(�)�)�)��F��������	�	�(�����rc��|js|�d��dS|js|�d��dS|r|�d��dS|j|_|�d��|�d��dS)Nr�z503 Error: need RCPT commandz501 Syntax: DATAs
.
z#354 End data with <CR><LF>.<CR><LF>)rSrarjr�rhrmr�s  r�	smtp_DATAzSMTPChannel.smtp_DATAds����!�	��I�I�2�3�3�3��F��|�	��I�I�4�5�5�5��F��	��I�I�(�)�)�)��F��)������L�)�)�)��	�	�7�8�8�8�8�8rc�0�|�d��dS)Nz502 EXPN not implementedr�r�s  r�	smtp_EXPNzSMTPChannel.smtp_EXPNss���	�	�,�-�-�-�-�-r),rrrrgr�r7�collections�defaultdictr4�propertyr8�DATA_SIZE_DEFAULTrErnrR�_SMTPChannel__server�setter�_SMTPChannel__line�_SMTPChannel__state�_SMTPChannel__greeting�_SMTPChannel__mailfrom�_SMTPChannel__rcpttos�_SMTPChannel__data�_SMTPChannel__fqdn�_SMTPChannel__peer�_SMTPChannel__conn�_SMTPChannel__addrrar�r�r�r�r�r�r�r�r�r�r�rr
rrrrrrrrzs�������G��D���1�+�1�;M�2P�2P�2P�Q�Q��
�+�+��X�+�<M��5�e�%:�%:�%:�%:�N%�%�%�!�!�!�� � ��X� ��_�!�!��_�!�
�#�#��X�#��]�$�$��]�$�
����X��
�^� � ��^� �
�"�"��X�"���#�#���#�
����X���������
����X���������
�"�"��X�"��]�#�#��]�#�
����X���]����]��
����X���]����]��
����X���]����]��
����X���]����]��J�J�J�

-�
-�
-� ;"�;"�;"�|
(�
(�
(����, � � ����
���	'�	'�	'�	�	�	�!-�!-�!-�F	4�	4�	4�4�4�4�l!�!�!�F���9�9�9�.�.�.�.�.rrc�.�eZdZeZedddfd�Zd�Zd�ZdS)rNFc	��||_||_||_||_||_|r|rtd���tj�||���	tj
|dtji�}|�|dd|dd��|�
��|�|��|�d��t!|jj�dt'jt'j�����d|�d	|��t*�
��dS#|����xYw)Nr<r:�typerr.�z started at z
	Local addr: z
	Remote addr:r#)�
_localaddr�_remoteaddrrIrJrKr6�asyncore�
dispatcherrErV�getaddrinfo�SOCK_STREAM�
create_socket�set_reuse_addr�bind�listenr%�	__class__r�time�ctimer`r\)r�	localaddr�
remoteaddrrIr;rJrd�gai_resultss        rrEzSMTPServer.__init__{sj��$���%���.���.���'����	A�{�	A��@�A�A�
A���$�$�T�s�$�3�3�3�	:� �,�i�F�28�2D�F�F�K����{�1�~�a�0�+�a�.��2C�D�D�D����!�!�!��I�I�i� � � ��K�K��N�N�N�

���'�'�'���D�I�K�K�)@�)@�)@�)@��	�	�:�:�'�-8�
:�
:�
:�
:�
:�
:��		��J�J�L�L�L����s
�BD0�0Ec	��tdt|��zt���|�||||j|j|j|j��}dS)NzIncoming connection from %sr#)r%r_r`�
channel_classrI�_maprJrK)rrGrH�channels    r�handle_acceptedzSMTPServer.handle_accepted�sY��
�+�d�4�j�j�8�{�K�K�K�K��$�$�T�%)�%)�%)�%9�%)�Y�%)�%9�%)�%6�
8�8���rc��t�)aOverride this abstract method to handle messages from the client.

        peer is a tuple containing (ipaddr, port) of the client that made the
        socket connection to our smtp port.

        mailfrom is the raw address the client claims the message is coming
        from.

        rcpttos is a list of raw addresses the client wishes to deliver the
        message to.

        data is a string containing the entire full text of the message,
        headers (if supplied) and all.  It has been `de-transparencied'
        according to RFC 821, Section 4.5.2.  In other words, a line
        containing a `.' followed by other text has had the leading dot
        removed.

        kwargs is a dictionary containing additional information.  It is
        empty if decode_data=True was given as init parameter, otherwise
        it will contain the following keys:
            'mail_options': list of parameters to the mail command.  All
                            elements are uppercase strings.  Example:
                            ['BODY=8BITMIME', 'SMTPUTF8'].
            'rcpt_options': same, for the rcpt command.

        This function should return None for a normal `250 Ok' response;
        otherwise, it should return the desired response string in RFC 821
        format.

        )�NotImplementedError�rrZrirjr�r�s      rr�zSMTPServer.process_message�s
��>"�!r)	rrrrr9rrEr<r�rrrrrwsW�������M�"3��!&�E�:�:�:�:�88�8�8�"�"�"�"�"rrc��eZdZd�Zd�ZdS)r	c�P�d}|���}|D]�}|rU|sSd|dz}t|t��s"t|�d����}t|��d}t|t��st|��}t|����dS)Nr.zX-Peer: rr�)�
splitlines�
isinstancer�r_�encoder%)rrZr��	inheaders�linesr��
peerheaders       r�_print_message_contentz&DebuggingServer._print_message_content�s����	����!�!���	�	�D��
��
�'�$�q�'�1�
�!�$��,�,�B�!%�j�&7�&7��&@�&@�!A�!A�J��j�!�!�!��	��d�C�(�(�
"��D�z�z���$�K�K�K�K�	�	rc�&�td��|rZ|�d��rtd|dz��|�d��rtd|dz��|�||��td��dS)Nz%---------- MESSAGE FOLLOWS ----------r�zmail options: %sr�zrcpt options: %s
z%------------ END MESSAGE ------------)r%�getrHr?s      rr�zDebuggingServer.process_message�s���
�5�6�6�6��	E��z�z�.�)�)�
C��(�6�.�+A�A�B�B�B��z�z�.�)�)�
E��*�V�N�-C�C�D�D�D��#�#�D�$�/�/�/�
�5�6�6�6�6�6rN)rrrrHr�rrrr	r	�s2���������"7�7�7�7�7rr	c�*��eZdZ�fd�Zd�Zd�Z�xZS)r
c�~��d|vr|drtd���tt|��j|i|��dS)NrJz$PureProxy does not support SMTPUTF8.)r6�superr
rE)rr�r�r2s   �rrEzPureProxy.__init__�sP�����&�&�6�2C�+D�&��C�D�D�D�'��i����'��8��8�8�8�8�8rc��|�d��}d}|D]}|sn|dz
}�|�|d|dz��t�|��}|�|||��}td|t���dS)Nr rr.z
X-Peer: %szwe got some refusals:r#)r��insertrOr��_deliverr%r`)	rrZrirjr�rFr�r��refuseds	         rr�zPureProxy.process_message�s����
�
�4� � ��
���	�	�D��
���
��F�A�A�
���Q��t�A�w�.�/�/�/��|�|�E�"�"���-�-��'�4�8�8��
�%�w�[�A�A�A�A�A�Arc�P�ddl}i}	|���}|�|jd|jd��	|�|||��}|���n#|���wxYwn�#|j$r'}tdt���|j	}Yd}~nkd}~wt|jf$rT}td|jt���t|dd��}t|dd	��}	|D]	}
||	f||
<�
Yd}~nd}~wwxYw|S)
Nrr.zgot SMTPRecipientsRefusedr#�got�	smtp_code����
smtp_error�ignore)�smtplib�SMTP�connectr)�sendmail�quit�SMTPRecipientsRefusedr%r`�
recipientsr[�
SMTPExceptionr2r�)rrirjr�rXrQ�s�e�errcode�errmsg�rs           rrPzPureProxy._deliver�sb��������	/������A�
�I�I�d�&�q�)�4�+;�A�+>�?�?�?�
��*�*�X�w��=�=�����������������������,�	#�	#�	#��-�K�@�@�@�@��l�G�G�G�G�G�G�������.�/�	/�	/�	/��%���;�7�7�7�7��a��b�1�1�G��Q��h�7�7�F��
/�
/��%�v�.���
�
�
/�
/�
/�
/�
/�����	/�����s=�AB�	A5� B�5B�B�
D#�B;�;D#�A
D�D#)rrrrEr�rP�
__classcell__)r2s@rr
r
�sY�������9�9�9�9�9�
B�B�B�������rr
c��eZdZdZdZdZdZdS)�OptionsTr
NF)rrr�setuid�	classname�
size_limitrJrrrrgrgs"������
�F��I��J��O�O�Orrgc��	tjtjdd�dgd���\}}n,#tj$r}t	d|��Yd}~nd}~wwxYwt��}|D]�\}}|dvrt	d���|dvr)t
t��tjd���F|dvrd|_	�R|d	vr||_
�^|d
vr
tja�o|dvrd|_
�{|d
vrQ	t|��}||_��#t
d|ztj���tjd��Y��xYw��t!|��dkrd}d}nmt!|��dkr|d}d}nOt!|��dkr|d}|d}n+t	ddt"�|��z��|�d��}	|	dkrt	dd|z��|d|	�|_	t||	dzd���|_n##t,$rt	dd|z��YnwxYw|�d��}	|	dkrt	dd|z��|d|	�|_	t||	dzd���|_n##t,$rt	dd|z��YnwxYw|S)Nr.z	nVhc:s:du)zclass=�nosetuid�version�helpzsize=�debugr	)z-hz--helpr)z-Vz	--version)z-nz
--nosetuidF)z-cz--class)z-dz--debug)z-uz
--smtputf8T)z-sz--sizezInvalid size: r#zlocalhost:8025zlocalhost:25rsrzInvalid arguments: %s�:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)�getoptr(�argv�errorr,rgr%rbr*rhrir)r`rJrrjr��
COMMASPACEr�r��	localhost�	localportr6�
remotehost�
remoteport)
�optsr�ra�options�optr��int_size�	localspec�
remotespecr�s
          r�	parseargsrsN����]��H�Q�R�R�L�+�
�
�
���
��d�d���<����
�a�������������������i�i�G������S��"�"�"��!�H�H�H�H�
�'�
'�
'��+�����H�Q�K�K�K�K�
�(�
(�
(�"�G�N�N�
�%�
%�
%� #�G���
�%�
%�
%��*�K�K�
�(�
(�
(�&*�G�#�#�
�$�
$�
$�
��s�8�8��%-��"�"��
��&��,�3�:�>�>�>�>������������
%��4�y�y�1�}�}�$�	�#�
�
�	�T���Q�����G�	�#�
�
�	�T���Q�����G�	��!�W�
�
�
�a�(�:�?�?�4�+@�+@�@�A�A�A�	���s���A��1�u�u�
�a�%�	�1�2�2�2�!�"�1�"�
�G��3��	�!�A�#�$�$��0�0������3�3�3�
�a�%�	�1�2�2�2�2�2�3����������A��1�u�u�
�a�&��3�4�4�4�#�B�Q�B��G��5� ��A�a�C�D�D�!1�2�2������5�5�5�
�a�&��3�4�4�4�4�4�5�����NsD�-0�A�A�A�,D�4D9�H � I�?I�J!�!K�K�__main__r>r.)rJz7Cannot import module "pwd"; try running with -n option.r#�nobodyrsz3Cannot setuid "nobody"; try running with -n option.)r!)Ar&r(�osr]rqr3rVr�warningsrr�email._header_value_parserrr�__all__�_DEPRECATION_MSGrr*rCrr�programrbrr`rOrtrr,rDrr+rr	r
rgrrzri�rfind�lastdot�
__import__r'�locals�modr�r��class_rurvrwrxrjrJ�proxyrh�pwd�ImportErrorr%r)r*�getpwnamr��PermissionError�loop�KeyboardInterruptrrr�<module>r�s#��+�+�N�
�
�
�	�	�	�	�����
�
�
�
�����
�
�
�
�����&�&�&�&�&�&�&�&�D�D�D�D�D�D�D�D�����#����H�&�w�7�7�7�7�
���������(�1�+��-����������
�g�i�i��
��
�
�������z.�z.�z.�z.�z.�(�%�z.�z.�z.�zJ"�J"�J"�J"�J"��$�J"�J"�J"�Z7�7�7�7�7�j�7�7�7�<*�*�*�*�*�
�*�*�*�Z��������?�?�?�D�z����i�k�k�G��!�I�
�i����/�/�#�&�&���j��8�G�8�,�g�g�i�i�����B�4�H�H���g�a�i�j�j�)�	�	�����
�W�S�)�
$�
$�F��F�G�%�w�'8�9��&��(:�;��%�w�7N�
P�
P�
P�E��~��	��J�J�J�J���	�	�	��E�K�RU�R\�]�]�]�]��C�H�Q�K�K�K�K�K�	�������h�'�'��*��	��B�I�f�������	�	�	��E�G�c�j�Y�Y�Y�Y��C�H�Q�K�K�K�K�K�	����
���
��������
�
�
����
����9�s6�<F�'F+�*F+�G�'H�?H�H�H�H

Zerion Mini Shell 1.0