ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
M\¬Qc@s¥dZddlZddlZddgZdefd„ƒYZdZdZdZd    Z    ee    Z
dfd
„ƒYZ yddl Z Wne k
r˜n$Xd e fd „ƒYZejd ƒed kr¡ddlZe ejdƒZejƒGHejejdƒejejdƒejƒejƒ\ZZx[ededƒD]FZejeƒ\ZZZ deGHxeD]Z!de!GHqxWdGHqJWej"ƒndS(s@A POP3 client class.
 
Based on the J. Myers POP3 draft, Jan. 96
iÿÿÿÿNtPOP3t error_protocBseZRS((t__name__t
__module__(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyRsiniãs s
cBsûeZdZeejd„Zd„Zd„Zd„Z    d„Z
d„Z d„Z d„Z d    „Zd
„Zd „Zd „Zd „Zdd„Zd„Zd„Zd„Zd„Zd„Zd„ZejdƒZd„Zd„Zdd„Z RS(sÏ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)
 
    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.
    cCs^||_||_tj||f|ƒ|_|jjdƒ|_d|_|jƒ|_    dS(Ntrbi(
thosttporttsockettcreate_connectiontsocktmakefiletfilet
_debuggingt_getresptwelcome(tselfRRttimeout((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt__init__Os             cCs?|jdkr!dGt|ƒGHn|jjd|tfƒdS(Nis*put*s%s%s(R treprR    tsendalltCRLF(Rtline((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt_putlineYscCs,|jrdGt|ƒGHn|j|ƒdS(Ns*cmd*(R RR(RR((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt_putcmd`s    cCsž|jjƒ}|jdkr0dGt|ƒGHn|sEtdƒ‚nt|ƒ}|dtkro|d |fS|dtkr|dd!|fS|d |fS(Nis*get*s-ERR EOFiþÿÿÿiiÿÿÿÿ(R treadlineR RRtlenRtCR(RRtoctets((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt_getlineis cCs\|jƒ\}}|jdkr3dGt|ƒGHn|d }|dkrXt|ƒ‚n|S(Nis*resp*t+(RR RR(Rtresptotc((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyR {s
 cCsš|jƒ}g}d}|jƒ\}}x`|dkrŒ|d dkr`|d}|d}n||}|j|ƒ|jƒ\}}q-W|||fS(Nit.is..i(R Rtappend(RRtlistRRR((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt _getlongresp†s 
 
 cCs|j|ƒ|jƒS(N(RR (RR((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt    _shortcmd–s cCs|j|ƒ|jƒS(N(RR$(RR((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt_longcmds cCs|jS(N(R(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt
getwelcome¤scCs ||_dS(N(R (Rtlevel((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytset_debuglevel¨scCs|jd|ƒS(sVSend user name, return response
 
        (should indicate password required).
        sUSER %s(R%(Rtuser((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyR*®scCs|jd|ƒS(s Send password, return response
 
        (response includes message count, mailbox size).
 
        NB: mailbox is locked by server from here to 'quit()'
        sPASS %s(R%(Rtpswd((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytpass_¶scCs`|jdƒ}|jƒ}|jr6dGt|ƒGHnt|dƒ}t|dƒ}||fS(s]Get mailbox status.
 
        Result is tuple of 2 ints (message count, mailbox size)
        tSTATs*stat*ii(R%tsplitR Rtint(Rtretvaltretst numMessagest sizeMessages((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytstatÀs     cCs*|dk    r|jd|ƒS|jdƒS(sRequest 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.
        sLIST %stLISTN(tNoneR%R&(Rtwhich((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyR#Ís     cCs|jd|ƒS(soRetrieve whole message number 'which'.
 
        Result is in form ['response', ['line', ...], octets].
        sRETR %s(R&(RR7((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytretrÛscCs|jd|ƒS(sFDelete message number 'which'.
 
        Result is 'response'.
        sDELE %s(R%(RR7((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytdeleãscCs |jdƒS(sXDoes nothing.
 
        One supposes the response indicates the server is alive.
        tNOOP(R%(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytnoopëscCs |jdƒS(s(Unmark all messages marked for deletion.tRSET(R%(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytrsetóscCsYy|jdƒ}Wntk
r.}|}nX|jjƒ|jjƒ|`|`|S(sDSignoff: commit changes on server, unlock mailbox, close connection.tQUIT(R%RR tcloseR    (RRtval((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytquitøs
   cCs|jd|ƒS(sNot sure what this does.sRPOP %s(R%(RR*((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytrpopss\+OK.*(<[^>]+>)cCsŠ|jj|jƒ}|s*tdƒ‚nddl}|j|jdƒ|ƒjƒ}djt    d„|ƒƒ}|j
d||fƒS(s Authorisation
 
        - only possible if server has supplied a timestamp in initial greeting.
 
        Args:
                user    - mailbox user;
                secret  - secret shared between client and server.
 
        NB: mailbox is locked by server from here to 'quit()'
        s!-ERR APOP not supported by serveriÿÿÿÿNitcSsdt|ƒS(Ns%02x(tord(tx((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt<lambda>ss
APOP %s %s( t    timestamptmatchRRthashlibtmd5tgrouptdigesttjointmapR%(RR*tsecrettmRIRL((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytapops  "cCs|jd||fƒS(s­Retrieve message header of message number 'which'
        and first 'howmuch' lines of message body.
 
        Result is in form ['response', ['line', ...], octets].
        s    TOP %s %s(R&(RR7thowmuch((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyttop#scCs*|dk    r|jd|ƒS|jdƒS(sì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]
        sUIDL %stUIDLN(R6R%R&(RR7((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pytuidl,s N(!RRt__doc__t    POP3_PORTRt_GLOBAL_DEFAULT_TIMEOUTRRRRR R$R%R&R'R)R*R,R4R6R#R8R9R;R=RARBtretcompileRGRQRSRU(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyR$s4(                                                    
                                        tPOP3_SSLcBsDeZdZeddd„Zd„Zd„Zd„Zd„Z    RS(sÂPOP3 client class over SSL connection
 
        Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None)
 
               hostname - the hostname of the pop3 over ssl server
               port - port number
               keyfile - PEM formatted file that countains your private key
               certfile - PEM formatted certificate chain file
 
            See the methods of the parent class POP3 for more documentation.
        c CsR||_||_||_||_d|_d}d|_x©tj|j|jdtj    ƒD]†}|\}}}    }
} y,tj|||    ƒ|_|jj
| ƒWn;tj k
râ}|jrÓ|jj ƒnd|_q^nXPq^W|jstj |‚n|jj dƒ|_tj|j|j|jƒ|_d|_|jƒ|_dS(NRCs!getaddrinfo returns an empty listiR(RRtkeyfiletcertfiletbufferR6R    Rt getaddrinfot SOCK_STREAMtconnectterrorR?R
R tsslt wrap_sockettsslobjR R R( RRRR\R]tmsgtrestaftsocktypetprotot    canonnametsa((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyRJs0                        (            !    cCsC|jjƒ}t|ƒdkr0tdƒ‚n|j|7_dS(Nis-ERR EOF(RetreadRRR^(Rtlocalbuf((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt _fillBufferdscCsôd}tjdƒ}|j|jƒ}x&|sO|jƒ|j|jƒ}q*W|jdƒ}|jd|jdƒ|_|jdkr›dGt|ƒGHnt    |ƒ}|dt
krÅ|d |fS|dt kræ|dd!|fS|d |fS(NRCs.*?\niis*get*iþÿÿÿiÿÿÿÿ( RYRZRHR^RoRKtsubR RRRR(RRt    renewlineRHR((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyRjs     
 cCs„|jdkr!dGt|ƒGHn|t7}t|ƒ}xF|dkr|jj|ƒ}||krhPn||}||}q:WdS(Nis*put*i(R RRRRetwrite(RRtbytestsent((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyR|s
 
cCsLy|jdƒ}Wntk
r.}|}nX|jjƒ|`|`|S(sDSignoff: commit changes on server, unlock mailbox, close connection.R>(R%RR    R?Re(RRR@((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyRA‡s
  N(
RRRVt POP3_SSL_PORTR6RRoRRRA(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyR[=s               t__main__iiis Message %d:s   s-----------------------(#RVRYRt__all__t    ExceptionRRWRuRtLFRRRct ImportErrorR[R"RtsystargvtaR'R*R,R#R4tnumMsgst    totalSizetrangetiR8theaderRfRRRA(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/poplib.pyt<module>s>  
ÿ T