//usr/lib64/lib64//lib64//python2.7/ó
V
Qc @ sž d d l Z d d l Z d d l Z d d l Td Z d Z e d Z e d Z d „ Z d „ Z d a d
„ Z
d „ Z d „ Z d
„ Z
d „ Z e ƒ d S( iÿÿÿÿN( t *i i i iPÃ c C s t j d } t | ƒ d S( Ni ( t syst argvt control( t hostname( ( s( /usr/lib64/python2.7/Demo/sockets/ftp.pyt main' s
c C sÄ t t t ƒ } | j | t f ƒ | j d ƒ } d } x† t | ƒ } | d k rV Pn | d k r t | ƒ t | ƒ } d } n | s™ t | | ƒ } n t
ƒ } | s¬ Pn | j | d ƒ q: d S( Nt rt 221t EOFt 150s
( R R ( t sockett AF_INETt SOCK_STREAMt connectt FTP_PORTt makefilet Nonet getreplyt getdatat newdataportt
getcommandt send( R t st fR t codet cmd( ( s( /usr/lib64/python2.7/Demo/sockets/ftp.pyR . s$
i c C sd t t } t d d a t t t ƒ } | j t t ƒ ƒ | f ƒ | j d ƒ t | | | ƒ | S( Ni i (
t nextportt
FTP_DATA_PORTR
R R t bindt
gethostbynamet gethostnamet listent sendportcmd( R R t portR ( ( s( /usr/lib64/python2.7/Demo/sockets/ftp.pyR M s
c
C sˆ t ƒ } t | ƒ } t j | d ƒ } t | d ƒ t | d ƒ g } | | } d t j | d ƒ } | j | d ƒ t | ƒ } d S( Nt .i s PORT t ,s
( R R t stringt splitfieldst reprt
joinfieldsR R (
R R R! R t hostaddrt hbytest pbytest bytesR R ( ( s( /usr/lib64/python2.7/Demo/sockets/ftp.pyR Z s
c C s… | j ƒ } | s d S| G| d } | d d !d k r xG | j ƒ } | sP Pn | G| d | k r: | d d !d k r: Pq: q: n | S( NR i i t -( t readline( R t lineR ( ( s( /usr/lib64/python2.7/Demo/sockets/ftp.pyR k s
#
c C sT d GH| j ƒ \ } } d GHx, | j t ƒ } | s8 Pn t j j | ƒ q d GHd S( Ns (accepting data connection)s (data connection accepted)s (end of data connection)( t acceptt recvt BUFSIZER t stdoutt write( R t connt hostt data( ( s( /usr/lib64/python2.7/Demo/sockets/ftp.pyR { s c C s9 y x t d ƒ } | r | Sq Wn t k
r4 d SXd S( Ns ftp.py> t ( t raw_inputt EOFError( R. ( ( s( /usr/lib64/python2.7/Demo/sockets/ftp.pyR ‡ s
( R t posixR$ R
R1 R R R R R R R R R R ( ( ( s( /usr/lib64/python2.7/Demo/sockets/ftp.pyt s $