404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.117.148.67: ~ $
�
e f���@s�dZddlZddlZddlZddlZddlmZddgZdZdZdZ	Gd	d
�d
e
�ZGdd�de�ZGd
d�de�Z
Gdd�de�ZGdd�de�ZeeefZdZdZGdd�d�ZyddlZWnek
r*dZYnBXejZGdd�de�Zejd�eeeejfZdadd�Zdadd�Z dd�Z!dd�Z"d d!�Z#d"d#d$d%�Z$Gd&d�d�Z%d'd(�Z&e'd)kr�e&�ndS)*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�Netrc��i c@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�+/opt/alt/python34/lib64/python3.4/ftplib.pyr:src@seZdZdS)�error_replyN)rr	r
rrrrr
;sr
c@seZdZdS)�
error_tempN)rr	r
rrrrr<src@seZdZdS)�
error_permN)rr	r
rrrrr=src@seZdZdS)�error_protoN)rr	r
rrrrr>srz
s
c@s�eZdZdZdZdZeZeZ	dZ
dZdZdZ
dZddddeddd�Zd	d
�Zdd�Zddd[ddd�Zdd�Zdd�ZeZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Z d(d)�Z!d*d+�Z"d,d-�Z#d.d/�Z$d0d1�Z%dd2d3�Z&dd4d5�Z'dddd6d7�Z(d8dd9d:�Z)dd;d<�Z*d8ddd=d>�Z+dd?d@�Z,dAdB�Z-dCdD�Z.dEdF�Z/dgdGdH�Z0dIdJ�Z1dKdL�Z2dMdN�Z3dOdP�Z4dQdR�Z5dSdT�Z6dUdV�Z7dWdX�Z8dYdZ�Z9dS)\rayAn FTP client class.

    To create a connection, call the class using these arguments:
            host, user, passwd, acct, timeout

    The first four arguments are all strings, and have default value ''.
    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.

    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�Nrzlatin-1cCsH||_||_|rD|j|�|rD|j|||�qDndS)N)�source_address�timeout�connect�login)�self�host�user�passwd�acctrrrrr�__init__qs		
zFTP.__init__cCs|S)Nr)rrrr�	__enter__zsz
FTP.__enter__cGsc|jdk	r_z-y|j�Wnttfk
r:YnXWd|jdk	r[|j�nXndS)N)�sock�quit�OSError�EOFError�close)r�argsrrr�__exit__~s	zFTP.__exit__i�cCs�|dkr||_n|dkr0||_n|dkrH||_n|dk	r`||_ntj|j|jf|jd|j�|_|jj|_|jj	dd|j
�|_|j�|_
|j
S)	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.
        rri�Nr�r�encodingi���)r�portrr�socket�create_connectionrZfamily�af�makefiler%�file�getresp�welcome)rrr&rrrrrr�szFTP.connectcCs,|jr%td|j|j��n|jS)z`Get the welcome message from the server.
        (this is read and squirreled away by connect())z	*welcome*)�	debugging�print�sanitizer-)rrrr�
getwelcome�s	zFTP.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_pasvcCsb|dd�dkrXt|jd��}|dd�d|d||d�}nt|�S)N��pass �PASS z
�*>r8r9)�len�rstrip�repr)r�s�irrrr0�s-zFTP.sanitizecCsyd|ksd|kr'td��n|t}|jdkrYtd|j|��n|jj|j|j��dS)N�
�
z4an illegal newline character should not be containedrz*put*)	�
ValueError�CRLFr.r/r0r�sendall�encoder%)r�linerrr�putline�s
zFTP.putlinecCs3|jr"td|j|��n|j|�dS)Nz*cmd*)r.r/r0rG)rrFrrr�putcmd�s	z
FTP.putcmdcCs�|jj|jd�}t|�|jkrDtd|j��n|jdkrltd|j|��n|s{t�n|dd�t	kr�|dd�}n)|dd�t	kr�|dd�}n|S)	Nrzgot more than %d bytesz*get*����rJ���rK)
r+�readline�maxliner;rr.r/r0r rC)rrFrrr�getline�s	zFTP.getlinecCs�|j�}|dd�dkr�|dd�}xQ|j�}|d|}|dd�|kr5|dd�dkr5Pq5q5Wn|S)N���-rA)rN)rrF�codeZnextlinerrr�getmultiline�szFTP.getmultilinecCs�|j�}|jr.td|j|��n|dd�|_|dd�}|d	kra|S|dkr|t|��n|dkr�t|��nt|��dS)
Nz*resp*rOr�1�2�3�4�5>rTrVrU)rSr.r/r0Zlastresprrr)r�resp�crrrr,�s	zFTP.getrespcCs5|j�}|dd�dkr1t|��n|S)z%Expect a response beginning with '2'.NrrU)r,r
)rrYrrr�voidresp�szFTP.voidrespcCszdt}|jdkr2td|j|��n|jj|t�|j�}|dd�d	krvt|��n|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.sABORrz*put urgent*NrO�426�225�226>r\r]r^)	�B_CRLFr.r/r0rrD�MSG_OOBrSr)rrFrYrrr�aborts
z	FTP.abortcCs|j|�|j�S)z'Send a command and return the response.)rHr,)r�cmdrrr�sendcmds
zFTP.sendcmdcCs|j|�|j�S)z8Send a command and expect a response beginning with '2'.)rHr[)rrbrrr�voidcmds
zFTP.voidcmdcCsY|jd�}t|d�t|d�g}||}ddj|�}|j|�S)zUSend a PORT command with the current host and the given
        port number.
        �.�zPORT �,)�splitr=�joinrd)rrr&ZhbytesZpbytes�bytesrbrrr�sendports
 
zFTP.sendportcCs�d}|jtjkr!d}n|jtjkr<d}n|dkrWtd��ndt|�|t|�dg}ddj|�}|j|�S)zESend an EPRT command with the current host and the given port number.rrrIzunsupported address familyrzEPRT �|)r)r'�AF_INETZAF_INET6rr=rird)rrr&r)Zfieldsrbrrr�sendeprt#s		!zFTP.sendeprtc
Cs�d}d}x�tjdd|jtjdtj�D]�}|\}}}}}y&tj|||�}|j|�WnGtk
r�}	z'|	}|r�|j�nd}w4WYdd}	~	XnXPq4W|dkr�|dk	r�|�q�td��n|jd�|j	�d}
|j
j	�d}|jtjkrK|j||
�}n|j
||
�}|jtk	r|j|j�n|S)z3Create a new socket and send a PORT command for it.Nrz!getaddrinfo returns an empty listr)r'Zgetaddrinfor)ZSOCK_STREAMZ
AI_PASSIVEZbindrr!ZlistenZgetsocknamerrmrkrnrr�
settimeout)
r�errr�resr)Zsocktype�protoZ	canonnameZsa�_r&rrYrrr�makeport0s6.
	
zFTP.makeportcCsa|jtjkr0t|jd��\}}n't|jd�|jj��\}}||fS)N�PASVZEPSV)r)r'rm�parse227rc�parse229rZgetpeername)rrr&rrr�makepasvPs'zFTP.makepasvc

Cs�d}|jr�|j�\}}tj||f|jd|j�}yq|dk	rh|jd|�n|j|�}|ddkr�|j�}n|ddkr�t|��nWq�|j	��Yq�Xn�|j
���}|dk	r|jd|�n|j|�}|ddkr.|j�}n|ddkrMt|��n|j�\}}	|jtk	r�|j
|j�nWdQX|dd�dkr�t|�}n||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.
        NrzREST %srrUrTrO�150)r4rxr'r(rrrcr,r
r!rtZacceptrro�parse150)
rrb�rest�sizerr&�connrYrZsockaddrrrr�ntransfercmdWs<	
zFTP.ntransfercmdcCs|j||�dS)z0Like ntransfercmd() but returns only the socket.r)r~)rrbr{rrr�transfercmd�szFTP.transfercmdcCs�|sd}n|sd}n|s-d}n|dkrR|dkrR|d}n|jd|�}|ddkr�|jd|�}n|ddkr�|jd	|�}n|dd
kr�t|��n|S)zLogin, default anonymous.Z	anonymousrrQz
anonymous@zUSER rrVzPASS zACCT rU>rrQ)rcr
)rrrrrYrrrr�s 			
z	FTP.logini c
Cs�|jd�|j||��Y}x'|j|�}|s>Pn||�q%Wtdk	rtt|t�rt|j�nWdQX|j�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.
        zTYPE IN)rdrZrecv�
_SSLSocket�
isinstance�unwrapr[)rrb�callback�	blocksizer{r}�datarrr�
retrbinary�s
zFTP.retrbinarycCsb|dkrt}n|jd�}|j|��#}|jdd|j��}x�|j|jd�}t|�|jkr�td|j��n|j	dkr�t
dt|��n|s�Pn|d
d�tkr�|dd�}n)|dd�d	kr|dd
�}n||�qTWt
dk	rLt|t
�rL|j�nWdQXWdQX|j�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.
        NzTYPE Ar$r%rzgot more than %d bytesrIz*retr*rArJrJrKrK)�
print_linercrr*r%rLrMr;rr.r/r=rCr�r�r�r[)rrbr�rYr}�fprFrrr�	retrlines�s*	z
FTP.retrlinesc
Cs�|jd�|j||��o}x=|j|�}|s>Pn|j|�|r%||�q%q%Wtdk	r�t|t�r�|j�nWdQX|j�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.
        zTYPE IN)rdr�readrDr�r�r�r[)rrbr�r�r�r{r}�bufrrr�
storbinary�s

zFTP.storbinaryc
Cs|jd�|j|���}x�|j|jd�}t|�|jkrctd|j��n|smPn|dd�tkr�|dtkr�|dd�}n|t}n|j|�|r"||�q"q"Wtdk	r�t	|t�r�|j
�nWdQX|j�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.
        zTYPE Arzgot more than %d bytesrINrJrKrK)rdrrLrMr;rr_rDr�r�r�r[)rrbr�r�r}r�rrr�	storliness$


z
FTP.storlinescCsd|}|j|�S)zSend new account name.zACCT )rd)r�passwordrbrrrr%s
zFTP.acctcGsBd}x|D]}|d|}q
Wg}|j||j�|S)zBReturn a list of files in a given directory (default the current).ZNLST� )r��append)rr"rb�arg�filesrrr�nlst*s
zFTP.nlstcGs�d}d}|dd�rVt|d�td�krV|dd�|d	}}nx%|D]}|r]|d|}q]q]W|j||�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.)ZLISTNrrr�rKrKrKrK)�typer�)rr"rb�funcr�rrr�dir3s,
zFTP.dirc
cs�|r'|jddj|�d�n|r:d|}nd}g}|j||j�x�|D]�}|jt�jd�\}}}i}	xI|dd	�jd�D].}
|
jd�\}}}||	|j�<q�W||	fVq`WdS)
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�Nr�=rK)	rcrir�r�r<rC�	partitionrh�lower)
r�pathZfactsrb�linesrFZfacts_foundrs�name�entryZfact�key�valuerrr�mlsdBs!

! zFTP.mlsdcCsC|jd|�}|ddkr2t|��n|jd|�S)zRename a file.zRNFR rrVzRNTO )rcr
rd)rZfromnameZtonamerYrrr�rename^sz
FTP.renamecCs=|jd|�}|dd�dkr-|St|��dS)zDelete a file.zDELE NrO�250�200>r�r�)rcr
)r�filenamerYrrr�deleteesz
FTP.deletecCs�|dkrky|jd�SWq�tk
rg}z(|jddd�dkrU�nWYdd}~Xq�Xn|dkr�d}nd	|}|j|�S)
zChange to a directory.z..ZCDUPrNrO�500rrezCWD )rdrr")r�dirname�msgrbrrr�cwdms	
zFTP.cwdcCsM|jd|�}|dd�dkrI|dd�j�}t|�SdS)zRetrieve the size of a file.zSIZE NrOZ213)rc�strip�int)rr�rYr>rrrr|zszFTP.sizecCs0|jd|�}|jd�s&dSt|�S)z+Make a directory, return its full pathname.zMKD �257r)rd�
startswith�parse257)rr�rYrrr�mkd�szFTP.mkdcCs|jd|�S)zRemove a directory.zRMD )rd)rr�rrr�rmd�szFTP.rmdcCs,|jd�}|jd�s"dSt|�S)z!Return current working directory.ZPWDr�r)rdr�r�)rrYrrr�pwd�szFTP.pwdcCs|jd�}|j�|S)zQuit, and close the connection.ZQUIT)rdr!)rrYrrrr�s
zFTP.quitcCsbz/|j}d|_|dk	r.|j�nWd|j}d|_|dk	r]|j�nXdS)z8Close the connection without assuming anything about it.N)r+r!r)rr+rrrrr!�s				z	FTP.closei���):rr	r
�__doc__r.r�FTP_PORTr&�MAXLINErMrr+r-r4r%rrrr#rr1r3�debugr6r0rGrHrNrSr,r[rarcrdrkrnrtrxr~rrr�r�r�r�rr�r�r�r�r�r�r|r�r�r�rr!rrrrrKsj
	

 7#	
		c@s�eZdZdZejZdddddddeddd�	Zdddddd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
ddd�Zdd�ZdS)�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.'
        >>>
        rNc

Cs�|dk	r'|dk	r'td��n|dk	rN|dk	rNtd��n||_||_|dkr�tj|jd|d|�}n||_d|_tj	|||||||	�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusive�certfile�keyfileF)
rBr�r��sslZ_create_stdlib_context�ssl_version�context�_prot_prr)
rrrrrr�r�r�rrrrrr�s				zFTP_TLS.__init__TcCs?|r)t|jtj�r)|j�ntj||||�S)N)r�rr��	SSLSocket�authrr)rrrrZsecurerrrr�s
z
FTP_TLS.logincCs�t|jtj�r$td��n|jtjkrH|jd�}n|jd�}|jj	|jd|j
�|_|jjddd|j�|_
|S)z2Set up secure control connection by using TLS/SSL.zAlready using TLSzAUTH TLSzAUTH SSL�server_hostname�moder$r%)r�rr�r�rBr��PROTOCOL_SSLv23rdr��wrap_socketrr*r%r+)rrYrrrr��s!zFTP_TLS.authcCsIt|jtj�s$td��n|jd�}|jj�|_|S)z/Switch back to a clear-text control connection.z
not using TLSZCCC)r�rr�r�rBrdr�)rrYrrr�ccc�s
zFTP_TLS.ccccCs)|jd�|jd�}d|_|S)zSet up secure data connection.zPBSZ 0zPROT PT)rdr�)rrYrrr�prot_ps
	zFTP_TLS.prot_pcCs|jd�}d|_|S)z"Set up clear text data connection.zPROT CF)rdr�)rrYrrr�prot_cs	zFTP_TLS.prot_ccCsLtj|||�\}}|jrB|jj|d|j�}n||fS)Nr�)rr~r�r�r�r)rrbr{r}r|rrrr~s
	zFTP_TLS.ntransfercmdcCsOdt}|jj|�|j�}|dd�dkrKt|��n|S)NsABORrOr\r]r^>�426�225�226)r_rrDrSr)rrFrYrrrra!s
z
FTP_TLS.abort)rr	r
r�r�r�r�rrrr�r�r�r�r~rarrrrr��s 	
r�cCs�|dd�dkr%t|��ntdkr\ddl}|jd|j|jB�antj|�}|sudSt|jd��S)z�Parse 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.
    NrOryrz150 .* \((\d+) bytes\)r)	r
�_150_re�re�compile�
IGNORECASE�ASCII�matchr��group)rYr��mrrrrz0srzcCs�|dd�dkr%t|��ntdkrUddl}|jd|j�antj|�}|syt|��n|j�}dj|dd��}t	|d�d>t	|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.NrOZ227rz#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)rerP�r7)
r
�_227_rer�r�r��searchr�groupsrir�)rYr�r�Znumbersrr&rrrrvDs"rvcCs|dd�dkr%t|��n|jd�}|dkrOt|��n|jd|d�}|dkr�t|��n||d||dkr�t|��n||d|�j||d�}t|�dkr�t|��n|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.NrOZ229�(r�)rr7)r
�findrrhr;r�)rYZpeer�left�right�partsrr&rrrrwXs %
rwcCs�|dd�dkr%t|��n|dd�dkr?dSd}d}t|�}xg||kr�||}|d}|dkr�||ks�||dkr�Pn|d}n||}qZW|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.NrOr�r7z "rr�")r
r;)rYr�r?�nrZrrrr�ns 


r�cCst|�dS)z+Default retrlines callback to print a line.N)r/)rFrrrr��sr�r�Ic	Cs�|s|}nd|}|j|�|j|�t|jd��\}}|j||�|jd|�}|dd�d	kr�t�n|jd|�}|dd�d
kr�t�n|j�|j�dS)z+Copy file from one FTP-instance to another.zTYPE ruzSTOR NrO�125ryzRETR >r��150>r�r�)rdrvrcrkrr[)	�sourceZ
sourcename�targetZ
targetnamer�Z
sourcehostZ
sourceportZtreplyZsreplyrrr�ftpcp�s	


		
r�c@sgeZdZdZdZdZdZddd�Zdd�Zdd�Z	d	d
�Z
dd�ZdS)
rz�Class 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.

    NcCs�tjdtd�|dkr\dtjkrMtjjtjdd�}q\td��ni|_i|_	t
|d�}d}xf|j�}|s�Pn|r�|j�r�|j
|�q�n"|r�t|�|j	|<d}n|j�}d}}	}
}d}d}
x.|
t|�kr=||
}|
dt|�krS||
d}nd}|d	krnd}n�|d
kr�|r�|j�}|
d}
n�|dkr�|r�|}	|
d}
nr|dkr�|r�|}
|
d}
nM|d
kr|r|}|
d}
n(|dkr0|r0|}g}d}Pn|
d}
qW|r}|	pP|j|_|
pb|j|_|pt|j|_n|r�||jkr�|j|\}}}|	p�|}	|
p�|}
|p�|}n|	|
|f|j|<q�q�W|j�dS)Nz6This class is deprecated, use the netrc module insteadrI�HOMEz.netrcz!specify file to load or set $HOMEr$rr�default�machinerr�ZaccountZmacdef)�warnings�warn�DeprecationWarning�os�environr�rir�
_Netrc__hosts�_Netrc__macros�openrLr�r��tuplerhr;r��_Netrc__defuser�_Netrc__defpasswd�_Netrc__defacctr!)rr�r�Zin_macrorFZmacro_linesZ
macro_nameZwordsrrrrr�r?Zw1Zw2ZouserZopasswdZoacctrrrr�s|	
		
	
	



zNetrc.__init__cCs
|jj�S)z4Return a list of hosts mentioned in the .netrc file.)r��keys)rrrr�	get_hosts�szNetrc.get_hostscCs||j�}d}}}||jkrB|j|\}}}n|pN|j}|p]|j}|pl|j}|||fS)z�Returns login information for the named host.

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

        N)r�r�r�r�r�)rrrrrrrr�get_account�szNetrc.get_accountcCs
|jj�S)z)Return a list of all defined macro names.)r�r�)rrrr�
get_macrosszNetrc.get_macroscCs|j|S)z6Return a sequence of lines which define a named macro.)r�)rZmacrorrr�	get_macroszNetrc.get_macro)rr	r
r�r�r�r�rr�r�r�r�rrrrr�sCcCskttj�dkr2ttj�tjd�nd}d}x+tjddkrk|d}tjd=qAWtjddd�dkr�tjddd�}tjd=ntjd}t|�}|j|�d}}}yt	|�}Wn1t
k
r$|dk	r tjjd�nYnBXy|j
|�\}}}Wn"tk
retjjd	�YnX|j|||�x�tjdd�D]�}|dd�d
kr�|j|dd��q�|dd�dkrd}	|dd�r
|	d|dd�}	n|j|	�}
q�|d
kr<|j|j�q�|jd|tjjd�q�W|j�dS)z�Test program.
    Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...

    -d dir
    -l list
    -p password
    rIrNrz-dz-rrz5Could not open account file -- using anonymous login.z$No account -- using anonymous login.z-lZCWDr�z-pzRETR i)r;�sys�argvr/�testr��exitrr3rr�stderr�writer��KeyErrorrr�rcr6r4r��stdoutr)r.ZrcfilerZftpZuseridrrZnetrcr+rbrYrrrr�
sN	






	
r��__main__)(r�r�r�r'r�r�__all__r`r�r��	Exceptionrr
rrrrr Z
all_errorsrCr_rr��ImportErrorr�r�r�r�ZSSLErrorr�rzr�rvrwr�r�r�rr�rrrrr�<module>sP
��b
	x
m7

Filemanager

Name Type Size Permission Actions
__future__.cpython-34.pyc File 4.07 KB 0644
__future__.cpython-34.pyo File 4.07 KB 0644
__phello__.foo.cpython-34.pyc File 134 B 0644
__phello__.foo.cpython-34.pyo File 134 B 0644
_bootlocale.cpython-34.pyc File 1.02 KB 0644
_bootlocale.cpython-34.pyo File 1016 B 0644
_collections_abc.cpython-34.pyc File 23.39 KB 0644
_collections_abc.cpython-34.pyo File 23.39 KB 0644
_compat_pickle.cpython-34.pyc File 7.33 KB 0644
_compat_pickle.cpython-34.pyo File 7.25 KB 0644
_dummy_thread.cpython-34.pyc File 4.71 KB 0644
_dummy_thread.cpython-34.pyo File 4.71 KB 0644
_markupbase.cpython-34.pyc File 8.72 KB 0644
_markupbase.cpython-34.pyo File 8.54 KB 0644
_osx_support.cpython-34.pyc File 10.38 KB 0644
_osx_support.cpython-34.pyo File 10.38 KB 0644
_pyio.cpython-34.pyc File 63.41 KB 0644
_pyio.cpython-34.pyo File 63.39 KB 0644
_sitebuiltins.cpython-34.pyc File 3.59 KB 0644
_sitebuiltins.cpython-34.pyo File 3.59 KB 0644
_strptime.cpython-34.pyc File 15.41 KB 0644
_strptime.cpython-34.pyo File 15.41 KB 0644
_sysconfigdata.cpython-34.pyc File 24.49 KB 0644
_sysconfigdata.cpython-34.pyo File 24.49 KB 0644
_threading_local.cpython-34.pyc File 6.78 KB 0644
_threading_local.cpython-34.pyo File 6.78 KB 0644
_weakrefset.cpython-34.pyc File 8.27 KB 0644
_weakrefset.cpython-34.pyo File 8.27 KB 0644
abc.cpython-34.pyc File 7.69 KB 0644
abc.cpython-34.pyo File 7.64 KB 0644
aifc.cpython-34.pyc File 27.26 KB 0644
aifc.cpython-34.pyo File 27.26 KB 0644
antigravity.cpython-34.pyc File 847 B 0644
antigravity.cpython-34.pyo File 847 B 0644
argparse.cpython-34.pyc File 64.33 KB 0644
argparse.cpython-34.pyo File 64.17 KB 0644
ast.cpython-34.pyc File 12.07 KB 0644
ast.cpython-34.pyo File 12.07 KB 0644
asynchat.cpython-34.pyc File 8.16 KB 0644
asynchat.cpython-34.pyo File 8.16 KB 0644
asyncore.cpython-34.pyc File 17.54 KB 0644
asyncore.cpython-34.pyo File 17.54 KB 0644
base64.cpython-34.pyc File 17.87 KB 0644
base64.cpython-34.pyo File 17.67 KB 0644
bdb.cpython-34.pyc File 18.26 KB 0644
bdb.cpython-34.pyo File 18.26 KB 0644
binhex.cpython-34.pyc File 13.22 KB 0644
binhex.cpython-34.pyo File 13.22 KB 0644
bisect.cpython-34.pyc File 2.79 KB 0644
bisect.cpython-34.pyo File 2.79 KB 0644
bz2.cpython-34.pyc File 14.8 KB 0644
bz2.cpython-34.pyo File 14.8 KB 0644
cProfile.cpython-34.pyc File 4.51 KB 0644
cProfile.cpython-34.pyo File 4.51 KB 0644
calendar.cpython-34.pyc File 26.92 KB 0644
calendar.cpython-34.pyo File 26.92 KB 0644
cgi.cpython-34.pyc File 29.13 KB 0644
cgi.cpython-34.pyo File 29.13 KB 0644
cgitb.cpython-34.pyc File 10.8 KB 0644
cgitb.cpython-34.pyo File 10.8 KB 0644
chunk.cpython-34.pyc File 5.15 KB 0644
chunk.cpython-34.pyo File 5.15 KB 0644
cmd.cpython-34.pyc File 13.14 KB 0644
cmd.cpython-34.pyo File 13.14 KB 0644
code.cpython-34.pyc File 9.47 KB 0644
code.cpython-34.pyo File 9.47 KB 0644
codecs.cpython-34.pyc File 34.31 KB 0644
codecs.cpython-34.pyo File 34.31 KB 0644
codeop.cpython-34.pyc File 6.31 KB 0644
codeop.cpython-34.pyo File 6.31 KB 0644
colorsys.cpython-34.pyc File 3.57 KB 0644
colorsys.cpython-34.pyo File 3.57 KB 0644
compileall.cpython-34.pyc File 7.21 KB 0644
compileall.cpython-34.pyo File 7.21 KB 0644
configparser.cpython-34.pyc File 43.83 KB 0644
configparser.cpython-34.pyo File 43.83 KB 0644
contextlib.cpython-34.pyc File 10.13 KB 0644
contextlib.cpython-34.pyo File 10.13 KB 0644
copy.cpython-34.pyc File 7.87 KB 0644
copy.cpython-34.pyo File 7.79 KB 0644
copyreg.cpython-34.pyc File 4.5 KB 0644
copyreg.cpython-34.pyo File 4.46 KB 0644
crypt.cpython-34.pyc File 2.38 KB 0644
crypt.cpython-34.pyo File 2.38 KB 0644
csv.cpython-34.pyc File 12.69 KB 0644
csv.cpython-34.pyo File 12.69 KB 0644
datetime.cpython-34.pyc File 54.95 KB 0644
datetime.cpython-34.pyo File 53.02 KB 0644
decimal.cpython-34.pyc File 168.48 KB 0644
decimal.cpython-34.pyo File 168.48 KB 0644
difflib.cpython-34.pyc File 59.1 KB 0644
difflib.cpython-34.pyo File 59.05 KB 0644
dis.cpython-34.pyc File 14.25 KB 0644
dis.cpython-34.pyo File 14.25 KB 0644
doctest.cpython-34.pyc File 78.23 KB 0644
doctest.cpython-34.pyo File 77.97 KB 0644
dummy_threading.cpython-34.pyc File 1.19 KB 0644
dummy_threading.cpython-34.pyo File 1.19 KB 0644
enum.cpython-34.pyc File 15.96 KB 0644
enum.cpython-34.pyo File 15.96 KB 0644
filecmp.cpython-34.pyc File 8.91 KB 0644
filecmp.cpython-34.pyo File 8.91 KB 0644
fileinput.cpython-34.pyc File 13.96 KB 0644
fileinput.cpython-34.pyo File 13.96 KB 0644
fnmatch.cpython-34.pyc File 3.07 KB 0644
fnmatch.cpython-34.pyo File 3.07 KB 0644
formatter.cpython-34.pyc File 18.47 KB 0644
formatter.cpython-34.pyo File 18.47 KB 0644
fractions.cpython-34.pyc File 18.82 KB 0644
fractions.cpython-34.pyo File 18.82 KB 0644
ftplib.cpython-34.pyc File 32.54 KB 0644
ftplib.cpython-34.pyo File 32.54 KB 0644
functools.cpython-34.pyc File 23.06 KB 0644
functools.cpython-34.pyo File 23.06 KB 0644
genericpath.cpython-34.pyc File 3.41 KB 0644
genericpath.cpython-34.pyo File 3.41 KB 0644
getopt.cpython-34.pyc File 6.58 KB 0644
getopt.cpython-34.pyo File 6.53 KB 0644
getpass.cpython-34.pyc File 4.52 KB 0644
getpass.cpython-34.pyo File 4.52 KB 0644
gettext.cpython-34.pyc File 14.82 KB 0644
gettext.cpython-34.pyo File 14.82 KB 0644
glob.cpython-34.pyc File 2.81 KB 0644
glob.cpython-34.pyo File 2.81 KB 0644
gzip.cpython-34.pyc File 18.99 KB 0644
gzip.cpython-34.pyo File 18.94 KB 0644
hashlib.cpython-34.pyc File 7.76 KB 0644
hashlib.cpython-34.pyo File 7.76 KB 0644
heapq.cpython-34.pyc File 13.58 KB 0644
heapq.cpython-34.pyo File 13.58 KB 0644
hmac.cpython-34.pyc File 5.03 KB 0644
hmac.cpython-34.pyo File 5.03 KB 0644
imaplib.cpython-34.pyc File 42.46 KB 0644
imaplib.cpython-34.pyo File 40 KB 0644
imghdr.cpython-34.pyc File 4.05 KB 0644
imghdr.cpython-34.pyo File 4.05 KB 0644
imp.cpython-34.pyc File 9.64 KB 0644
imp.cpython-34.pyo File 9.64 KB 0644
inspect.cpython-34.pyc File 74.54 KB 0644
inspect.cpython-34.pyo File 74.22 KB 0644
io.cpython-34.pyc File 3.38 KB 0644
io.cpython-34.pyo File 3.38 KB 0644
ipaddress.cpython-34.pyc File 61.51 KB 0644
ipaddress.cpython-34.pyo File 61.51 KB 0644
keyword.cpython-34.pyc File 1.9 KB 0644
keyword.cpython-34.pyo File 1.9 KB 0644
linecache.cpython-34.pyc File 3.04 KB 0644
linecache.cpython-34.pyo File 3.04 KB 0644
locale.cpython-34.pyc File 36.4 KB 0644
locale.cpython-34.pyo File 36.4 KB 0644
lzma.cpython-34.pyc File 15.54 KB 0644
lzma.cpython-34.pyo File 15.54 KB 0644
macpath.cpython-34.pyc File 5.87 KB 0644
macpath.cpython-34.pyo File 5.87 KB 0644
macurl2path.cpython-34.pyc File 2.05 KB 0644
macurl2path.cpython-34.pyo File 2.05 KB 0644
mailbox.cpython-34.pyc File 68.64 KB 0644
mailbox.cpython-34.pyo File 68.54 KB 0644
mailcap.cpython-34.pyc File 6.39 KB 0644
mailcap.cpython-34.pyo File 6.39 KB 0644
mimetypes.cpython-34.pyc File 16.41 KB 0644
mimetypes.cpython-34.pyo File 16.41 KB 0644
modulefinder.cpython-34.pyc File 16.97 KB 0644
modulefinder.cpython-34.pyo File 16.89 KB 0644
netrc.cpython-34.pyc File 4.18 KB 0644
netrc.cpython-34.pyo File 4.18 KB 0644
nntplib.cpython-34.pyc File 35.46 KB 0644
nntplib.cpython-34.pyo File 35.46 KB 0644
ntpath.cpython-34.pyc File 12.99 KB 0644
ntpath.cpython-34.pyo File 12.99 KB 0644
nturl2path.cpython-34.pyc File 1.68 KB 0644
nturl2path.cpython-34.pyo File 1.68 KB 0644
numbers.cpython-34.pyc File 12.37 KB 0644
numbers.cpython-34.pyo File 12.37 KB 0644
opcode.cpython-34.pyc File 5.05 KB 0644
opcode.cpython-34.pyo File 5.05 KB 0644
operator.cpython-34.pyc File 12.48 KB 0644
operator.cpython-34.pyo File 12.48 KB 0644
optparse.cpython-34.pyc File 50.33 KB 0644
optparse.cpython-34.pyo File 50.25 KB 0644
os.cpython-34.pyc File 28.91 KB 0644
os.cpython-34.pyo File 28.91 KB 0644
pathlib.cpython-34.pyc File 39.53 KB 0644
pathlib.cpython-34.pyo File 39.53 KB 0644
pdb.cpython-34.pyc File 48.31 KB 0644
pdb.cpython-34.pyo File 48.25 KB 0644
pickle.cpython-34.pyc File 45.88 KB 0644
pickle.cpython-34.pyo File 45.74 KB 0644
pickletools.cpython-34.pyc File 68.61 KB 0644
pickletools.cpython-34.pyo File 67.55 KB 0644
pipes.cpython-34.pyc File 8.23 KB 0644
pipes.cpython-34.pyo File 8.23 KB 0644
pkgutil.cpython-34.pyc File 17.19 KB 0644
pkgutil.cpython-34.pyo File 17.19 KB 0644
platform.cpython-34.pyc File 30.44 KB 0644
platform.cpython-34.pyo File 30.44 KB 0644
plistlib.cpython-34.pyc File 29.44 KB 0644
plistlib.cpython-34.pyo File 29.36 KB 0644
poplib.cpython-34.pyc File 13.43 KB 0644
poplib.cpython-34.pyo File 13.43 KB 0644
posixpath.cpython-34.pyc File 9.58 KB 0644
posixpath.cpython-34.pyo File 9.58 KB 0644
pprint.cpython-34.pyc File 11.19 KB 0644
pprint.cpython-34.pyo File 11.03 KB 0644
profile.cpython-34.pyc File 14.8 KB 0644
profile.cpython-34.pyo File 14.55 KB 0644
pstats.cpython-34.pyc File 23.12 KB 0644
pstats.cpython-34.pyo File 23.12 KB 0644
pty.cpython-34.pyc File 4.13 KB 0644
pty.cpython-34.pyo File 4.13 KB 0644
py_compile.cpython-34.pyc File 6.7 KB 0644
py_compile.cpython-34.pyo File 6.7 KB 0644
pyclbr.cpython-34.pyc File 8.98 KB 0644
pyclbr.cpython-34.pyo File 8.98 KB 0644
pydoc.cpython-34.pyc File 88.78 KB 0644
pydoc.cpython-34.pyo File 88.72 KB 0644
queue.cpython-34.pyc File 9.04 KB 0644
queue.cpython-34.pyo File 9.04 KB 0644
quopri.cpython-34.pyc File 6.29 KB 0644
quopri.cpython-34.pyo File 6.09 KB 0644
random.cpython-34.pyc File 18.61 KB 0644
random.cpython-34.pyo File 18.61 KB 0644
re.cpython-34.pyc File 14.21 KB 0644
re.cpython-34.pyo File 14.21 KB 0644
reprlib.cpython-34.pyc File 5.73 KB 0644
reprlib.cpython-34.pyo File 5.73 KB 0644
rlcompleter.cpython-34.pyc File 5.56 KB 0644
rlcompleter.cpython-34.pyo File 5.56 KB 0644
runpy.cpython-34.pyc File 7.57 KB 0644
runpy.cpython-34.pyo File 7.57 KB 0644
sched.cpython-34.pyc File 6.42 KB 0644
sched.cpython-34.pyo File 6.42 KB 0644
selectors.cpython-34.pyc File 16.35 KB 0644
selectors.cpython-34.pyo File 16.35 KB 0644
shelve.cpython-34.pyc File 9.72 KB 0644
shelve.cpython-34.pyo File 9.72 KB 0644
shlex.cpython-34.pyc File 7.34 KB 0644
shlex.cpython-34.pyo File 7.34 KB 0644
shutil.cpython-34.pyc File 32.24 KB 0644
shutil.cpython-34.pyo File 32.24 KB 0644
site.cpython-34.pyc File 17.55 KB 0644
site.cpython-34.pyo File 17.55 KB 0644
smtpd.cpython-34.pyc File 25.07 KB 0644
smtpd.cpython-34.pyo File 25.07 KB 0644
smtplib.cpython-34.pyc File 32.35 KB 0644
smtplib.cpython-34.pyo File 32.28 KB 0644
sndhdr.cpython-34.pyc File 6.61 KB 0644
sndhdr.cpython-34.pyo File 6.61 KB 0644
socket.cpython-34.pyc File 17.69 KB 0644
socket.cpython-34.pyo File 17.64 KB 0644
socketserver.cpython-34.pyc File 22.71 KB 0644
socketserver.cpython-34.pyo File 22.71 KB 0644
sre_compile.cpython-34.pyc File 11.66 KB 0644
sre_compile.cpython-34.pyo File 11.5 KB 0644
sre_constants.cpython-34.pyc File 5.45 KB 0644
sre_constants.cpython-34.pyo File 5.45 KB 0644
sre_parse.cpython-34.pyc File 19.76 KB 0644
sre_parse.cpython-34.pyo File 19.76 KB 0644
ssl.cpython-34.pyc File 26.96 KB 0644
ssl.cpython-34.pyo File 26.96 KB 0644
stat.cpython-34.pyc File 3.49 KB 0644
stat.cpython-34.pyo File 3.49 KB 0644
statistics.cpython-34.pyc File 16.76 KB 0644
statistics.cpython-34.pyo File 16.46 KB 0644
string.cpython-34.pyc File 8.18 KB 0644
string.cpython-34.pyo File 8.18 KB 0644
stringprep.cpython-34.pyc File 13.32 KB 0644
stringprep.cpython-34.pyo File 13.25 KB 0644
struct.cpython-34.pyc File 347 B 0644
struct.cpython-34.pyo File 347 B 0644
subprocess.cpython-34.pyc File 42.34 KB 0644
subprocess.cpython-34.pyo File 42.23 KB 0644
sunau.cpython-34.pyc File 17.88 KB 0644
sunau.cpython-34.pyo File 17.88 KB 0644
symbol.cpython-34.pyc File 2.6 KB 0644
symbol.cpython-34.pyo File 2.6 KB 0644
symtable.cpython-34.pyc File 11.04 KB 0644
symtable.cpython-34.pyo File 10.92 KB 0644
sysconfig.cpython-34.pyc File 16.88 KB 0644
sysconfig.cpython-34.pyo File 16.88 KB 0644
tabnanny.cpython-34.pyc File 7.57 KB 0644
tabnanny.cpython-34.pyo File 7.57 KB 0644
tarfile.cpython-34.pyc File 66.45 KB 0644
tarfile.cpython-34.pyo File 66.45 KB 0644
telnetlib.cpython-34.pyc File 18.94 KB 0644
telnetlib.cpython-34.pyo File 18.94 KB 0644
tempfile.cpython-34.pyc File 21.07 KB 0644
tempfile.cpython-34.pyo File 21.07 KB 0644
textwrap.cpython-34.pyc File 13.48 KB 0644
textwrap.cpython-34.pyo File 13.39 KB 0644
this.cpython-34.pyc File 1.29 KB 0644
this.cpython-34.pyo File 1.29 KB 0644
threading.cpython-34.pyc File 38.05 KB 0644
threading.cpython-34.pyo File 37.36 KB 0644
timeit.cpython-34.pyc File 10.8 KB 0644
timeit.cpython-34.pyo File 10.8 KB 0644
token.cpython-34.pyc File 3.53 KB 0644
token.cpython-34.pyo File 3.53 KB 0644
tokenize.cpython-34.pyc File 19.48 KB 0644
tokenize.cpython-34.pyo File 19.43 KB 0644
trace.cpython-34.pyc File 23.62 KB 0644
trace.cpython-34.pyo File 23.56 KB 0644
traceback.cpython-34.pyc File 10.83 KB 0644
traceback.cpython-34.pyo File 10.83 KB 0644
tracemalloc.cpython-34.pyc File 16.73 KB 0644
tracemalloc.cpython-34.pyo File 16.73 KB 0644
tty.cpython-34.pyc File 1.12 KB 0644
tty.cpython-34.pyo File 1.12 KB 0644
types.cpython-34.pyc File 5.43 KB 0644
types.cpython-34.pyo File 5.43 KB 0644
uu.cpython-34.pyc File 3.93 KB 0644
uu.cpython-34.pyo File 3.93 KB 0644
uuid.cpython-34.pyc File 21.35 KB 0644
uuid.cpython-34.pyo File 21.29 KB 0644
warnings.cpython-34.pyc File 11.98 KB 0644
warnings.cpython-34.pyo File 11.27 KB 0644
wave.cpython-34.pyc File 18.69 KB 0644
wave.cpython-34.pyo File 18.63 KB 0644
weakref.cpython-34.pyc File 19.87 KB 0644
weakref.cpython-34.pyo File 19.83 KB 0644
webbrowser.cpython-34.pyc File 16.73 KB 0644
webbrowser.cpython-34.pyo File 16.69 KB 0644
xdrlib.cpython-34.pyc File 8.79 KB 0644
xdrlib.cpython-34.pyo File 8.79 KB 0644
zipfile.cpython-34.pyc File 44.75 KB 0644
zipfile.cpython-34.pyo File 44.7 KB 0644