403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/__pycache__/mail.cpython-39.opt-1.pyc
a

�+�bXD�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZmZddlmZmZmZmZmZddlmZmZmZejr�ddlmZmZmZm Z Gd	d
�d
e
j!�Z"Gdd�de
j!�Z#d
d�Z$dd�Z%dd�Z&dd�Z'dd�Z(d;dd�Z)d<dd�Z*dd�Z+dd�Z,d=d!d"�Z-d#d$�Z.d%d&�Z/d'd(�Z0d>d)d*�Z1d?d+d,�Z2d@d-d.�Z3dAd/d0�Z4dBd1d2�Z5ej6�r�ej7j8Z9d3d4�Z:d5d6�Z;nej7j9Z9d7d4�Z:d8d6�Z;d9d:�Z<dS)C�)�absolute_importN�)�_)�getattr�open)�encoding�error�pycompat�sslutil�util)�procutil�
stringutil�urlutil)�Any�List�Tuple�Unionc@s$eZdZdZddd�Zddd�ZdS)	�STARTTLSz�Derived class to verify the peer certificate for STARTTLS.

    This class allows to pass any keyword arguments to SSL socket creation.
    NcKs$tjj|fi|��||_||_dS�N)�smtplib�SMTP�__init__�_ui�_host)�self�ui�host�kwargs�r�4/usr/lib64/python3.9/site-packages/mercurial/mail.pyr5szSTARTTLS.__init__cCsx|�d�sd}t�|��|�d�\}}|dkrptj|j|||j|jd�|_|j�	d�|_
d|_d|_i|_
d|_||fS)N�starttlss*STARTTLS extension not supported by serverr���rZserverhostname�rbr)Zhas_extnr�
SMTPExceptionZdocmdr
�
wrapsocket�sockrr�makefile�fileZ	helo_respZ	ehlo_respZesmtp_featuresZ
does_esmtp)r�keyfile�certfile�msgZrespZreplyrrrr :s$

�zSTARTTLS.starttls)N)NN)�__name__�
__module__�__qualname__�__doc__rr rrrrr/s
rc@s"eZdZdZddd�Zdd�ZdS)�SMTPSz�Derived class to verify the peer certificate for SMTPS.

    This class allows to pass any keyword arguments to SSL socket creation.
    NcKs8||_||_tjj|fi|��||_tj|_||_dSr)	r)r*rrrrZ
SMTP_SSL_PORTZdefault_portr)rrr)r*rrrrrrUszSMTPS.__init__cCs\|jdkr |j�d||ff�t�||f|�}tj||j|j|j|j	d�}|�
d�|_|S)Nrsconnect: %r
r"r#)Z
debuglevelr�debug�socketZcreate_connectionr
r%r)r*rr'r()rr�port�timeoutZ
new_socketrrr�_get_socket]s
�zSMTPS._get_socket)NNN)r,r-r.r/rr5rrrrr0Os
r0cCs4zddl}t|dd�WdSty.YdS0dS)z9Returns true iff Python has TLS support, false otherwise.rNZHAS_TLSFT)�sslr�ImportError)r6rrr�	_pyhastlslsr8c

s�|�dd�}|�dd�}|dkp(t�|�}|dk}|s:|rNt�sNt�td���|�dd�}|slt�td���|r�|�td	��t|||d
��n |r�t	|||d
��nt
j|d��|r�d}nd
}t�
|�dd|��}|�td�||f��j||d�|�r |�td�����������|�s,|�rF|�td��t��j�zt|�||�Wn8t
j�y�}zt�t�|���WYd}~n
d}~00�fdd�}	|	S)z;build an smtp connection and return a function to send mail�smtpslocal_hostnamestlssstarttlsssmtpss/can't use TLS: Python SSL support not installed�hosts+smtp.host not configured - cannot send mails(using smtps)
)�local_hostnamer)r;i��sports$sending mail: smtp host %s, port %d
)rr3s(using starttls)
s(verifying remote certificate)
Nc
s�z��|||�WStjy^}z4dd�|j��D�}t�dd�|���WYd}~n>d}~0tjy�}zt�t	�
|���WYd}~n
d}~00dS)NcSsg|]}|d�qS)rr)�.0�rrrr�
<listcomp>��z'_smtp.<locals>.send.<locals>.<listcomp>�
)�sendmailrZSMTPRecipientsRefused�
recipients�valuesr�Abort�joinr$r
�forcebytestr)�senderrCr+�inst��srr�send�s(z_smtp.<locals>.send)�configr
Z	parseboolr8rrEr�noter0rrrrZgetport�connectZehlor r
Zvalidatesocketr&�_smtp_loginr$rG)
rr;Ztlsr Zsmtps�mailhostZdefaultport�mailportrIrLrrJr�_smtpxsF&	rScCsz|�dd�}|�dd�}|rF|r,t�|�}n|��}|durFt�|�}|rv|rv|�td�|�t�|�}|�||�dS)azA hook for the keyring extension to perform the actual SMTP login.

    An already connected SMTP object of the proper type is provided, based on
    the current configuration.  The host and port to which the connection was
    established are provided for accessibility, since the SMTP object doesn't
    provide an accessor.  ``smtplib.SMTPException`` is raised on error.
    r9susernamespasswordNs&(authenticating to mail server as %s)
)rMr�strfromlocalZgetpassrNrZlogin)rZsmtprQrR�username�passwordrrrrP�s

rPc	Cs�|�dd�}dd�}d|||�d�t||��f}|�td�|�t�|d�}|�t�	|��|�
�}|r�t�d	t
j�t�|�d
�t�|�f��dS)zsend mail using sendmail.�email�methodcSst�t�t�|���Sr)rZ
shellquoter
�emailr�
strtolocal)�xrrr�stremail�sz_sendmail.<locals>.stremails%s -f %s %s� ssending mail: %s
�wbs%s %srN)rMrF�maprNrr�popen�writerZtonativeeol�closerrE�os�path�basenameZ
shellsplitZexplainexit)	rrHrCr+Zprogramr\Zcmdline�fp�retrrr�	_sendmail�s&����rhcCspt|d��R}t�dt���}|�dt�|�t�|�f�|�|�|�d�Wd�n1sb0YdS)zwrite mails to mboxsab+z%a %b %d %H:%M:%S %YsFrom %s %s
s

N)r�time�strftime�	localtimerarrZ)�mboxrHrCr+rf�daterrr�_mbox�s��
rncsB�rt�d����fdd�S��dd�dkr6t��S�fdd�S)znmake a mail connection. return a function to send mail.
    call as sendmail(sender, list-of-recipients, msg).r^cst�|||�Sr)rn�rKr>�m�rlrr�<lambda>�r@zconnect.<locals>.<lambda>rWrXr9cst�|||�Sr)rhro)rrrrr�r@)rrbrMrS)rrlr)rlrrrO�srOcCst||d�}||||�S)Nrq)rO)rrHrCr+rlrLrrrrB�srBcCsP|�dd�}|dkr0|�dd�sLt�td���nt�|�sLt�td�|��dS)z=determine if we have enough config data to try sending email.rWrXr9r:s>smtp specified as email transport, but no smtp host configureds0%r specified as email transport, but not in PATHN)rMrrErrZfindexe)r�methodrrr�validateconfig�s��

�rtcCs:tj�|�j��}|�d�r6|�d�s6d|dd�S|S)� Zisoziso-�N)rY�charset�CharsetZ
input_charset�lower�
startswith)�csrrr�
codec2ianasr|�plainFc	Cspddt�tj�t�tj�g}|r&dg}|D]8}z |�|�t||t|��WSty`Yq*0q*t||d�S)a2Return MIME message suitable for a patch.
    Charset will be detected by first trying to decode as us-ascii, then utf-8,
    and finally the global encodings. If all those fail, fall back to
    ISO-8859-1, an encoding with that allows all byte sequences.
    Transfer encodings will be used if necessary.�us-ascii�utf-8z
iso-8859-1)r	�sysstrr�fallbackencoding�decode�
mimetextqpr|�UnicodeDecodeError)rK�subtype�displayr{rwrrr�
mimetextpatchs	

�
r�cCs\tj�|�}tj��}|�d|�|��D]}t|�dkr,tjj|_	qLq,|�
||�|S)z[Return MIME message.
    Quoted-printable transfer encoding will be used if necessary.
    ztext/i�)rYrwrx�messageZMessageZset_type�
splitlines�lenZQPZ
body_encodingZset_payload)�bodyr�rwr{r+�linerrrr�3s

	r�cCsbdd�|�dd�D�}t�tj���t�tj���dg}|D]}||vr<|�|�q<dd�|D�S)z;Obtains charsets to send mail parts not containing patches.cSsg|]}t�|����qSr)r	r�ry�r=r{rrrr?Ps�z_charsets.<locals>.<listcomp>rWscharsetsrcSsg|]}|�d�s|�qS)�ascii)�endswithr�rrrr?\r@)Z
configlistr	r�rr�ry�append)r�charsetsZ	fallbacksr{rrr�	_charsetsMs
��r�cCsT|p
t|�}t|t�s�|D]T}z|�|�|fWStyDYqtyl|�td�t�	|��Yq0q|�dd�dfSz|�
d�Wn�t�yJtjtj
fD]�}t�|�}z|�
|�}Wnty�Yq�Yn0|D]`}z|�|�|fWYSt�yYq�t�y@|�td�t�	|��Yq�0q�q�Yn0|dfS)aReturns (converted) string, charset tuple.
    Finds out best charset by cycling through sendcharsets in descending
    order. Tries both encoding and fallbackencoding for input. Only as
    last resort send as is in fake ascii.
    Caveat: Do not use for mail parts containing patches!s!ignoring invalid sendcharset: %s
r��backslashreplacer~)r��
isinstance�bytes�encode�UnicodeEncodeError�LookupError�warnrr	Zsysbytesr�r�rr�r�)rrKr�ZsendcharsetsZocsZics�urrr�_encode_sF
��

��r�cCs0|s&t|||�\}}tj�||���St�|�S)z4Returns RFC-2047 compliant header from given string.)r�rY�headerZHeaderr�rrT�rrKr�r�r{rrr�
headencode�sr�cCs�t�|�}t|||�}z@|�d�\}}|�d�|�t�tj���d�}d||f}Wnhtyzt	�
td�|��YnFty�z|�d�Wn$ty�t	�
td�|��Yn0Yn0t
j�|t�|�f�S)N�@r�Zidnas%s@%ssinvalid email address: %ssinvalid local address: %s)rrZr��splitr�r	r�r�r�rrEr�
ValueErrorrY�utilsZ
formataddrrT)r�name�addrr�ZaccZdomrrr�_addressencode�s

r�cCs:|s|st�|pd�Stj�t�|��\}}t||||�S)z-Turns address into RFC-2047 compliant header.r@)rrTrYr�Z	parseaddrr�)rZaddressr�r�r�r�rrr�
addressencode�sr�c
Csng}|D]}|�t�|��q|r0dd�|D�Sg}tj�|�D](\}}|sP|r@t||||�}	|�|	�q@|S)z�Turns a list of addresses into a list of RFC-2047 compliant headers.
    A single element of input list may contain multiple addresses, but output
    always has one address per itemcSsg|]}|��r|���qSr)�strip)r=�arrrr?�r@z"addrlistencode.<locals>.<listcomp>)r�rrTrYr�Zgetaddressesr�)
rZaddrsr�r�Zstraddrsr��resultr�r�r>rrr�addrlistencode�sr�cCs$d}|st|||�\}}t|d|�S)zgcreates mime text object, encodes it if needed, and sets
    charset and transfer-encoding accordingly.r~r})r�r�r�rrr�
mimeencode�sr�cCsDtj��}tj|ddtd�d�}z|�|�W|��S|��0dS)Nr��surrogateescape�
)r�errors�newline)rY�parser�Parser�io�
TextIOWrapper�chr�parse�detach�rf�eprrrr��s
�
�r�cCstj��}|�|�Sr)rYr�ZBytesParser�
parsebytes��datar�rrrr��s
r�cCstj��}|�|�Sr)rYr�r�r�r�rrrr��s
cCstj��}|�|�Sr)rYr�r�Zparsestrr�rrrr��s
c
Cs�g}tj�|�D]�\}}|durPz|�|�|��WqWnttfyNYn0t|td��rj|�|�qz|�|�d��WqWnty�Yn0|�|�d��qt	�
d�|��S)zDecodes RFC-2047 headerN�zUTF-8z
ISO-8859-1ru)rYr�Z
decode_headerr�r�r�r�r��typerZ
unitolocalrF)rKZuparts�partrwrrr�
headdecode�s$
r�)N)N)r}F)NF)N)NF)NF)NF)=Z
__future__rrYZ
email.charsetZemail.generatorZemail.headerZ
email.messageZemail.parserr�rcrr2riZi18nrr	rrr�rrr
rr�rr
r�
TYPE_CHECKING�typingrrrrrrr0r8rSrPrhrnrOrBrtr|r�r�r�r�r�r�r�r�r�Zispy3�	generatorZBytesGenerator�	Generatorr�r�r�rrrr�<module>sZ 4


3



	





Youez - 2016 - github.com/yon3zu
LinuXploit