Hacked By AnonymousFox
B
� ft: � @ sl d Z ddlZddlZddlZyddlZdZW n ek
rD dZY nX ddgZG dd� de�Z dZ
d Zd
ZdZ
ee
ZdZG d
d� d�Zer�G dd� de�Ze�d� edk�rhddlZeejd �Zee�� � e�ejd � e�ejd � e�� e�� \ZZxXeded �D ]FZ e�!e �\Z"Z#Z$ede � xe#D ]Z%ede% � �q<W ed� �qW e�&� dS )z@A POP3 client class.
Based on the J. Myers POP3 draft, Jan. 96
� NTF�POP3�error_protoc @ s e Zd ZdS )r N)�__name__�
__module__�__qualname__� r r �+/opt/alt/python37/lib64/python3.7/poplib.pyr s �n i� �
�
i c @ s e Zd ZdZdZeejfdd�Zdd� Z dd� Z
d d
� Zdd� Zd
d� Z
dd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd=d d!�Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Ze�d0�Z d1d2� Z!d3d4� Z"d>d5d6�Z#d7d8� Z$d9d:� Z%d?d;d<�Z&dS )@r aP This class supports both the minimal and optional command sets.
Arguments can be strings or integers (where appropriate)
(e.g.: retr(1) and retr('1') both work equally well.
Minimal Command Set:
USER name user(name)
PASS string pass_(string)
STAT stat()
LIST [msg] list(msg = None)
RETR msg retr(msg)
DELE msg dele(msg)
NOOP noop()
RSET rset()
QUIT quit()
Optional Commands (some servers support these):
RPOP name rpop(name)
APOP name digest apop(name, digest)
TOP msg n top(msg, n)
UIDL [msg] uidl(msg = None)
CAPA capa()
STLS stls()
UTF8 utf8()
Raises one exception: 'error_proto'.
Instantiate with:
POP3(hostname, port=110)
NB: the POP protocol locks the mailbox from user
authorization until QUIT, so be sure to get in, suck
the messages, and quit, each time you access the
mailbox.
POP is a line-based protocol, which means large mail
messages consume lots of python cycles reading them
line-by-line.
If it's available on your mail server, use IMAP4
instead, it doesn't suffer from the two problems
above.
zUTF-8c C s@ || _ || _d| _| �|�| _| j�d�| _d| _| �� | _ d S )NF�rbr )
�host�port�_tls_established�_create_socket�sock�makefile�file�
_debugging�_getresp�welcome)�selfr
r �timeoutr r r �__init__a s z
POP3.__init__c C s t �| j| jf|�S )N)�socketZcreate_connectionr
r )r r r r r r k s zPOP3._create_socketc C s, | j dkrtdt|�� | j�|t � d S )N� z*put*)r �print�reprr Zsendall�CRLF)r �liner r r �_putlinen s
z
POP3._putlinec C s. | j rtdt|�� t|| j�}| �|� d S )Nz*cmd*)r r r �bytes�encodingr )r r r r r �_putcmdu s zPOP3._putcmdc C s� | j �td �}t|�tkr$td��| jdkr<tdt|�� |sHtd��t|�}|dd � tkrp|d d� |fS |d d� t kr�|dd� |fS |d d� |fS )Nr z
line too longz*get*z-ERR EOF������)
r �readline�_MAXLINE�lenr r r r r �CR)r r �octetsr r r �_getline s
z
POP3._getlinec C s: | � � \}}| jdkr$tdt|�� |�d�s6t|��|S )Nr z*resp*� +)r+ r r r �
startswithr )r �resp�or r r r � s
z
POP3._getrespc C sp | � � }g }d}| �� \}}xH|dkrd|�d�rD|d }|dd � }|| }|�|� | �� \}}qW |||fS )Nr � .s ..r )r r+ r- �append)r r. �listr* r r/ r r r �_getlongresp� s
zPOP3._getlongrespc C s | � |� | �� S )N)r# r )r r r r r � _shortcmd� s
zPOP3._shortcmdc C s | � |� | �� S )N)r# r3 )r r r r r �_longcmd� s
z
POP3._longcmdc C s | j S )N)r )r r r r �
getwelcome� s zPOP3.getwelcomec C s
|| _ d S )N)r )r �levelr r r �set_debuglevel� s zPOP3.set_debuglevelc C s | � d| �S )zVSend user name, return response
(should indicate password required).
zUSER %s)r4 )r �userr r r r9 � s z POP3.userc C s | � d| �S )z�Send password, return response
(response includes message count, mailbox size).
NB: mailbox is locked by server from here to 'quit()'
zPASS %s)r4 )r Zpswdr r r �pass_� s z
POP3.pass_c C sF | � d�}|�� }| jr&tdt|�� t|d �}t|d �}||fS )z]Get mailbox status.
Result is tuple of 2 ints (message count, mailbox size)
ZSTATz*stat*r � )r4 �splitr r r �int)r ZretvalZretsZnumMessagesZsizeMessagesr r r �stat� s
z POP3.statNc C s |dk r| � d| �S | �d�S )a Request listing, return result.
Result without a message number argument is in form
['response', ['mesg_num octets', ...], octets].
Result when a message number argument is given is a
single response: the "scan listing" for that message.
NzLIST %sZLIST)r4 r5 )r �whichr r r r2 � s z POP3.listc C s | � d| �S )zoRetrieve whole message number 'which'.
Result is in form ['response', ['line', ...], octets].
zRETR %s)r5 )r r? r r r �retr� s z POP3.retrc C s | � d| �S )zFDelete message number 'which'.
Result is 'response'.
zDELE %s)r4 )r r? r r r �dele� s z POP3.delec C s
| � d�S )zXDoes nothing.
One supposes the response indicates the server is alive.
ZNOOP)r4 )r r r r �noop s z POP3.noopc C s
| � d�S )z(Unmark all messages marked for deletion.ZRSET)r4 )r r r r �rset s z POP3.rsetc C s | � d�}| �� |S )zDSignoff: commit changes on server, unlock mailbox, close connection.ZQUIT)r4 �close)r r. r r r �quit s
z POP3.quitc C s� z | j }d| _ |dk r|�� W d| j}d| _|dk r�zVy|�tj� W n@ tk
r� } z"|jtjkrxt |dd�dkrx� W dd}~X Y nX W d|�� X X dS )z8Close the connection without assuming anything about it.NZwinerrorr i&'