Your IP : 52.15.35.129


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/poplib.cpython-35.opt-2.pyc



���]}9�
@s�ddlZddlZddlZyddlZdZWnek
rTdZYnXddgZGdd�de�ZdZ	dZ
d	Zd
ZeeZ
dZGdd�d�Zer�Gd
d�de�Zejd�edkr�ddlZeejd�Zeej��ejejd�ejejd�ej�ej�\ZZxjeded�D]UZej e�\Z!Z"Z#ede�xe"D]Z$ede$�q�Wed�qnWej%�dS)�NTF�POP3�error_protoc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�+/opt/alt/python35/lib64/python3.5/poplib.pyrs�ni�s
s
ic@s�eZdZdZeejdd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zddd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zejd/�Zd0d1�Z d2d3�Z!dd4d5�Z"d6d7�Z#d8d9�Z$dd:d;�Z%dS)<rzUTF-8cCs^||_||_d|_|j|�|_|jjd�|_d|_|j�|_	dS)NF�rbr)
�host�port�_tls_established�_create_socket�sock�makefile�file�
_debugging�_getresp�welcome)�selfrr�timeoutrrr�__init__as				z
POP3.__init__cCstj|j|jf|�S)N)�socket�create_connectionrr)rrrrrrkszPOP3._create_socketcCs:|jdkr"tdt|��|jj|t�dS)N�z*put*)r�print�reprr�sendall�CRLF)r�linerrr�_putlinensz
POP3._putlinecCs?|jrtdt|��t||j�}|j|�dS)Nz*cmd*)rrr�bytes�encodingr )rrrrr�_putcmdus	zPOP3._putcmdcCs�|jjtd�}t|�tkr4td��|jdkrVtdt|��|shtd��t|�}|dd�tkr�|dd�|fS|dd�t	kr�|dd�|fS|dd	�|fS)
Nrz
line too longz*get*z-ERR EOF����r%���r&)
r�readline�_MAXLINE�lenrrrrr�CR)rr�octetsrrr�_getlinesz
POP3._getlinecCsS|j�\}}|jdkr4tdt|��|jd�sOt|��|S)Nrz*resp*�+)r,rrr�
startswithr)r�resp�orrrr�sz
POP3._getrespcCs�|j�}g}d}|j�\}}xb|dkr�|jd�rb|d}|dd�}||}|j|�|j�\}}q-W|||fS)Nr�.s..r)rr,r.�append)rr/�listr+rr0rrr�_getlongresp�s


zPOP3._getlongrespcCs|j|�|j�S)N)r#r)rrrrr�	_shortcmd�s
zPOP3._shortcmdcCs|j|�|j�S)N)r#r4)rrrrr�_longcmd�s
z
POP3._longcmdcCs|jS)N)r)rrrr�
getwelcome�szPOP3.getwelcomecCs
||_dS)N)r)r�levelrrr�set_debuglevel�szPOP3.set_debuglevelcCs|jd|�S)NzUSER %s)r5)r�userrrrr:�sz	POP3.usercCs|jd|�S)NzPASS %s)r5)rZpswdrrr�pass_�sz
POP3.pass_cCsa|jd�}|j�}|jr7tdt|��t|d�}t|d�}||fS)NZSTATz*stat*rr$)r5�splitrrr�int)rZretvalZretsZnumMessagesZsizeMessagesrrr�stat�s	z	POP3.statNcCs*|dk	r|jd|�S|jd�S)NzLIST %s�LIST)r5r6)r�whichrrrr3�s	z	POP3.listcCs|jd|�S)NzRETR %s)r6)rr@rrr�retr�sz	POP3.retrcCs|jd|�S)NzDELE %s)r5)rr@rrr�dele�sz	POP3.delecCs
|jd�S)NZNOOP)r5)rrrr�noopsz	POP3.noopcCs
|jd�S)NZRSET)r5)rrrr�rsetsz	POP3.rsetcCs|jd�}|j�|S)NZQUIT)r5�close)rr/rrr�quits
z	POP3.quitcCs�z,|j}d|_|dk	r+|j�Wd|j}d|_|dk	r�zmy|jtj�WnRtk
r�}z2|jtjkr�t	|dd�dkr��WYdd}~XnXWd|j�XXdS)N�winerrorri&')
rrEr�shutdownr�	SHUT_RDWR�OSError�errnoZENOTCONN�getattr)rrr�excrrrrEs				z
POP3.closecCs|jd|�S)NzRPOP %s)r5)rr:rrr�rpop2sz	POP3.rpops\+OK.[^<]*(<.*>)cCs�t||j�}|jj|j�}|s9td��ddl}|jd�|}|j|�j	�}|j
d||f�S)Nz!-ERR APOP not supported by serverrrz
APOP %s %s)r!r"�	timestamp�matchrr�hashlib�group�md5�	hexdigestr5)rr:ZpasswordZsecret�mrQ�digestrrr�apop9sz	POP3.apopcCs|jd||f�S)Nz	TOP %s %s)r6)rr@Zhowmuchrrr�topNszPOP3.topcCs*|dk	r|jd|�S|jd�S)NzUIDL %sZUIDL)r5r6)rr@rrr�uidlWsz	POP3.uidlcCs
|jd�S)NZUTF8)r5)rrrr�utf8csz	POP3.utf8c	Cs�dd�}i}yJ|jd�}|d}x*|D]"}||�\}}|||<q5WWn1tk
r�}ztd��WYdd}~XnX|S)NcSs-|jd�j�}|d|dd�fS)N�asciirr)�decoder<)rZlstrrr�	_parsecapvszPOP3.capa.<locals>._parsecapZCAPArz!-ERR CAPA not supported by server)r6r)	rr]�capsr/ZrawcapsZcaplineZcapnmZcapargsZ_errrrr�capais


z	POP3.capacCs�tstd��|jr'td��|j�}d|krKtd��|dkrctj�}|jd�}|j|jd|j	�|_|jj
d�|_d|_|S)Nz-ERR TLS support missingz$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by server�server_hostnamer
T)�HAVE_SSLrr
r_�ssl�_create_stdlib_contextr5�wrap_socketrrrr)r�contextr^r/rrr�stls�s		z	POP3.stls)&rrrr"�	POP3_PORTr�_GLOBAL_DEFAULT_TIMEOUTrrr r#r,rr4r5r6r7r9r:r;r>r3rArBrCrDrFrErN�re�compilerOrWrXrYrZr_rfrrrrr2s>-	



	c@sOeZdZeddejddd�Zdd�Zddddd�ZdS)�POP3_SSLNcCs�|dk	r$|dk	r$td��|dk	rH|dk	rHtd��||_||_|dkr~tjd|d|�}||_tj||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusive�certfile�keyfile)�
ValueErrorrmrlrbrcrerr)rrrrmrlrrerrrr�s				zPOP3_SSL.__init__cCs1tj||�}|jj|d|j�}|S)Nr`)rrrerdr)rrrrrrr�szPOP3_SSL._create_socketcCstd��dS)Nz$-ERR TLS session already established)r)rrmrlrerrrrf�sz
POP3_SSL.stls)	rrr�
POP3_SSL_PORTrrhrrrfrrrrrk�s	rk�__main__rr$�zMessage %d:z   z-----------------------)&rKrirrbra�ImportError�__all__�	Exceptionrrgror*ZLFrr(rrkr2r�sys�argv�arr7r:r;r3r>ZnumMsgsZ	totalSize�range�irA�header�msgr+rrFrrrr�<module>sF


�k,




?>