KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/22697/root/usr/lib64/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/22697/root/usr/lib64/python2.4/ftplib.pyo
m
=5Dc@sdZdkZdkZy/dkZeZ[dklZee_[Wnej
odkZnXddgZdZdZ	de
fdYZd	efd
YZdefdYZ
d
efdYZdefdYZeeieefZdZdfdYZeadZeadZdZdZdZdddZdfdYZdZ e!djoe ndS(sSAn 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(sgetfqdntFTPtNetrciitErrorcBstZRS(N(t__name__t
__module__(((t/usr/lib64/python2.4/ftplib.pyR:sterror_replycBstZRS(N(RR(((RR;st
error_tempcBstZRS(N(RR(((RR<st
error_permcBstZRS(N(RR(((RR=sterror_protocBstZRS(N(RR(((RR	>ss
cBstZdZdZdZeZeZeZ	eZ
dZdddddZdddZ
dZdZeZdZd	Zd
ZdZdZd
ZdZdZdZdZdZdZdZdZdZedZ edZ!ddddZ"dedZ#edZ$ddZ%dZ&dZ'd Z(d!Z)d"Z*d#Z+d$Z,d%Z-d&Z.d'Z/d(Z0d)Z1d*Z2RS(+scAn FTP client class.

    To create a connection, call the class using these argument:
            host, user, passwd, acct
    These are all strings, and have default value ''.
    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.
iticCs:|o/|i||o|i|||q6ndS(N(thosttselftconnecttusertlogintpasswdtacct(RRRRR((Rt__init__is
c
Cs,|o
||_n|o
||_nd}xti|i|idtiD]}|\}}}}}	y,ti||||_
|i
i|	Wn?tij
o0}|i
o|i
ind|_
qPnXPqPW|i
pti|n||_|i
id|_|i|_|iS(sConnect to host.  Arguments are:
        - host: hostname to connect to (string, default previous host)
        - port: port to connect to (integer, default previous port)s!getaddrinfo returns an empty listitrbN(RRtporttmsgtsockettgetaddrinfotSOCK_STREAMtrestaftsocktypetprotot	canonnametsatsockR
terrortclosetNonetmakefiletfiletgetresptwelcome(
RRRRRRRRRR((RR
ns0

"
	
	cCs*|iodG|i|iGHn|iS(s`Get the welcome message from the server.
        (this is read and squirreled away by connect())s	*welcome*N(Rt	debuggingtsanitizeR&(R((Rt
getwelcomes
cCs
||_dS(sSet 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(tlevelRR'(RR*((Rtset_debuglevelscCs
||_dS(sUse 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(tvalRt
passiveserver(RR,((Rtset_pasvscCs|d djp|d djobt|}x1|djo#||ddjo|d}q1W|d d|d||}nt|S(Nispass sPASS is
t*(tstlentitrepr(RR0R2((RR(s"""cCsD|t}|idjodG|i|GHn|ii|dS(Nis*put*(tlinetCRLFRR'R(Rtsendall(RR4((Rtputlines
cCs1|iodG|i|GHn|i|dS(Ns*cmd*(RR'R(R4R7(RR4((Rtputcmds
cCs|ii}|idjodG|i|GHn|p
tn|dtjo|d }n |dtjo|d }n|S(Nis*get*ii(RR$treadlineR4R'R(tEOFErrorR5(RR4((Rtgetlines
cCs~|i}|dd!djoZ|d }xM|i}|d|}|d |jo|dd!djoPq-q-Wn|S(Niit-is
(RR;R4tcodetnextline(RR>R=R4((Rtgetmultilines
%cCs|i}|iodG|i|GHn|d |_|d }|d	jo|Sn|djo
t|n|djo
t|nt	|dS(
Ns*resp*iit1t2t3t4t5(R@RARB(
RR?trespR'R(tlastresptcRRR	(RRGRE((RR%s







cCs.|i}|ddjo
t|n|S(s%Expect a response beginning with '2'.iRAN(RR%RER(RRE((Rtvoidresps

cCsqdt}|idjodG|i|GHn|ii|t|i}|d djo
t
|ndS(	sAbort 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.tABORis*put urgent*it426t226N(RJRK(R5R4RR'R(RR6tMSG_OOBR?RER	(RR4RE((Rtaborts
cCs|i||iS(s'Send a command and return the response.N(RR8tcmdR%(RRN((Rtsendcmds
cCs|i||iS(s8Send a command and expect a response beginning with '2'.N(RR8RNRH(RRN((Rtvoidcmds
cCsY|id}t|dt|dg}||}ddi|}|i
|S(sUSend a PORT command with the current host and the given
        port number.
        t.isPORT t,N(RtsplitthbytesR3RtpbytestbytestjoinRNRRP(RRRRNRVRTRU((Rtsendports 
cCsd}|itijo
d}n|itijo
d}n|djo
tdndt||t|dg}ddi
|}|i|S(	sDSend a EPRT command with the current host and the given port number.iiisunsupported address familyR
sEPRT t|N(
RRRtAF_INETtAF_INET6R	R3RRtfieldsRWRNRP(RRRRR\RN((Rtsendeprts



!cCs9d}	d}xtidd|itidtiD]{}|\}}}}}
y&ti|||}|i|
Wn6tij
o'}	|o|ind}q4nXPq4W|pti|	n|id|id}|iid}|itijo|i||}n|i||}|S(s3Create a new socket and send a PORT command for it.s!getaddrinfo returns an empty listiiN(RR"RRRRRRt
AI_PASSIVERRRRRtbindR R!tlistentgetsocknameRRRZRXRER](RRRRRRERRRRRR((Rtmakeports0(
cCsc|itijot|id\}}n(t|id|i	i
\}}||fS(NtPASVtEPSV(RRRRZtparse227RORRtparse229Rtgetpeername(RRR((Rtmakepasv)s'cCs]d}|io|i\}	}ti|	|dti	d\}}
}}}ti||
|}
|
i||dj	o|id|n|i|}|ddjo
t|q2nn|i}|dj	o|id|n|i|}|ddjo
t|n|i\}
}|d djot|}n|
|fS(sInitiate 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 RESTART command.  This is essentially a server
        marker used to tell the server to skip over any data up to the
        given marker.
        isREST %sR@it150N(R"tsizeRR-RhRRRRRRRRtcanonRtconnR
trestRORNRERRbRtaccepttsockaddrtparse150(RRNRmRoRRRRkRERRRRRlRj((Rtntransfercmd0s,
.



cCs|i||dS(s0Like ntransfercmd() but returns only the socket.iN(RRqRNRm(RRNRm((RttransfercmdWscCs|p
d}n|p
d}n|p
d}n|djo|djo|d}n|id|}|ddjo|id|}n|ddjo|id	|}n|dd
jo
t|n|S(
sLogin, default anonymous.t	anonymousR
R<s
anonymous@sUSER iRBsPASS sACCT RAN(R
R<(RRRRRORER(RRRRRE((RR[s"



i cCs`|id|i||}x*|i|}|pPn||q"W|i
|iS(sURetrieve data in binary mode.

        `cmd' is a RETR command.  `callback' is a callback function is
        called for each block.  No more than `blocksize' number of
        bytes will be read from the socket.  Optional `rest' is passed
        to transfercmd().

        A new port is created for you.  Return the response code.
        sTYPE IiN(RRPRrRNRmRltrecvt	blocksizetdatatcallbackR!RH(RRNRwRuRmRvRl((Rt
retrbinaryps	

cCs|d	jo
t}n|id}|i|}|i	d}x|i}|i
djodGt|GHn|pPn|dtjo|d }n |ddjo|d }n||qGW|i|i|iS(
sRetrieve data in line mode.
        The argument is a RETR or LIST command.
        The callback function (2nd argument) is called for each line,
        with trailing CRLF stripped.  This creates a new port for you.
        print_line() is the default callback.sTYPE ARiis*retr*iis
N(RwR"t
print_lineRRORERrRNRlR#tfpR9R4R'R3R5R!RH(RRNRwRzR4RERl((Rt	retrliness*



cCs`|id|i|}x-|i|}|pPn|i	|qW|i
|iS(sStore a file in binary mode.sTYPE IiN(RRPRrRNRlRztreadRutbufR6R!RH(RRNRzRuR}Rl((Rt
storbinarys

cCs|id|i|}xh|i}|pPn|dtjo-|dtjo|d }n|t}n|i	|qW|i
|iS(sStore a file in line mode.sTYPE AiiiN(RRPRrRNRlRzR9R}R5R6R!RH(RRNRzR}Rl((Rt	storliness

cCsd|}|i|S(sSend new account name.sACCT N(tpasswordRNRRP(RRRN((RRs
cGsBd}x|D]}|d|}q
Wg}|i||i|S(sBReturn a list of files in a given directory (default the current).tNLSTt N(RNtargstargtfilesRR{tappend(RRRNRR((RtnlstscGsd}d}|do6t|dtdjo|d |d}}nx'|D]}|o|d|}qTqTW|i||dS(sList 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.)tLISTiR
RN(RNR"tfuncRttypeRRR{(RRRNRR((Rtdirs(cCsB|id|}|ddjo
t|n|id|S(sRename a file.sRNFR iRBsRNTO N(RROtfromnameRERRPttoname(RRRRE((Rtrenames

cCsW|id|}|d djo|Sn(|d djo
t|n
t|dS(	sDelete a file.sDELE it250t200iRDN(RR(RROtfilenameRERR(RRRE((Rtdeletes
cCs|djoLy|idSWqptj
o(}|idd djoqUqpXn|djo
d}nd|}|i|S(
sChange to a directory.s..tCDUPiit500R
RQsCWD N(tdirnameRRPRRRRN(RRRRN((Rtcwds



cCsp|id|}|d djoH|di}yt|SWqlttfj
ot	|SqlXndS(sRetrieve the size of a file.sSIZE it213N(
RRORREtstripR0tintt
OverflowErrort
ValueErrortlong(RRRER0((RRjscCs|id|}t|S(s+Make a directory, return its full pathname.sMKD N(RRORREtparse257(RRRE((RtmkdscCs|id|S(sRemove a directory.sRMD N(RRPR(RR((RtrmdscCs|id}t|S(s!Return current working directory.tPWDN(RRORER(RRE((RtpwdscCs|id}|i|S(sQuit, and close the connection.tQUITN(RRPRER!(RRE((Rtquit	s
cCs<|io.|ii|iid|_|_ndS(s8Close the connection without assuming anything about it.N(RR$R!RR"(R((RR!s



(3RRt__doc__R'RtFTP_PORTRR"RR$R&R-RR
R)R+tdebugR.R(R7R8R;R?R%RHRMRORPRXR]RbRhRqRrRRxR{R~RRRRRRRRjRRRRR!(((RRKs^								
		
					
	
		'							
	
					cCs|d djo
t|ntdjo"dk}|id|ianti|}|pdSn|i	d}yt|SWn#tt
fj
ot|SnXdS(sParse the '150' response for a RETR request.
    Returns the expected transfer size or None; size is not guaranteed to
    be present in the 150 message.
    iRiNs150 .* \((\d+) bytes\)i(RERt_150_reR"tretcompilet
IGNORECASEtmatchtmtgroupR0RRRR(RERR0R((RRps

	cCs|d djo
t|ntdjodk}|idanti|}|p
t|n|i	}di|d }t
|dd>t
|d}||fS(	sParse 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.it227Ns#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)RQiii(RERt_227_reR"RRtsearchRR	tgroupstnumbersRWRRR(RERRRRR((RRe0s

	
"cCs|d djo
t|n|id}|djo
t|n|id|d}|djo
t|n||d||djo
t|n||d|!i||d}t|djo
t|n|d}t|d}||fS(	sParse the '229' response for a EPSV request.
    Raises error_proto if it does not contain '(|||port|)'
    Return ('host.addr.as.numbers', port#) tuple.it229t(it)iiN(
RERtfindtleftR	trightRStpartsR1tpeerRRR(RERRRRRR((RRfDs"





"

cCs|d djo
t|n|dd!djodSnd}d}t|}xn||jo`||}|d}|djo1||jp||djoPn|d}n||}qUW|S(	sParse 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.it257is "R
it"N(RERRR2R1tnRG(RERGR2RR((RRZs$




cCs	|GHdS(s+Default retrlines callback to print a line.N(R4(R4((RRyqsR
tIc	Cs|p
|}nd|}|i||i|t|id\}}|i
|||id|}|d d	jo
tn|id|}|d d
jo
tn|i|idS(s+Copy file from one FTP-instance to another.sTYPE RcsSTOR it125RisRETR N(Rs150(Rs150(t
targetnamet
sourcenameRtsourceRPttargetReROt
sourcehostt
sourceportRXttreplyR	tsreplyRH(	RRRRRRRRR((Rtftpcpvs 






cBsPtZdZeZeZeZedZdZdZ	dZ
dZRS(sClass to parse & provide access to 'netrc' format files.

    See the netrc(4) man page for information on the file format.

    WARNING: This class is obsolete -- use module netrc instead.

    cCs|djo=dtijo tiitidd}qJtdnh|_h|_	t
|d}	d}x|	i
}|pPn|o!|io|i|qtn%|ot||i	|
<d}n|i}d}}
}}d}d}xC|t|jo/||}|dt|jo||d}nd}|djo
d}n|djo!|o|i}|d}n|d	jo|o|}
|d}n||d
jo|o|}|d}nT|djo|o|}|d}n,|djo|o|}
g}d}Pn|d}qW|o=|
p|i |_ |p|i!|_!|p|i"|_"n|ok||ijoA|i|\}}}|
p|}
|p|}|p|}n|
||f|i|<qtqtW|	i&dS(
NtHOMEs.netrcs!specify file to load or set $HOMEtriitdefaulttmachineRRtaccounttmacdef('RR"tostenvirontpathRWtIOErrorRt
_Netrc__hostst_Netrc__macrostopenRztin_macroR9R4Rtmacro_linesRttuplet
macro_nameRStwordsRRRRRR2R1tw1tw2tlowert_Netrc__defusert_Netrc__defpasswdt_Netrc__defaccttousertopasswdtoacctR!(RRRRRRRRRRzRRRRRR4R2RR((RRs|


		






cCs
|iiS(s4Return a list of hosts mentioned in the .netrc file.N(RRtkeys(R((Rt	get_hostsscCs|i}d}}}||ijo|i|\}}}n|p|i}|p|i	}|p|i
}|||fS(sReturns login information for the named host.

        The return value is a triple containing userid,
        password, and the accounting field.

        N(RRR"RRRRRRRR(RRRRR((Rtget_accountscCs
|iiS(s)Return a list of all defined macro names.N(RRR(R((Rt
get_macrosscCs|i|S(s6Return a sequence of lines which define a named macro.N(RRtmacro(RR((Rt	get_macros(RRRR"RRRRRRRR(((RRsA			cCsHttidjotiGHtidnd}d}
x-tiddjo|d}tid=q>Wtidd djotidd}
tid=ntid}t
|}|i|d}}}	yt|
}Wn4tj
o(|
dj	otiidq_nDXy|i|\}}}	Wn#tj
otiidnX|i|||	xtidD]}|d d	jo|i|dq|d djo:d
}|do|d|d}n|i|}q|djo|i|iq|id
|ti idqW|i!dS(sTest program.
    Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...

    -d dir
    -l list
    -p password
    iiis-ds-rR
s5Could not open account file -- using anonymous login.s$No account -- using anonymous login.s-ltCWDRs-psRETR iN("R1tsystargvttestRtexitR'R"trcfileRRtftpR+tuseridRRRtnetrcRtstderrtwriteRtKeyErrorRR$RRNRORER.R-RxtstdoutR(R'RRRNRRRRER$RR((RRsR





t__main__("RRRtSOCKSRtgetfqdntImportErrort__all__RLRt	ExceptionRRRRR	R RR:t
all_errorsR5RR"RRpRReRfRRyRRRR(RRRRRpRRRRReRRRRRfRR5RRyRLRR	RR((Rt?s>							k	7


Anon7 - 2021