Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/smtplib.cpython-37.opt-2.pyc

B

YI~d���
@slddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Zddddddd	d
ddd
ddg
ZdZdZdZdZdZe�dej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	e�ZGdd
�d
e�Z Gdd�de�Z!Gdd�de�Z"d d
�Z#d!d"�Z$d#d�Z%d$d%�Z&d&d'�Z'yddl(Z(Wne)k
�r�d(Z*YnXd)Z*Gd*d�d�Z+e*�r�Gd+d,�d,e+�Z,e�-d,�d-Z.Gd.d/�d/e+�Z/e0d0k�rhd1d2�Z1e1d3�Z2e1d4��3d5�Z4e5d6�d7Z6x ej7�8�Z9e9�s"Pe6e9Z6�qWe5d8e:e6��e+d9�Z;e;�<d:�e;�=e2e4e6�e;�>�dS);�N)�body_encode�
SMTPException�SMTPNotSupportedError�SMTPServerDisconnected�SMTPResponseException�SMTPSenderRefused�SMTPRecipientsRefused�
SMTPDataError�SMTPConnectError�
SMTPHeloError�SMTPAuthenticationError�	quoteaddr�	quotedata�SMTP�i�z
s
i z	auth=(.*)c@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�,/opt/alt/python37/lib64/python3.7/smtplib.pyrGsc@seZdZdS)rN)rrrrrrrrJsc@seZdZdS)rN)rrrrrrrrQsc@seZdZdd�ZdS)rcCs||_||_||f|_dS)N)�	smtp_code�
smtp_error�args)�self�code�msgrrr�__init__bszSMTPResponseException.__init__N)rrrrrrrrrYs	c@seZdZdd�ZdS)rcCs"||_||_||_|||f|_dS)N)rr�senderr)rrrrrrrrnszSMTPSenderRefused.__init__N)rrrrrrrrrgsc@seZdZdd�ZdS)rcCs||_|f|_dS)N)�
recipientsr)rrrrrr|szSMTPRecipientsRefused.__init__N)rrrrrrrrrtsc@seZdZdS)r	N)rrrrrrrr	�sc@seZdZdS)r
N)rrrrrrrr
�sc@seZdZdS)rN)rrrrrrrr�sc@seZdZdS)rN)rrrrrrrr�scCs>tj�|�\}}||fdkr6|���d�r.|Sd|Sd|S)N)�r�<z<%s>)�email�utils�	parseaddr�strip�
startswith)�
addrstring�displayname�addrrrrr
�scCs$tj�|�\}}||fdkr |S|S)N)rr)r!r"r#)r&r'r(rrr�
_addr_only�sr)c	Cst�ddt�dt|��S)Nz(?m)^\.z..z(?:\r\n|\n|\r(?!\n)))�re�sub�CRLF)�datarrrr�scCst�dd|�S)Ns(?m)^\.s..)r*r+)Zbindatarrr�_quote_periods�sr.cCst�dt|�S)Nz(?:\r\n|\n|\r(?!\n)))r*r+r,)r-rrr�	_fix_eols�sr/FTc@sreZdZdZdZdZdZdZdZe	Z
dddejdfdd�Z
dd�Zd	d
�Zdd�Zd
d�Zdd�ZdMdd�Zdd�ZdNdd�Zdd�ZdOdd�ZdPdd�ZdQdd�Zd d!�ZdRd"d#�Zd$d%�Zd&d'�Zd(d)�ZdSd+d,�ZdTd-d.�Z d/d0�Z!d1d2�Z"e"Z#d3d4�Z$d5d6�Z%d7d8�d9d:�Z&dUd;d<�Z'dVd=d>�Z(dWd?d@�Z)d7d8�dAdB�Z*dXdCdD�Z+dYdEdF�Z,dZdGdH�Z-dIdJ�Z.dKdL�Z/dS)[rrN�ehlorc
Cs�||_||_i|_d|_||_|rL|�||�\}}|dkrL|��t||��|dk	r\||_nPt	�
�}d|krt||_n8d}	yt	�t	���}	Wnt	j
k
r�YnXd|	|_dS)N�ascii���.z	127.0.0.1z[%s])�_host�timeout�esmtp_features�command_encoding�source_address�connect�closer
�local_hostname�socketZgetfqdnZ
gethostbynameZgethostnameZgaierror)
r�host�portr;r5r8rrZfqdnr(rrrr�s*
z
SMTP.__init__cCs|S)Nr)rrrr�	__enter__szSMTP.__enter__cGsNz>y$|�d�\}}|dkr$t||��Wntk
r:YnXWd|��XdS)NZQUIT��)�docmdrrr:)rrr�messagerrr�__exit__s
z
SMTP.__exit__cCs
||_dS)N)�
debuglevel)rrDrrr�set_debuglevelszSMTP.set_debuglevelcGs@|jdkr,ttj����f|�dtji�nt|dtji�dS)N��file)rD�print�datetimeZnowZtime�sys�stderr)rrrrr�_print_debug's
"zSMTP._print_debugcCs2|jdkr|�d||f|j�t�||f||j�S)Nrzconnect: to)rDrLr8r<�create_connection)rr=r>r5rrr�_get_socket-s
zSMTP._get_socket�	localhostcCs�|r
||_|s||�d�|�d�kr||�d�}|dkr||d|�||dd�}}yt|�}Wntk
rztd��YnX|s�|j}|jdkr�|�d||f�|�	|||j
�|_d|_|�
�\}}|jdkr�|�dt|��||fS)N�:rrFznonnumeric portzconnect:)r8�find�rfind�int�
ValueError�OSError�default_portrDrLrNr5�sockrG�getreply�repr)rr=r>r8�irrrrrr95s(


zSMTP.connectcCs�|jdkr|�dt|��t|d�rx|jrxt|t�r@|�|j�}y|j�	|�Wq�t
k
rt|��td��Yq�Xntd��dS)Nrzsend:rWzServer not connectedzplease run connect() first)
rDrLrY�hasattrrW�
isinstance�str�encoder7ZsendallrUr:r)r�srrr�sendWs

z	SMTP.sendcCsd|dkr|}n|�d|��}d|ks,d|krN|�dd��dd�}td|����|�|�t���dS)Nr� �
�
z\nz\rz=command and arguments contain prohibited newline characters: )�replacerTr`r,)r�cmdrr_rrr�putcmdiszSMTP.putcmdc
CsPg}|jdkr|j�d�|_�xy|j�td�}Wn:tk
rn}z|��tdt|���Wdd}~XYnX|s�|��td��|j	dkr�|�
dt|��t|�tkr�|��t
dd��|�|d	d��d
��|dd�}yt|�}Wntk
�rd}PYnX|dd	�d
kr Pq Wd�|�}|j	dk�rH|�
d||f�||fS)N�rbrFz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:i�zLine too long.�s 	
�����-�
zreply: retcode (%s); Msg: %a)rGrWZmakefile�readline�_MAXLINErUr:rr]rDrLrY�lenr�appendr$rSrT�join)r�resp�line�erZerrcode�errmsgrrrrXvs>




z
SMTP.getreplycCs|�||�|��S)N)rfrX)rrerrrrrA�sz
SMTP.docmdcCs,|�d|p|j�|��\}}||_||fS)N�helo)rfr;rX�	helo_resp)r�namerrrrrrv�sz	SMTP.heloc
Cs2i|_|�|j|p|j�|��\}}|dkrJt|�dkrJ|��td��||_|dkr`||fSd|_	|j�
d��d�}|d=x�|D]�}t�
|�}|r�|j�dd	�d
|�d�d|jd<q�t�
d|�}|r�|�d���}|j|�d�d���}	|dk�r|j�|d	�d
|	|j|<q�|	|j|<q�W||fS)
NrjrzServer not connected�rFzlatin-1rc�authrraz((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?�feature)r6rf�ehlo_msgr;rXror:r�	ehlo_resp�
does_esmtp�decode�split�
OLDSTYLE_AUTH�match�get�groupsr*�group�lower�string�endr$)
rrxrrrr�eachZ
auth_match�mr{�paramsrrrr0�s2

&
z	SMTP.ehlocCs|��|jkS)N)r�r6)r�optrrr�has_extn�sz
SMTP.has_extncCs|�d|�|��dS)N�helprF)rfrX)rrrrrr��sz	SMTP.helpcCsd|_|�d�S)Nr1�rset)r7rA)rrrrr��sz	SMTP.rsetcCs&y|��Wntk
r YnXdS)N)r�r)rrrr�_rset�sz
SMTP._rsetcCs
|�d�S)N�noop)rA)rrrrr�sz	SMTP.nooprcCshd}|rH|jrHtdd�|D��r:|�d�r2d|_ntd��dd�|�}|�dd	t|�|f�|��S)
Nrcss|]}|��dkVqdS)�smtputf8N)r�)�.0�xrrr�	<genexpr>szSMTP.mail.<locals>.<genexpr>r�zutf-8z SMTPUTF8 not supported by serverra�mailz	FROM:%s%s)	r~�anyr�r7rrqrfr
rX)rr�options�
optionlistrrrr�	s	

z	SMTP.mailcCs<d}|r|jrdd�|�}|�ddt|�|f�|��S)Nrra�rcptzTO:%s%s)r~rqrfr
rX)rZrecipr�r�rrrr�s

z	SMTP.rcptcCs�|�d�|��\}}|jdkr0|�d||f�|dkrDt||��n|t|t�r\t|��d�}t	|�}|dd�t
kr||t
}|dt
}|�|�|��\}}|jdkr�|�d||f�||fSdS)Nr-rzdata:ibr1����.)rfrXrDrLr	r\r]r/r^r.�bCRLFr`)rrr�repl�qrrrr-&s"





z	SMTP.datacCs|�dt|��|��S)N�vrfy)rfr)rX)r�addressrrr�verifyCszSMTP.verifycCs|�dt|��|��S)N�expn)rfr)rX)rr�rrrr�Jsz	SMTP.expncCsb|jdkr^|jdkr^d|��dkr0dks^n|��\}}d|krRdks^nt||��dS)N��ri+)rwr}r0rvr)rrrrrrr�ehlo_or_helo_if_neededQs
zSMTP.ehlo_or_helo_if_neededT)�initial_response_okc	Cs�|��}|r|�nd}|dk	rJt|�d�dd�}|�d|d|�\}}n|�d|�\}}|dkr�t�|�}t||��d�dd�}|�|�\}}|dkr�||fSt||��dS)Nr1r)ZeolZAUTHraiN)��i�)�upper�
encode_base64r^rA�base64Zdecodebytesr)	rZ	mechanismZ
authobjectr�Zinitial_responseZresponserrr�	challengerrrrzbs
z	SMTP.authcCs0|dkrdS|jdt�|j�d�|d���S)Nrar1Zmd5)�user�hmacZHMAC�passwordr^Z	hexdigest)rr�rrr�
auth_cram_md5�szSMTP.auth_cram_md5cCsd|j|jfS)Nz%s%s)r�r�)rr�rrr�
auth_plain�szSMTP.auth_plaincCs|dkr|jS|jSdS)N)r�r�)rr�rrr�
auth_login�szSMTP.auth_logincs�|��|�d�std��|jd���dddg}�fdd�|D�}|sPtd��|||_|_xv|D]n}d	|���	d
d�}y.|j
|t||�|d�\}}	|d
kr�||	fSWqdtk
r�}
z|
}Wdd}
~
XYqdXqdW|�dS)Nrzz,SMTP AUTH extension not supported by server.zCRAM-MD5ZPLAINZLOGINcsg|]}|�kr|�qSrr)r�rz)�advertised_authlistrr�
<listcomp>�szSMTP.login.<locals>.<listcomp>z(No suitable authentication method found.Zauth_�-�_)r�)r�i�)
r�r�rr6r�rr�r�r�rdrz�getattrr)rr�r�r�Zpreferred_authsZauthlistZ
authmethodZmethod_namerrrrtZlast_exceptionr)r�r�login�s*



z
SMTP.logincCs�|��|�d�std��|�d�\}}|dkr�ts<td��|dk	rT|dk	rTtd��|dk	rl|dk	rltd��|dk	s||dk	r�ddl}|�d	t	d
�|dkr�t
j||d�}|j|j
|jd�|_
d|_d|_d|_i|_d|_n
t||��||fS)
N�starttlsz+STARTTLS extension not supported by server.ZSTARTTLSr2z&No SSL support included in this Pythonz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context instead�)�certfile�keyfile)�server_hostname)r�r�rrA�	_have_ssl�RuntimeErrorrT�warnings�warn�DeprecationWarning�ssl�_create_stdlib_context�wrap_socketrWr4rGrwr}r6r~r)rr�r��contextrrZreplyr�rrrr��s8

z
SMTP.starttlscCsf|��g}t|t�r$t|��d�}|jr^|�d�rF|�dt|��x|D]}|�|�qLW|�	||�\}}	|dkr�|dkr�|�
�n|��t||	|��i}
t|t�r�|g}xP|D]H}|�
||�\}}	|dkr�|dkr�||	f|
|<|dkr�|�
�t|
��q�Wt|
�t|�k�r$|��t|
��|�|�\}}	|dk�rb|dk�rP|�
�n|��t||	��|
S)Nr1�sizezsize=%dryi��)r�r\r]r/r^r~r�rpror�r:r�rr�rr-r	)r�	from_addr�to_addrsr�mail_options�rcpt_optionsZ
esmtp_opts�optionrrrZsenderrsr�rrr�sendmailsF@









z
SMTP.sendmailc	Cs�|��|�d�}|dkr d}nt|�dkr2d}ntd��|dkr||d|krZ||dn
||d}tj�|g�dd}|dkr�d	d
�||d||d||d
fD�}dd
�tj�|�D�}t�|�}	|	d=|	d=d}
yd�|f|���	d�Wn.t
k
�r(|�d��s td��d}
YnXt
���R}|
�r^tjj||jjdd�d�}|d�}ntj�|�}|j|	dd�|��}
WdQRX|�|||
||�S)NzResent-DaterrFzResent-z0message has more than one 'Resent-' header blockZSender�FromrcSsg|]}|dk	r|�qS)Nr)r��frrrr��sz%SMTP.send_message.<locals>.<listcomp>�ToZBccZCccSsg|]}|d�qS)rFr)r��arrrr��sz
Resent-BccFr1r�z�One or more source or delivery addresses require internationalized email support, but the server does not advertise the required SMTPUTF8 capabilityT)�utf8)�policy�SMTPUTF8�
BODY=8BITMIMEz
)�linesep)r�r�)r�Zget_allrorTr!r"Zgetaddresses�copyrqr^�UnicodeEncodeErrorr�r�io�BytesIO�	generatorZBytesGeneratorr�ZcloneZflatten�getvaluer�)rrr�r�r�r�ZresentZ
header_prefixZaddr_fieldsZmsg_copy�
internationalZbytesmsg�gZflatmsgrrr�send_message�sJ





zSMTP.send_messagecCs<z|j}d|_|r|��Wd|j}d|_|r6|��XdS)N)rGr:rW)rrGrWrrrr:�sz
SMTP.closecCs.|�d�}d|_|_i|_d|_|��|S)N�quitF)rAr}rwr6r~r:)rZresrrrr��s
z	SMTP.quit)rOrN)r)r)r)r)r)r)r)N)N)N)NNN)rr)NNrr)0rrrrDrGrwr|r}r~�	SMTP_PORTrVr<�_GLOBAL_DEFAULT_TIMEOUTrr?rCrErLrNr9r`rfrXrArvr0r�r�r�r�r�r�r�r-r�r�r�r�rzr�r�r�r�r�r�r�r:r�rrrrr�s\-
	
"

1



3


'
	

B
8
g
L
c@s4eZdZeZdddddejddfdd�Zdd�ZdS)�SMTP_SSLrrNc	
Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}	|	�dtd�||_||_|dkrxtj||d�}||_t	�
||||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr�)r�r�)rTr�r�r�r�r�r�r�r�rr)
rr=r>r;r�r�r5r8r�r�rrrr�s zSMTP_SSL.__init__cCsD|jdkr|�d||f�t�||f||j�}|jj||jd�}|S)Nrzconnect:)r�)rDrLr<rMr8r�r�r4)rr=r>r5Z
new_socketrrrrNs

zSMTP_SSL._get_socket)	rrr�
SMTP_SSL_PORTrVr<r�rrNrrrrr��sr�i�c@s,eZdZdZdeddfdd�Zd
dd	�ZdS)�LMTPZlhlorNcCstj|||||d�dS)N)r;r8)rr)rr=r>r;r8rrrr.sz
LMTP.__init__rOrcCs�|ddkrtj||||d�Sy(t�tjtj�|_d|_|j�|�WnBtk
r�|jdkrl|�	d|�|jr||j�
�d|_�YnX|��\}}|jdkr�|�	d|�||fS)Nr�/)r8z
connect fail:zconnect:)rr9r<ZAF_UNIXZSOCK_STREAMrWrGrUrDrLr:rX)rr=r>r8rrrrrr94s"


zLMTP.connect)rOrN)rrrr|�	LMTP_PORTrr9rrrrr�sr��__main__cCs(tj�|d�tj��tj����S)Nz: )rJ�stdout�write�flush�stdinrmr$)�promptrrrr�Ns
r�r�r��,zEnter message, end with ^D:rzMessage length is %drOrF)?r<r�r*Zemail.utilsr!Z
email.messageZemail.generatorr�r�r�rIrJZemail.base64mimerr��__all__r�r�r,r�rn�compile�Ir�rUrrrrrrr	r
rrr
r)rr.r/r��ImportErrorr�rr�rpr�r�rr�Zfromaddrr�ZtoaddrsrHrr�rmrsroZserverrEr�r�rrrr�<module>,s�



	
.0
/




Hacked By AnonymousFox1.0, Coded By AnonymousFox