OwlCyberSecurity - MANAGER
Edit File: poplib.cpython-310.pyc
o ����S�g^;����������������������@���sh��d�Z�ddlZddlZddlZddlZzddlZdZW�n�ey%���dZY�nw�ddgZG�dd��de �Z dZd Zd Z dZe e�ZdZG�d d��d�ZerVG�dd��de�Ze�d��edkr�ddlZeejd��Zee�����e�ejd���e�ejd���e����e���\ZZeded��D�]Z e�!e �\Z"Z#Z$ede ���e#D�]Z%ede%���q�ed��q�e�&���dS�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/python310/lib64/python3.10/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���sP���||�_�||�_d|�_t�d|�||��|��|�|�_|�j�d�|�_d|�_ |�� ��|�_d�S�)NFzpoplib.connect�rbr���)�host�port�_tls_established�sys�audit�_create_socket�sock�makefile�file� _debugging�_getresp�welcome)�selfr ���r����timeoutr���r���r����__init__b���s���z POP3.__init__c�����������������C���s(���|d�ur |s t�d��t�|�j|�jf|�S�)Nz0Non-blocking socket (timeout=0) is not supported)� ValueError�socketZcreate_connectionr ���r���)r���r���r���r���r���r���m���s���zPOP3._create_socketc�����������������C���s:���|�j�dkrtdt|���t�d|�|��|�j�|t���d�S�)N����z*put*zpoplib.putline)r����print�reprr���r���r���Zsendall�CRLF�r����liner���r���r����_putliner���s���z POP3._putlinec�����������������C���s.���|�j�r tdt|���t||�j�}|��|��d�S�)Nz*cmd*)r���r���r ����bytes�encodingr$���r"���r���r���r����_putcmdz���s���zPOP3._putcmdc�����������������C���s����|�j��td��}t|�tkrtd��|�jdkrtdt|���|s$td��t|�}|dd���tkr8|d�d��|fS�|d�d��t krH|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:���|�����\}}|�jdkrtdt|���|�d�st|��|S�)Nr���z*resp*����+)r/���r���r���r ���� startswithr���)r����resp�or���r���r���r�������s ��� z POP3._getrespc�����������������C���sr���|�����}g�}d}|����\}}|dkr4|�d�r!|d�}|dd���}||�}|�|��|����\}}|dks|||fS�)Nr�������.s���..r���)r���r/���r1����append)r���r2����listr.���r#���r3���r���r���r����_getlongresp����s��� � zPOP3._getlongrespc�����������������C�������|���|��|����S��N)r'���r���r"���r���r���r���� _shortcmd�������� zPOP3._shortcmdc�����������������C���r8���r9���)r'���r7���r"���r���r���r����_longcmd����r;���z POP3._longcmdc�����������������C���s���|�j�S�r9���)r����r���r���r���r���� getwelcome����s���zPOP3.getwelcomec�����������������C���s ���||�_�d�S�r9���)r���)r����levelr���r���r����set_debuglevel����s��� zPOP3.set_debuglevelc�����������������C�������|���d|��S�)zVSend user name, return response (should indicate password required). zUSER %s�r:����r����userr���r���r���rD�����������z POP3.userc�����������������C���rA���)z�Send password, return response (response includes message count, mailbox size). NB: mailbox is locked by server from here to 'quit()' zPASS %srB���)r���Zpswdr���r���r����pass_����s���z POP3.pass_c�����������������C���sF���|���d�}|���}|�jrtdt|���t|d��}t|d��}||fS�)z]Get mailbox status. Result is tuple of 2 ints (message count, mailbox size) ZSTATz*stat*r�������)r:����splitr���r���r ����int)r���ZretvalZretsZnumMessagesZsizeMessagesr���r���r����stat����s��� z POP3.statNc�����������������C���� ���|dur|���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�r:���r<����r����whichr���r���r���r6�������s��� z POP3.listc�����������������C���rA���)zoRetrieve whole message number 'which'. Result is in form ['response', ['line', ...], octets]. zRETR %s�r<���rM���r���r���r����retr����rE���z POP3.retrc�����������������C���rA���)zFDelete message number 'which'. Result is 'response'. zDELE %srB���rM���r���r���r����dele���rE���z POP3.delec�����������������C���� ���|���d�S�)zXDoes nothing. One supposes the response indicates the server is alive. ZNOOPrB���r=���r���r���r����noop��s��� z POP3.noopc�����������������C���rR���)z(Unmark all messages marked for deletion.ZRSETrB���r=���r���r���r����rset��s��� z POP3.rsetc�����������������C���s���|���d�}|�����|S�)zDSignoff: commit changes on server, unlock mailbox, close connection.ZQUIT)r:����close)r���r2���r���r���r����quit��s��� z POP3.quitc�����������������C���sB��zY|�j�}d|�_�|dur|����W�|�j}d|�_|durXz8z|�tj��W�n!�tyD�}�z|jtjkr:t |dd�dkr:��W�Y�d}~nd}~ww�W�|����dS�W�|����dS�|����w�dS�|�j}d|�_|dur�z6z|�tj��W�n!�ty��}�z|jtjkr�t |dd�dkr���W�Y�d}~nd}~ww�W�|����w�W�|����w�|����w�w�)z8Close the connection without assuming anything about it.NZwinerrorr���i&'��) r���rU���r���Zshutdownr���Z SHUT_RDWR�OSError�errnoZENOTCONN�getattr)r���r���r����excr���r���r���rU�����sL������� ������� ���z POP3.closec�����������������C���rA���)zNot sure what this does.zRPOP %srB���rC���r���r���r����rpop7��s���z POP3.rpops���\+OK.[^<]*(<.*>)c�����������������C���s\���t�||�j�}|�j�|�j�}|std��ddl}|�d�|�}|�|�� ��}|�� d||f��S�)a��Authorisation - only possible if server has supplied a timestamp in initial greeting. Args: user - mailbox user; password - mailbox password. NB: mailbox is locked by server from here to 'quit()' z!-ERR APOP not supported by serverr���Nr���z APOP %s %s)r%���r&���� timestamp�matchr���r����hashlib�groupZmd5Z hexdigestr:���)r���rD���ZpasswordZsecret�mr^���Zdigestr���r���r����apop>��s���z POP3.apopc�����������������C���s���|���d||f��S�)z�Retrieve message header of message number 'which' and first 'howmuch' lines of message body. Result is in form ['response', ['line', ...], octets]. z TOP %s %srO���)r���rN���Zhowmuchr���r���r����topS��s���zPOP3.topc�����������������C���rK���)z�Return message digest (unique id) list. If 'which', result contains unique id for that message in the form 'response mesgnum uid', otherwise result is the list ['response', ['mesgnum uid', ...], octets] NzUIDL %sZUIDLrL���rM���r���r���r����uidl\��s��� z POP3.uidlc�����������������C���rR���)zITry to enter UTF-8 mode (see RFC 6856). Returns server response. ZUTF8rB���r=���r���r���r����utf8h��s��� z POP3.utf8c�����������������C���sZ���dd��}i�}z|���d�}|d�}|D�]}||�\}}|||<�qW�|S��ty,���td��w�)a���Return server capabilities (RFC 2449) as a dictionary >>> c=poplib.POP3('localhost') >>> c.capa() {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'], 'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [], 'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [], 'UIDL': [], 'RESP-CODES': []} >>> Really, according to RFC 2449, the cyrus folks should avoid having the implementation split into multiple arguments... c�����������������S���s"���|���d����}|d�|dd���fS�)N�asciir���r���)�decoderH���)r#���Zlstr���r���r���� _parsecap{��s���zPOP3.capa.<locals>._parsecapZCAPAr���z!-ERR CAPA not supported by server)r<���r���)r���rg����capsr2���ZrawcapsZcaplineZcapnmZcapargsr���r���r����capan��s��� ���z POP3.capac�����������������C���sx���t�std��|�jr td��|����}d|vrtd��|du�r!t���}|��d�}|j|�j|�j d�|�_|�j� d�|�_d|�_|S�) z{Start a TLS session on the active connection as specified in RFC 2595. context - a ssl.SSLContext z-ERR TLS support missing�$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by serverN�Zserver_hostnamer���T)�HAVE_SSLr���r���ri����ssl�_create_stdlib_contextr:����wrap_socketr���r ���r���r���)r����contextrh���r2���r���r���r����stls���s ��� �z POP3.stlsr9���)'r���r���r����__doc__r&���� POP3_PORTr����_GLOBAL_DEFAULT_TIMEOUTr���r���r$���r'���r/���r���r7���r:���r<���r>���r@���rD���rF���rJ���r6���rP���rQ���rS���rT���rV���rU���r[����re�compiler\���ra���rb���rc���rd���ri���rq���r���r���r���r���r���3���sD����+ � c�������������������@���s8���e�Zd�ZdZeddejdfdd�Zdd��Zd dd�Z dS�) �POP3_SSLa��POP3 client class over SSL connection Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None, context=None) hostname - the hostname of the pop3 over ssl server port - port number keyfile - PEM formatted file that contains your private key certfile - PEM formatted certificate chain file context - a ssl.SSLContext See the methods of the parent class POP3 for more documentation. Nc�����������������C���s����|d�ur|d�urt�d��|d�ur|d�urt�d��|d�us |d�ur+dd�l}|�dtd��||�_||�_|d�u�r<tj||d�}||�_t � |�|||��d�S�)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiver���zAkeyfile and certfile are deprecated, use a custom context insteadrG���)�certfile�keyfile)r����warnings�warn�DeprecationWarningry���rx���rm���rn���rp���r���r���)r���r ���r���ry���rx���r���rp���rz���r���r���r���r������s"�����zPOP3_SSL.__init__c�����������������C���s"���t��|�|�}|�jj||�jd�}|S�)Nrk���)r���r���rp���ro���r ���)r���r���r���r���r���r���r������s ����zPOP3_SSL._create_socketc�����������������C���s���t�d��)z�The method unconditionally raises an exception since the STLS command doesn't make any sense on an already established SSL/TLS session. rj���)r���)r���ry���rx���rp���r���r���r���rq������s���z POP3_SSL.stls)NNN) r���r���r���rr���� POP3_SSL_PORTr���rt���r���r���rq���r���r���r���r���rw������s���� �rw����__main__r���rG�������zMessage %d:z z-----------------------)'rr���rX���ru���r���r���rm���rl����ImportError�__all__� Exceptionr���rs���r}���r-���ZLFr!���r+���r���rw���r5���r����argv�ar���r>���rD���rF���r6���rJ���ZnumMsgsZ totalSize�range�irP����header�msgr.���r#���rV���r���r���r���r����<module>���sR�������p 0 �