uawdijnntqw1x1x1
IP : 3.129.24.240
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
..
/
lib64
/
td-agent-bit
/
..
/
python3.8
/
collections
/
..
/
__pycache__
/
smtpd.cpython-38.opt-2.pyc
/
/
U e5d���@sZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddlmZm Z dddddgZejdZd ZGd d�d�Ze�adZd ZdZd$dd�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�d�Zdd�Z e!dk�rVe �Z"e"j#Z#de#k�rle#�$d�Z%e&e#de%�e'�e(�dg�Z)e#e%dd�Z#nddl*Z)e+e)e#�Z,e,e"j-e"j.fe"j/e"j0fe"j1e"j2d�Z3e"j4�r2zddl5Z5Wn.e6k �r�e7dej8d �e�9d�YnXe5�:d!�d"Z;ze�4e;�Wn.e<k �r0e7d#ej8d �e�9d�YnXze�=�Wne>k �rTYnXdS)%�N)�warn)� get_addr_spec�get_angle_addr�SMTPChannel� SMTPServer�DebuggingServer� PureProxy�MailmanProxyzPython SMTP proxy version 0.3c@seZdZdd�Zdd�ZdS)�DevnullcCsdS�N���self�msgrr�/usr/lib64/python3.8/smtpd.py�writef�z Devnull.writecCsdSrr�rrrr�flushgrz Devnull.flushN)�__name__� __module__�__qualname__rrrrrrr esr � z, i�cCs4ttt�tjd�|r&t|tjd�t�|�dS)N��file)�print�__doc__�globals�sys�stderr�exit)�coderrrr�usagepsr#c@s�eZdZdZdZdZe�efdd��Ze dd��Z edd d fd d�Zdd �Z dd�Ze dd��Zejdd��Ze dd��Zejdd��Ze dd��Zejdd��Ze dd��Zejdd��Ze dd��Zejdd��Ze dd ��Zejd!d ��Ze d"d#��Zejd$d#��Ze d%d&��Zejd'd&��Ze d(d)��Zejd*d)��Ze d+d,��Zejd-d,��Ze d.d/��Zejd0d/��Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dS)Srr�icCs|Srr)�xrrr�<lambda>|rzSMTPChannel.<lambda>cCs0zt|j���WStk r*|jYSXdSr)�max�command_size_limits�values� ValueError�command_size_limitrrrr�max_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc Cs&tjj|||d�||_||_||_||_||_||_|rF|rFt d��|rdd|_ d|_d|_t |_nd|_ d|_td�|_d |_|��d|_d |_|j��t��|_z|��|_WnBtk r�}z$|��|jdtjkr�WY�dSd}~XYnXtdt |j�t!d �|�"d|jt#f�dS)N��map�Fdecode_data and enable_SMTPUTF8 cannot be set to True at the same timer� �.r� �.� FrzPeer:rz 220 %s %s)$�asynchat� async_chat�__init__�smtp_server�conn�addr�data_size_limit�enable_SMTPUTF8�_decode_datar*�_emptystring�_linesep�_dotsep�NEWLINE�_newline�ord�_set_rset_state� seen_greeting� extended_smtpr(�clear�socketZgetfqdn�fqdnZgetpeername�peer�OSError�close�args�errnoZENOTCONNr�repr�DEBUGSTREAM�push�__version__) rZserverr9r:r;r.r<�decode_data�errrrrr7�s@ zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|�d�dS)NFrr2)�COMMAND� smtp_state�mailfrom�rcpttos�require_SMTPUTF8� num_bytes�set_terminatorrrrr�_set_post_data_state�sz SMTPChannel._set_post_data_statecCs|��d|_g|_dS�Nr)r\� received_data�received_linesrrrrrD�szSMTPChannel._set_rset_statecCstdtd�|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead��r�DeprecationWarningr8rrrr�__server�s �zSMTPChannel.__servercCstdtd�||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadr`ra�r�valuerrrrc�s �cCstdtd�|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadr`�rrbr_rrrr�__line�s �zSMTPChannel.__linecCstdtd�||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadr`rfrdrrrrg�s �cCstdtd�|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadr`�rrbrVrrrr�__state�s �zSMTPChannel.__statecCstdtd�||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadr`rhrdrrrri�s �cCstdtd�|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadr`�rrbrErrrr� __greeting�s �zSMTPChannel.__greetingcCstdtd�||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadr`rjrdrrrrk�s �cCstdtd�|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadr`�rrbrWrrrr� __mailfrom�s �zSMTPChannel.__mailfromcCstdtd�||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadr`rlrdrrrrm�s �cCstdtd�|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadr`�rrbrXrrrr� __rcpttos�s �zSMTPChannel.__rcpttoscCstdtd�||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadr`rnrdrrrro�s �cCstdtd�|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadr`�rrbr^rrrr�__data�s �zSMTPChannel.__datacCstdtd�||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadr`rprdrrrrqs �cCstdtd�|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadr`�rrbrIrrrr�__fqdn s �zSMTPChannel.__fqdncCstdtd�||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadr`rrrdrrrrss �cCstdtd�|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadr`�rrbrJrrrr�__peers �zSMTPChannel.__peercCstdtd�||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadr`rtrdrrrrus �cCstdtd�|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadr`�rrbr9rrrr�__conn s �zSMTPChannel.__conncCstdtd�||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadr`rvrdrrrrw%s �cCstdtd�|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadr`�rrbr:rrrr�__addr+s �zSMTPChannel.__addrcCstdtd�||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadr`rxrdrrrry0s �cCs&tj�|t|d|jrdnd��dS)Nr0�utf-8�ascii)r5r6rQ�bytesrYr rrrrQ7s �zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|kr<dS|rR|jt|�7_|jrl|j� t |d��n|j� |�dS)Nrz)rVrUr,�DATAr;rZ�lenr=r_�append�str)r�data�limitrrr�collect_incoming_data<sz!SMTPChannel.collect_incoming_datac Cs|j�|j�}tdt|�td�g|_|j|jk�r|jd}|_|sT|� d�dS|j sdt|d�}|�d�}|dkr�|� �}d}n$|d|�� �}||dd���}|jr�|j|n|j}||kr�|� d�dSt|d |d�}|s�|� d |�dS||�dS|j|jk�r(|� d�d|_dS|j�rR|j|jk�rR|� d�d|_dSg}|�|j�D]:} | �r�| d|jk�r�|�| dd��n |�| ��qb|j�|�|_|j|j|j|jf} i}|j �s�|j|jd �}|j j!| |�}|�"�|�s|� d�n |� |�dS)NzData:rrz500 Error: bad syntaxrz� r$z500 Error: line too longZsmtp_z&500 Error: command "%s" not recognizedz451 Internal confusionz552 Error: Too much mail data)�mail_options�rcpt_options�250 OK)#r>�joinr_rrOrPrVrUrZrQr=r��find�upper�striprFr(r+�getattrr}r;�splitr?r@rrBr^rJrWrXr�r�r8�process_messager\) r�lineZsz�i�command�argZmax_sz�methodr��textrM�kwargsZstatusrrr�found_terminatorLsl �� �zSMTPChannel.found_terminatorcCsH|s|�d�dS|jr&|�d�dS|��||_|�d|j�dS)Nz501 Syntax: HELO hostname�503 Duplicate HELO/EHLOz250 %s)rQrErDrI�rr�rrr� smtp_HELO�s zSMTPChannel.smtp_HELOcCs�|s|�d�dS|jr&|�d�dS|��||_d|_|�d|j�|jrr|�d|j�|jdd7<|js�|�d�|jr�|�d �|jdd 7<|�d�dS)Nz501 Syntax: EHLO hostnamer�Tz250-%sz250-SIZE %s�MAIL�z250-8BITMIMEz250-SMTPUTF8� z250 HELP) rQrErDrFrIr;r(r=r<r�rrr� smtp_EHLO�s& zSMTPChannel.smtp_EHLOcCs|r|�d�n |�d�dS)Nz501 Syntax: NOOPr��rQr�rrr� smtp_NOOP�szSMTPChannel.smtp_NOOPcCs|�d�|��dS)Nz221 Bye)rQZclose_when_doner�rrr� smtp_QUIT�s zSMTPChannel.smtp_QUITcCs0t|�}|d|���|kr,||d���SdSr])r~r�r�)r�keywordr�Zkeylenrrr�_strip_command_keyword�sz"SMTPChannel._strip_command_keywordcCsF|sdS|���d�r$t|�\}}nt|�\}}|s<||fS|j|fS)N)rr�<)�lstrip� startswithrrZ addr_spec)rr��address�restrrr�_getaddr�szSMTPChannel._getaddrcCsHi}|D]:}|�d�\}}}|��r,|r2|s2dS|r:|nd||<q|S)N�=T)� partition�isalnum)r�params�resultZparam�eqrerrr� _getparams�szSMTPChannel._getparamscCs|r�d}|��}|dkr$|�d�q�|dkr8|�d�q�|dkr^d}|jrR||7}|�|�q�|dkr�d }|jrx||7}|�|�q�|d kr�|�d�q�|dkr�|�d �q�|dkr�|�d�q�|dkr�|�d�q�|dkr�|�d�q�|�d�n |�d�dS)N� [SP <mail-parameters>]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamer�z 250 Syntax: MAIL FROM: <address>ZRCPTz250 Syntax: RCPT TO: <address>r}z250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 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�rQrF)rr�ZextendedZlc_argrrrr� smtp_HELP�s:zSMTPChannel.smtp_HELPcCs@|r2|�|�\}}|r"|�d�q<|�d|�n |�d�dS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY <address>)r�rQ)rr�r�r�rrr� smtp_VRFY�szSMTPChannel.smtp_VRFYcCs�|js|�d�dStd|td�d}|jr4|d7}|dkrJ|�|�dS|�d|�}|�|�\}}|sv|�|�dS|js�|r�|�|�dS|jr�|�d�dS|��� �|_ |�|j �}|dkr�|�|�dS|js�|� dd �}|d kr�|�d�dS|j�r8|� dd �}|dk�r d|_n|d k �r8|�d�dS|� dd�}|�r�|���sb|�|�dS|j�r�t|�|jk�r�|�d�dSt|���dk�r�|�d�dS||_td|jtd�|�d�dS)N�503 Error: send HELO firstz ===> MAILrz 501 Syntax: MAIL FROM: <address>r�zFROM:z503 Error: nested MAIL commandZBODY�7BIT)r�Z8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:r�)rErQrrPrFr�r�rWr�r�r�r�r=�popr<rY�isdigitr;�intr~�keys)rr�� syntaxerrr�r�Zbody�smtputf8�sizerrr� smtp_MAILsh zSMTPChannel.smtp_MAILcCs|js|�d�dStd|td�|js6|�d�dSd}|jrH|d7}|dkr^|�|�dS|�d|�}|�|�\}}|s�|�|�dS|js�|r�|�|�dS|��� �|_ |�|j �}|dkr�|�|�dSt|� ��dkr�|�d �dS|j�|�td |jtd�|�d�dS)Nr�z ===> RCPTrz503 Error: need MAIL commandz501 Syntax: RCPT TO: <address>r�zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:r�)rErQrrPrWrFr�r�r�r�r�r�r~r�rXr)rr�r�r�r�rrr� smtp_RCPT7s@ zSMTPChannel.smtp_RCPTcCs(|r|�d�dS|��|�d�dS)Nz501 Syntax: RSETr�)rQrDr�rrr� smtp_RSETZs zSMTPChannel.smtp_RSETcCsZ|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>)rErQrXr}rVr[r�rrr� smtp_DATAas zSMTPChannel.smtp_DATAcCs|�d�dS)Nz502 EXPN not implementedr�r�rrr� smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrUr}r+�collections�defaultdictr(�propertyr,�DATA_SIZE_DEFAULTr7r\rDZ_SMTPChannel__server�setterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrQr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrws� � ' >#6#c@s2eZdZeZedddfdd�Zdd�Zdd�ZdS) rNFcCs�||_||_||_||_||_|r.|r.td��tjj||d�zNt j |dt ji�}|�|dd|dd�|� �|�|�|�d�Wn|���Yn(Xtd|jjt�t���||ftd�dS) Nr/r-�typerr$�z0%s started at %s Local addr: %s Remote addr:%sr)Z _localaddr�_remoteaddrr;r<r=r*�asyncore� dispatcherr7rHZgetaddrinfoZSOCK_STREAMZ create_socketZset_reuse_addrZbindZlistenrLr� __class__r�time�ctimerP)rZ localaddrZ remoteaddrr;r.r<rSZgai_resultsrrrr7xs6� ��zSMTPServer.__init__c Cs6tdt|�td�|�||||j|j|j|j�}dS)NzIncoming connection from %sr)rrOrP� channel_classr;�_mapr<r=)rr9r:Zchannelrrr�handle_accepted�s�zSMTPServer.handle_acceptedcKst�dSr)�NotImplementedError�rrJrWrXr�r�rrrr��szSMTPServer.process_message) rrrrr�r�r7r�r�rrrrrts� c@seZdZdd�Zdd�ZdS)rcCsld}|��}|D]V}|rL|sLd|d}t|t�s@t|�d��}t|�d}t|t�s^t|�}t|�qdS)Nr$zX-Peer: rrz)� splitlines� isinstancer�rO�encoder)rrJr�Z inheaders�linesr�Z peerheaderrrr�_print_message_content�s z&DebuggingServer._print_message_contentcKsXtd�|r@|�d�r&td|d�|�d�r@td|d�|�||�td�dS)Nz%---------- MESSAGE FOLLOWS ----------r�zmail options: %sr�zrcpt options: %s z%------------ END MESSAGE ------------)r�getr�r�rrrr��s zDebuggingServer.process_messageN)rrrr�r�rrrrr�scs,eZdZ�fdd�Zdd�Zdd�Z�ZS)rcs.d|kr|drtd��tt|�j||�dS)Nr<z$PureProxy does not support SMTPUTF8.�r*�superrr7�rrMr��r�rrr7�szPureProxy.__init__c Csf|�d�}d}|D]}|sq(|d7}q|�|d|d�t�|�}|�|||�}td|td�dS)Nrrr$z X-Peer: %szwe got some refusals:r)r��insertrAr��_deliverrrP) rrJrWrXr�r�r�r��refusedrrrr��s zPureProxy.process_messagec Cs�ddl}i}zB|��}|�|jd|jd�z|�|||�}W5|��XWn�|jk r�}ztdtd�|j }W5d}~XYnft |jfk r�}zBtd|jtd�t |dd�}t |dd �} |D]} || f|| <q�W5d}~XYnX|S) Nrr$zgot SMTPRecipientsRefusedrZgotZ smtp_code���Z smtp_error�ignore)�smtplibZSMTPZconnectr��quitZsendmailZSMTPRecipientsRefusedrrPZ recipientsrKZ SMTPExceptionr�r�)rrWrXr�r�r��s�eZerrcode�errmsg�rrrrr��s$ zPureProxy._deliver)rrrr7r�r�� __classcell__rrr�rr�scs$eZdZ�fdd�Zdd�Z�ZS)r cs.d|kr|drtd��tt|�j||�dS)Nr<z'MailmanProxy does not support SMTPUTF8.r�r�r�rrr7 szMailmanProxy.__init__cCs*ddlm}ddlm}ddlm}ddlm}g} |D]t} | ���d�d}|�d�}t|�dkrfq8|d} t|�dkr�|d }nd }|� | �r8|dkr�q8| � | | |f�q8| D]\} } }|�| �q�tdd � |�td�|r�|�|||�}td|td�i}||�}|�|�}|�d��s&||d<|�d��sDt�t���|d<| D]�\} } }td| td�|�| �}|�s�|j| dd�}||| <|d k�r�|j|d d�n�|dk�r�|j|d d�nh|dk�r�|j|d d�nN|dk�r�|j|d d�n4|dk�rH|dk�rd|d <nd!|d <|j|d d��qHdS)"Nr)�StringIO)�Utils)�Message)�MailList�@�-r`r$r)r�admin�owner�requestr��leavezforwarding recips:r�rzwe got refusals:�fromZFrom�dateZDatezsending message to)�lock)�tolistr�)Ztoadminr�)Ztoownerr�)Z torequest)r�r�r�Z subscribeZSubjectZunsubscribe)�ior�ZMailmanr�r�r��lowerr�r~Zlist_existsr�removerr�rPr�r�r�r�ZEnqueue)rrJrWrXr�r�r�r�r�Z listnamesZrcptZlocal�partsZlistnamer�r�Zmlistsr�rZmlistrrrr�sb zMailmanProxy.process_message)rrrr7r�r�rrr�rr sc@seZdZdZdZdZdZdS)�OptionsTrNF)rrr�setuid� classname� size_limitr<rrrrr�_sr�c Cspz.t�tjdd�dddddddd g�\}}Wn.tjk r\}ztd|�W5d}~XYnXt�}|D]�\}}|d kr�td�qh|dkr�tt�t�d�qh|d kr�d|_ qh|dkr�||_ qh|dkr�tjaqh|dkr�d|_ qh|dkrhzt|�}||_Wqhtd|tjd�t�d�YqhXqht|�dk�r<d}d}nPt|�dk�rX|d}d}n4t|�dk�rx|d}|d}ntddt�|��|�d�} | dk�r�tdd|�|d| �|_zt|| dd��|_Wn$tk �r�tdd|�YnX|�d�} | dk�rtdd|�|d| �|_zt|| dd��|_Wn$tk �rjtdd|�YnX|S) Nr$z nVhc:s:duzclass=Znosetuid�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: rzlocalhost:8025zlocalhost:25r`�zInvalid arguments: %s�:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)�getoptr�argv�errorr#r�rrRr!r�r�r rPr<r�r�r~� COMMASPACEr�r�� localhost� localportr*� remotehost� remoteport) ZoptsrMr��options�optr�Zint_sizeZ localspecZ remotespecr�rrr� parseargsfsv�� r�__main__r1r$)r<z7Cannot import module "pwd"; try running with -n option.r�nobodyr`z3Cannot setuid "nobody"; try running with -n option.)r)?r�osrNrr�rHr�r5r��warningsrZemail._header_value_parserrr�__all__rZprogramrRr rPrArr�r#r6rr�rrrr r�rrrr��rfindZlastdot� __import__r�locals�modrr�Zclass_rr r rr�r<�proxyr��pwd�ImportErrorrr r!�getpwnamr�PermissionErrorZloop�KeyboardInterruptrrrr�<module>Ps�� M-SB �
/home/../lib64/td-agent-bit/../python3.8/collections/../__pycache__/smtpd.cpython-38.opt-2.pyc