选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
a ´i¨Šã@sLdZddlZddlZddlmZgd¢ZdZdZdZGdd „d eƒZ Gd d „d e ƒZ Gd d „d e ƒZ Gdd„de ƒZ Gdd„de ƒZ e eefZdZdZGdd„dƒZz ddlZWneyÆdZYn00ejZGdd„deƒZe d¡e eeejfZdadd„Zdadd„Zdd„Zdd„Z d d!„Z!d)d$d%„Z"d&d'„Z#e$d(k�rHe#ƒdS)*aSAn FTP client class and some helper functions. Based on RFC 959: File Transfer Protocol (FTP), by J. Postel and J. Reynolds Example: >>> from ftplib import FTP >>> ftp = FTP('ftp.python.org') # connect to host, default port >>> ftp.login() # default, i.e.: user anonymous, passwd anonymous@ '230 Guest login ok, access restrictions apply.' >>> ftp.retrlines('LIST') # list directory contents total 9 drwxr-xr-x 8 root wheel 1024 Jan 3 1994 . drwxr-xr-x 8 root wheel 1024 Jan 3 1994 .. drwxr-xr-x 2 root wheel 1024 Jan 3 1994 bin drwxr-xr-x 2 root wheel 1024 Jan 3 1994 etc d-wxrwxr-x 2 ftp wheel 1024 Sep 5 13:43 incoming drwxr-xr-x 2 root wheel 1024 Nov 17 1993 lib drwxr-xr-x 6 1094 wheel 1024 Sep 13 19:07 pub drwxr-xr-x 3 root wheel 1024 Jan 3 1994 usr -rw-r--r-- 1 root root 312 Aug 1 1994 welcome.msg '226 Transfer complete.' >>> ftp.quit() '221 Goodbye.' >>> A nice test that reveals some of the network dialogue would be: python ftplib.py -d localhost -l -p -l éN)Ú_GLOBAL_DEFAULT_TIMEOUT)ÚFTPÚ error_replyÚ error_tempÚ error_permÚ error_protoÚ all_errorsééé c@s eZdZdS)ÚErrorN©Ú__name__Ú __module__Ú __qualname__©rrú/usr/lib64/python3.9/ftplib.pyr 9ór c@s eZdZdS)rNr rrrrr:rrc@s eZdZdS)rNr rrrrr;rrc@s eZdZdS)rNr rrrrr<rrc@s eZdZdS)rNr rrrrr=rrú s c@sªeZdZdZdZdZeZeZ dZ dZ dZ dZ dZddddedfddœd d „Zd d „Zd d„Zd]dd„Zdd„Zdd„ZeZdd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Z d*d+„Z!d,d-„Z"d.d/„Z#d0d1„Z$d2d3„Z%d^d4d5„Z&d_d6d7„Z'd`d8d9„Z(dad;d<„Z)dbd=d>„Z*dcd?d@„Z+dddAdB„Z,dCdD„Z-dEdF„Z.dGdH„Z/dgfdIdJ„Z0dKdL„Z1dMdN„Z2dOdP„Z3dQdR„Z4dSdT„Z5dUdV„Z6dWdX„Z7dYdZ„Z8d[d\„Z9dS)eruôAn FTP client class. To create a connection, call the class using these arguments: host, user, passwd, acct, timeout, source_address, encoding The first four arguments are all strings, and have default value ''. The parameter ´timeout´ must be numeric and defaults to None if not passed, meaning that no timeout will be set on any ftp socket(s). If a timeout is passed, then this is now the default timeout for all ftp socket operations for this instance. The last parameter is the encoding of filenames, which defaults to utf-8. Then use self.connect() with optional host and port argument. To download a file, use ftp.retrlines('RETR ' + filename), or ftp.retrbinary() with slightly different arguments. To upload a file, use ftp.storlines() or ftp.storbinary(), which have an open file as argument (see their definitions below for details). The download/upload functions first issue appropriate TYPE and PORT or PASV commands. rÚNTFúutf-8©ÚencodingcCs6||_||_||_|r2| |¡|r2| |||¡dS)zãInitialization method (called by class instantiation). Initialize host to localhost, port to standard ftp port. Optional arguments are host (for connect()), and user, passwd, acct (for login()). N)rÚsource_addressÚtimeoutÚconnectÚlogin)ÚselfÚhostÚuserÚpasswdÚacctrrrrrrÚ__init__ms z FTP.__init__cCs|S©Nr©rrrrÚ __enter__}sz FTP.__enter__c Gs^|jdurZz:z | ¡Wnttfy.Yn0W|jdurZ| ¡n|jdurX| ¡0dSr#)ÚsockÚquitÚOSErrorÚEOFErrorÚclose)rÚargsrrrÚ__exit__�s    ÿ z FTP.__exit__éüÿÿcCs°|dkr||_|dkr||_|dkr*||_|jdurB|jsBtdƒ‚|durP||_t d||j|j¡tj|j|jf|j|jd�|_ |j j |_ |j j d|j d �|_| ¡|_|jS) awConnect to host. Arguments are: - host: hostname to connect to (string, default previous host) - port: port to connect to (integer, default previous port) - timeout: the timeout to set against the ftp socket(s) - source_address: a 2-tuple (host, port) for the socket to bind to as its source address before connecting. rrr-Nz0Non-blocking socket (timeout=0) is not supportedzftplib.connect©rÚrr)rÚportrÚ ValueErrorrÚsysÚauditÚsocketÚcreate_connectionr&ÚfamilyÚafÚmakefilerÚfileÚgetrespÚwelcome)rrr0rrrrrr‹s$ÿ  z FTP.connectcCs|jrtd| |j¡ƒ|jS)z`Get the welcome message from the server. (this is read and squirreled away by connect())z *welcome*)Ú debuggingÚprintÚsanitizer;r$rrrÚ getwelcome¥szFTP.getwelcomecCs ||_dS)zðSet the debugging level. The required argument level means: 0: no debugging output (default) 1: print commands and responses but not body text etc. 2: also print raw lines read and sent before stripping CR/LFN)r<)rÚlevelrrrÚset_debuglevel¬szFTP.set_debuglevelcCs ||_dS)z›Use passive or active mode for data transfers. With a false argument, use the normal PORT mode, With a true argument, use the PASV command.N)Ú passiveserver)rÚvalrrrÚset_pasvµsz FTP.set_pasvcCsJ|dd…dvrBt| d¡ƒ}|dd…d|d||d…}t|ƒS)Né>zpass úPASS rÚ*)ÚlenÚrstripÚrepr)rÚsÚirrrr>¼s$z FTP.sanitizecCs`d|vsd|vrtdƒ‚t d||¡|t}|jdkrHtd| |¡ƒ|j |  |j ¡¡dS)Nú Ú z4an illegal newline character should not be containedzftplib.sendcmdr z*put*) r1r2r3ÚCRLFr<r=r>r&ÚsendallÚencoder©rÚlinerrrÚputlineÃs z FTP.putlinecCs$|jrtd| |¡ƒ| |¡dS)Nz*cmd*)r<r=r>rTrRrrrÚputcmdÍsz FTP.putcmdcCsŽ|j |jd¡}t|ƒ|jkr.td|jƒ‚|jdkrHtd| |¡ƒ|sPt‚|dd…t krn|dd…}n|dd…t vrŠ|dd…}|S)Nr úgot more than %d bytesz*get*éþÿÿÿéÿÿÿÿ) r9ÚreadlineÚmaxlinerHr r<r=r>r)rOrRrrrÚgetlineÓs  z FTP.getlinecCs`| ¡}|dd…dkr\|dd…}| ¡}|d|}|dd…|kr$|dd…dkr$q\q$|S)Nééú-rN)r[)rrSÚcodeZnextlinerrrÚ getmultilineås  ÿzFTP.getmultilinecCsp| ¡}|jrtd| |¡ƒ|dd…|_|dd…}|dvrD|S|dkrTt|ƒ‚|dkrdt|ƒ‚t|ƒ‚dS)Nz*resp*r\r >Ú2Ú3Ú1Ú4Ú5)r`r<r=r>Zlastresprrr)rÚrespÚcrrrr:ós z FTP.getrespcCs$| ¡}|dd…dkr t|ƒ‚|S)z%Expect a response beginning with '2'.Nr ra)r:r©rrfrrrÚvoidrespsz FTP.voidrespcCsTdt}|jdkr"td| |¡ƒ|j |t¡| ¡}|dd…dvrPt|ƒ‚|S)züAbort a file transfer. Uses out-of-band data. This does not follow the procedure from the RFC to send Telnet IP and Synch; that doesn't seem to work with the servers I've tried. Instead, just send the ABOR command as OOB data.óABORr z *put urgent*Nr\¾Z426Z225Z226) ÚB_CRLFr<r=r>r&rPÚMSG_OOBr`r©rrSrfrrrÚaborts z FTP.abortcCs| |¡| ¡S)z'Send a command and return the response.)rUr:©rÚcmdrrrÚsendcmds z FTP.sendcmdcCs| |¡| ¡S)z8Send a command and expect a response beginning with '2'.)rUrirprrrÚvoidcmds z FTP.voidcmdcCsB| d¡}t|dƒt|dƒg}||}dd |¡}| |¡S)zUSend a PORT command with the current host and the given port number. Ú.ézPORT ú,)ÚsplitrJÚjoinrs)rrr0ZhbytesZpbytesÚbytesrqrrrÚsendport s  z FTP.sendportcCsbd}|jtjkrd}|jtjkr$d}|dkr4tdƒ‚dt|ƒ|t|ƒdg}dd |¡}| |¡S)zESend an EPRT command with the current host and the given port number.rr ézunsupported address familyrzEPRT ú|)r7r4ÚAF_INETÚAF_INET6rrJrxrs)rrr0r7ÚfieldsrqrrrÚsendeprt*s  z FTP.sendeprtcCsltjd|jdd�}| ¡d}|j ¡d}|jtjkrF| ||¡}n | ||¡}|jt urh|  |j¡|S)z3Create a new socket and send a PORT command for it.)rrr )r6Úbacklogr) r4Ú create_serverr7Ú getsocknamer&r}rzr€rrÚ settimeout)rr&r0rrfrrrÚmakeport7s     z FTP.makeportcCs\|jtjkr:t| d¡ƒ\}}|jr*|}qT|j ¡d}nt| d¡|j ¡ƒ\}}||fS)z (address, port)ÚPASVrZEPSV) r7r4r}Úparse227rrÚtrust_server_pasv_ipv4_addressr&Ú getpeernameÚparse229)rZuntrusted_hostr0rrrrÚmakepasvDs z FTP.makepasvc CsLd}|jr”| ¡\}}tj||f|j|jd�}zL|durF| d|¡| |¡}|ddkrd| ¡}|ddkrxt|ƒ‚Wn|  ¡‚Yn0n–|  ¡�|}|dur´| d|¡| |¡}|ddkrÒ| ¡}|ddkræt|ƒ‚|  ¡\}} |jt u�r |  |j¡Wdƒn1�s 0Y|dd…dk�rDt|ƒ}||fS) a¦Initiate a transfer over the data connection. If the transfer is active, send a port command and the transfer command, and accept the connection. If the server is passive, send a pasv command, connect to it, and start the transfer command. Either way, return the socket for the connection and the expected size of the transfer. The expected size may be None if it could not be determined. Optional `rest' argument can be a string that is sent as the argument to a REST command. This is essentially a server marker used to tell the server to skip over any data up to the given marker. Nr.zREST %srrarcr\Ú150)rBr‹r4r5rrrrr:rr*r…Úacceptrr„Úparse150) rrqÚrestÚsizerr0Úconnrfr&ZsockaddrrrrÚ ntransfercmdPs> ÿ           ,zFTP.ntransfercmdcCs| ||¡dS)z0Like ntransfercmd() but returns only the socket.r)r’)rrqr�rrrÚ transfercmd‡szFTP.transfercmdcCsŠ|sd}|sd}|sd}|dkr0|dvr0|d}| d|¡}|ddkrX| d|¡}|ddkrr| d |¡}|dd kr†t|ƒ‚|S) zLogin, default anonymous.Z anonymousr>rr^z anonymous@zUSER rrbrFúACCT ra©rrr)rrr r!rfrrrr‹s    z FTP.loginr cCsr| d¡| ||¡�D}| |¡}|s(q2||ƒqtdurLt|tƒrL| ¡Wdƒn1s`0Y| ¡S)aÆRetrieve data in binary mode. A new port is created for you. Args: cmd: A RETR command. callback: A single parameter callable to be called on each block of data read. blocksize: The maximum number of bytes to read from the socket at one time. [default: 8192] rest: Passed to transfercmd(). [default: None] Returns: The response code. úTYPE IN)rsr“ÚrecvÚ _SSLSocketÚ isinstanceÚunwrapri)rrqÚcallbackÚ blocksizer�r‘ÚdatarrrÚ retrbinary¥s   &zFTP.retrbinaryc Cs"|dur t}| d¡}| |¡�è}|jd|jd��¸}| |jd¡}t|ƒ|jkr`td|jƒ‚|j dkrxt dt |ƒƒ|s~qÂ|d d…t krœ|dd …}n|d d…d kr¸|dd …}||ƒq4t durÜt|t ƒrÜ| ¡Wdƒn1sð0YWdƒn1�s0Y| ¡S) ahRetrieve data in line mode. A new port is created for you. Args: cmd: A RETR, LIST, or NLST command. callback: An optional single parameter callable that is called for each line with the trailing CRLF stripped. [default: print_line()] Returns: The response code. NúTYPE Ar/rr rVr{z*retr*rWrXrN)Ú print_linerrr“r8rrYrZrHr r<r=rJrOr˜r™ršri)rrqr›rfr‘ÚfprSrrrÚ retrlines¿s,   ÿ   Fz FTP.retrlinescCs€| d¡| ||¡�R}| |¡}|s(q@| |¡|r||ƒqtdurZt|tƒrZ| ¡Wdƒn1sn0Y| ¡S)a9Store a file in binary mode. A new port is created for you. Args: cmd: A STOR command. fp: A file-like object with a read(num_bytes) method. blocksize: The maximum data size to read from fp and send over the connection at once. [default: 8192] callback: An optional single parameter callable that is called on each block of data after it is sent. [default: None] rest: Passed to transfercmd(). [default: None] Returns: The response code. r–N)rsr“ÚreadrPr˜r™ršri)rrqr¡rœr›r�r‘ÚbufrrrÚ storbinaryâs    &zFTP.storbinarycCsÐ| d¡| |¡�¤}| |jd¡}t|ƒ|jkrBtd|jƒ‚|sHq�|dd…tkrx|dtvrp|dd…}|t}| |¡|r||ƒqtdurªt |tƒrª|  ¡Wdƒn1s¾0Y|  ¡S)ahStore a file in line mode. A new port is created for you. Args: cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on each line after it is sent. [default: None] Returns: The response code. rŸr rVrWNrX) rsr“rYrZrHr rlrPr˜r™ršri)rrqr¡r›r‘r¤rrrÚ storlinesÿs    &z FTP.storlinescCsd|}| |¡S)zSend new account name.r”©rs)rÚpasswordrqrrrr!szFTP.acctcGs0d}|D]}|d|}qg}| ||j¡|S)zBReturn a list of files in a given directory (default the current).ZNLSTú )r¢Úappend)rr+rqÚargÚfilesrrrÚnlst#s zFTP.nlstcGshd}d}|dd…r>t|dƒtdƒkr>|dd…|d}}|D]}|rB|d|}qB| ||¡dS)aList a directory in long form. By default list current directory to stdout. Optional last argument is callback function; all non-empty arguments before it are concatenated to the LIST command. (This *should* only be used for a pathname.)ÚLISTNrXrr©)Útyper¢)rr+rqÚfuncr«rrrÚdir,s zFTP.dirc cs¦|r| dd |¡d¡|r*d|}nd}g}| ||j¡|D]\}| t¡ d¡\}}}i} |dd… d¡D] } |  d¡\} }} | | |  ¡<qt|| fVqDdS) a<List a directory in a standardized format by using MLSD command (RFC-3659). If path is omitted the current directory is assumed. "facts" is a list of strings representing the type of information desired (e.g. ["type", "size", "perm"]). Return a generator object yielding a tuple of two elements for every file found in path. First element is the file name, the second one is a dictionary including a variable number of "facts" depending on the server and whether "facts" argument has been provided. z OPTS MLST ú;zMLSD %sZMLSDr©NrXú=) rrrxr¢rªrIrOÚ partitionrwÚlower) rÚpathZfactsrqÚlinesrSZ facts_foundÚ_ÚnameÚentryZfactÚkeyÚvaluerrrÚmlsd;s  zFTP.mlsdcCs0| d|¡}|ddkr"t|ƒ‚| d|¡S)zRename a file.zRNFR rrbzRNTO )rrrrs)rZfromnameZtonamerfrrrÚrenameWs z FTP.renamecCs.| d|¡}|dd…dvr"|St|ƒ‚dS)zDelete a file.zDELE Nr\>Z250Z200r•)rÚfilenamerfrrrÚdelete^sz FTP.deletec Csr|dkrTz | d¡WStyP}z$|jddd…dkr<‚WYd}~q`d}~00n |dkr`d}d |}| |¡S) zChange to a directory.z..ZCDUPrNr\Ú500rrtzCWD )rsrr+)rÚdirnameÚmsgrqrrrÚcwdfs zFTP.cwdcCs:| d|¡}|dd…dkr6|dd… ¡}t|ƒSdS)zRetrieve the size of a file.zSIZE Nr\Z213)rrÚstripÚint)rr¿rfrKrrrr�sszFTP.sizecCs$| d|¡}| d¡sdSt|ƒS)z+Make a directory, return its full pathname.zMKD Ú257r©rsÚ startswithÚparse257)rrÂrfrrrÚmkd{s zFTP.mkdcCs| d|¡S)zRemove a directory.zRMD r§)rrÂrrrÚrmd„szFTP.rmdcCs | d¡}| d¡sdSt|ƒS)z!Return current working directory.ZPWDrÇrrÈrhrrrÚpwdˆs  zFTP.pwdcCs| d¡}| ¡|S)zQuit, and close the connection.ZQUIT)rsr*rhrrrr'‘s zFTP.quitcCs`z<|j}d|_|dur| ¡W|j}d|_|dur\| ¡n|j}d|_|durZ| ¡0dS)z8Close the connection without assuming anything about it.N)r9r*r&)rr9r&rrrr*—s  ýz FTP.close)rrr-N)N)N)rrr)r N)N)r NN)N):rrrÚ__doc__r<rÚFTP_PORTr0ÚMAXLINErZr&r9r;rBrˆrr"r%r,rr?rAÚdebugrDr>rTrUr[r`r:rirorrrsrzr€r…r‹r’r“rržr¢r¥r¦r!r­r±r½r¾rÀrÄr�rËrÌrÍr'r*rrrrrJspÿþ       7    #      rc s„eZdZdZejZdddddddedf ddœ‡fdd„ Zd‡fd d „ Z d d „Z d d„Z dd„Z dd„Z d‡fdd„ Zdd„Z‡ZS)ÚFTP_TLSa¯A FTP subclass which adds TLS support to FTP as described in RFC-4217. Connect as usual to port 21 implicitly securing the FTP control connection before authenticating. Securing the data connection requires user to explicitly ask for it by calling prot_p() method. Usage example: >>> from ftplib import FTP_TLS >>> ftps = FTP_TLS('ftp.python.org') >>> ftps.login() # login anonymously previously securing control channel '230 Guest login ok, access restrictions apply.' >>> ftps.prot_p() # switch to secure data connection '200 Protection level set to P' >>> ftps.retrlines('LIST') # list directory content securely total 9 drwxr-xr-x 8 root wheel 1024 Jan 3 1994 . drwxr-xr-x 8 root wheel 1024 Jan 3 1994 .. drwxr-xr-x 2 root wheel 1024 Jan 3 1994 bin drwxr-xr-x 2 root wheel 1024 Jan 3 1994 etc d-wxrwxr-x 2 ftp wheel 1024 Sep 5 13:43 incoming drwxr-xr-x 2 root wheel 1024 Nov 17 1993 lib drwxr-xr-x 6 1094 wheel 1024 Sep 13 19:07 pub drwxr-xr-x 3 root wheel 1024 Jan 3 1994 usr -rw-r--r-- 1 root root 312 Aug 1 1994 welcome.msg '226 Transfer complete.' >>> ftps.quit() '221 Goodbye.' >>> rNrrc  s¦|dur|durtdƒ‚|dur0|dur0tdƒ‚|dus@|durVddl} |  dtd¡||_||_|dur|tj|j||d�}||_ d|_ t ƒj |||||| | d�dS) Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr{)ÚcertfileÚkeyfileFr) r1ÚwarningsÚwarnÚDeprecationWarningrÔrÓÚsslZ_create_stdlib_contextÚ ssl_versionÚcontextÚ_prot_pÚsuperr") rrrr r!rÔrÓrÚrrrrÕ©Ú __class__rrr"Îs*ÿþÿzFTP_TLS.__init__Tcs*|rt|jtjƒs| ¡tƒ |||¡Sr#)r™r&rØÚ SSLSocketÚauthrÜr)rrr r!ZsecurerÝrrrçsz FTP_TLS.logincCsft|jtjƒrtdƒ‚|jtjkr.| d¡}n | d¡}|jj |j|j d�|_|jj d|j d�|_ |S)z2Set up secure control connection by using TLS/SSL.zAlready using TLSzAUTH TLSzAUTH SSL©Zserver_hostnamer/)Úmoder)r™r&rØrßr1rÙZ PROTOCOL_TLSrsrÚÚ wrap_socketrr8rr9rhrrrràìs   z FTP_TLS.authcCs0t|jtjƒstdƒ‚| d¡}|j ¡|_|S)z/Switch back to a clear-text control connection.z not using TLSZCCC)r™r&rØrßr1rsršrhrrrÚcccøs   z FTP_TLS.ccccCs| d¡| d¡}d|_|S)zSet up secure data connection.zPBSZ 0zPROT PT©rsrÛrhrrrÚprot_ps  zFTP_TLS.prot_pcCs| d¡}d|_|S)z"Set up clear text data connection.zPROT CFrårhrrrÚprot_cs zFTP_TLS.prot_ccs2tƒ ||¡\}}|jr*|jj||jd�}||fS)Nrá)rÜr’rÛrÚrãr)rrqr�r‘r�rÝrrr’s ÿzFTP_TLS.ntransfercmdcCs8dt}|j |¡| ¡}|dd…dvr4t|ƒ‚|S)Nrjr\rk)rlr&rPr`rrnrrrros  z FTP_TLS.abort)rrrT)N)rrrrÎrØZPROTOCOL_TLS_CLIENTrÙrr"rràrärærçr’roÚ __classcell__rrrÝrrÒ«s þý rÒcCs\|dd…dkrt|ƒ‚tdurt |d ƒ}||fS) z¢Parse the '227' response for a PASV request. Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)' Return ('host.addr.as.numbers', port#) tuple.Nr\Z227rz#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)rtr]érE) rÚ_227_rerêrëríÚsearchrÚgroupsrxrÆ)rfrêrðZnumbersrr0rrrr‡Bs r‡cCsÀ|dd…dkrt|ƒ‚| d¡}|dkr2t|ƒ‚| d|d¡}|dkrRt|ƒ‚||d||dkrrt|ƒ‚||d|… ||d¡}t|ƒdkr¤t|ƒ‚|d}t|dƒ}||fS) zšParse the '229' response for an EPSV request. Raises error_proto if it does not contain '(|||port|)' Return ('host.addr.as.numbers', port#) tuple.Nr\Z229ú(rú)r rE)rÚfindrrwrHrÆ)rfZpeerÚleftÚrightÚpartsrr0rrrrŠUs   rŠcCsˆ|dd…dkrt|ƒ‚|dd…dkr,dSd}d}t|ƒ}||kr„||}|d}|dkrz||ks„||dkrrq„|d}||}q<|S) z¤Parse the '257' response for a MKD or PWD request. This is a response to a MKD or PWD request: a directory name. Returns the directoryname in the 257 reply.Nr\rÇrEz "rr ú")rrH)rfrÂrLÚnrgrrrrÊjs  rÊcCs t|ƒdS)z+Default retrlines callback to print a line.N)r=)rSrrrr €sr rÚIc Csš|s|}d|}| |¡| |¡t| d¡ƒ\}}| ||¡| d|¡}|dd…dvrdt‚| d|¡}|dd…dvr†t‚| ¡| ¡dS)z+Copy file from one FTP-instance to another.zTYPE r†zSTOR Nr\>Z125rŒúRETR )rsr‡rrrzrri) ÚsourceZ sourcenameÚtargetZ targetnamer¯Z sourcehostZ sourceportZtreplyZsreplyrrrÚftpcp…s   rc Csàttjƒdkr"ttjƒt d¡ddl}d}d}tjddkrR|d}tjd=q2tjddd…dkr‚tjddd…}tjd=tjd}t|ƒ}|  |¡d}}}z| |¡}Wn&t yÞ|durÚtj   d¡Yn80z|  |¡\}}}Wn t�ytj   d ¡Yn0| |||¡tjdd…D] } | dd…d k�r\| | dd…¡nt| dd…dk�r d } | dd…�r”| d | dd…} | | ¡} n0| d k�rº| |j ¡n| d| tjj d¡�q2| ¡dS)z‚Test program. Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ... -d dir -l list -p password r{rNr z-dz-rrz5Could not open account file -- using anonymous login.z$No account -- using anonymous login.z-lZCWDr©z-prþi)rHr2Úargvr=ÚtestrÎÚexitÚnetrcrrAr(ÚstderrÚwriteZauthenticatorsÚKeyErrorrr±rrrDrBržÚstdoutr') rr<ZrcfilerÚftpZuseridr r!Znetrcobjr9rqrfrrrr›sR        ÿ "   ÿrÚ__main__)rrý)%rÎr2r4rÚ__all__rmrÏrÐÚ Exceptionr rrrrr(r)rrOrlrrØÚ ImportErrorr˜rßrÒrªZSSLErrorrérŽròr‡rŠrÊr rrrrrrrÚsN&  ^   }  9