Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Public Member Functions | |
def | __init__ |
def | connect |
def | getwelcome |
def | set_debuglevel |
def | set_pasv |
def | sanitize |
def | putline |
def | putcmd |
def | getline |
def | getmultiline |
def | getresp |
def | voidresp |
def | abort |
def | sendcmd |
def | voidcmd |
def | sendport |
def | sendeprt |
def | makeport |
def | makepasv |
def | ntransfercmd |
def | transfercmd |
def | login |
def | retrbinary |
def | retrlines |
def | storbinary |
def | storlines |
def | acct |
def | nlst |
def | dir |
def | rename |
def | delete |
def | cwd |
def | size |
def | mkd |
def | rmd |
def | pwd |
def | quit |
def | close |
Data Fields | |
host | |
af | |
debugging | |
passiveserver | |
lastresp | |
Static Public Attributes | |
int | debugging = 0 |
string | host = '' |
port = FTP_PORT | |
sock = None | |
file = None | |
welcome = None | |
int | passiveserver = 1 |
debug = set_debuglevel | |
An 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.
def __init__ | ( | self, | |
host = '' , |
|||
user = '' , |
|||
passwd = '' , |
|||
acct = '' |
|||
) |
Definition at line 106 of file ftplib.py.
References FTP.connect(), and FTP.login().
def abort | ( | self) |
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.
Definition at line 227 of file ftplib.py.
References FTP.debugging, FTP.getmultiline(), and FTP.sanitize().
def acct | ( | self, | |
password | |||
) |
def close | ( | self) |
Close the connection without assuming anything about it.
Definition at line 533 of file ftplib.py.
References Chunk.file, FTP.file, Hook.file, DumbWriter.file, MiniFieldStorage.file, Breakpoint.file, FieldStorage.file, and FTP.sock.
def connect | ( | self, | |
host = '' , |
|||
port = 0 |
|||
) |
def cwd | ( | self, | |
dirname | |||
) |
def delete | ( | self, | |
filename | |||
) |
def dir | ( | self, | |
args | |||
) |
List 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.)
Definition at line 457 of file ftplib.py.
References FTP.retrlines().
def getline | ( | self) |
Definition at line 180 of file ftplib.py.
References FTP.debugging, and FTP.sanitize().
def getmultiline | ( | self) |
def getresp | ( | self) |
Definition at line 207 of file ftplib.py.
References FTP.debugging, FTP.getmultiline(), and FTP.sanitize().
def getwelcome | ( | self) |
Get the welcome message from the server. (this is read and squirreled away by connect())
Definition at line 136 of file ftplib.py.
References FTP.debugging, FTP.sanitize(), and FTP.welcome.
def login | ( | self, | |
user = '' , |
|||
passwd = '' , |
|||
acct = '' |
|||
) |
Login, default anonymous.
Definition at line 348 of file ftplib.py.
References socket.getfqdn(), and FTP.sendcmd().
def makepasv | ( | self) |
Definition at line 298 of file ftplib.py.
References FTP.af, ftplib.parse227(), ftplib.parse229(), and FTP.sendcmd().
def makeport | ( | self) |
Create a new socket and send a PORT command for it.
Definition at line 272 of file ftplib.py.
References FTP.af, FTP.sendeprt(), FTP.sendport(), and socket.socket().
def mkd | ( | self, | |
dirname | |||
) |
Make a directory, return its full pathname.
Definition at line 513 of file ftplib.py.
References ftplib.parse257(), and FTP.sendcmd().
def nlst | ( | self, | |
args | |||
) |
Return a list of files in a given directory (default the current).
Definition at line 448 of file ftplib.py.
References FTP.retrlines().
def ntransfercmd | ( | self, | |
cmd, | |||
rest = None |
|||
) |
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 RESTART command. This is essentially a server marker used to tell the server to skip over any data up to the given marker.
Definition at line 305 of file ftplib.py.
References FTP.makepasv(), FTP.makeport(), ftplib.parse150(), FTP.passiveserver, FTP.sendcmd(), and socket.socket().
def putcmd | ( | self, | |
line | |||
) |
Definition at line 174 of file ftplib.py.
References FTP.debugging, FTP.putline(), and FTP.sanitize().
def putline | ( | self, | |
line | |||
) |
Definition at line 168 of file ftplib.py.
References FTP.debugging, and FTP.sanitize().
def pwd | ( | self) |
Return current working directory.
Definition at line 522 of file ftplib.py.
References ftplib.parse257(), and FTP.sendcmd().
def quit | ( | self) |
Quit, and close the connection.
Definition at line 527 of file ftplib.py.
References Chunk.close(), openrsrc.close(), _Hqxcoderengine.close(), FileInput.close(), _Rlecoderengine.close(), BinHex.close(), _Hqxdecoderengine.close(), Aifc_read.close(), _Rledecoderengine.close(), HexBin.close(), file_wrapper.close(), FTP.close(), and FTP.voidcmd().
def rename | ( | self, | |
fromname, | |||
toname | |||
) |
Rename a file.
Definition at line 472 of file ftplib.py.
References FTP.sendcmd(), and FTP.voidcmd().
def retrbinary | ( | self, | |
cmd, | |||
callback, | |||
blocksize = 8192 , |
|||
rest = None |
|||
) |
Retrieve 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.
Definition at line 374 of file ftplib.py.
References pydoc.callback, FTP.transfercmd(), FTP.voidcmd(), and FTP.voidresp().
def retrlines | ( | self, | |
cmd, | |||
callback = None |
|||
) |
Retrieve 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.
Definition at line 394 of file ftplib.py.
References pydoc.callback, FTP.debugging, FTP.sendcmd(), FTP.transfercmd(), and FTP.voidresp().
def rmd | ( | self, | |
dirname | |||
) |
def sanitize | ( | self, | |
s | |||
) |
def sendcmd | ( | self, | |
cmd | |||
) |
Send a command and return the response.
Definition at line 239 of file ftplib.py.
References FTP.getresp(), and FTP.putcmd().
def sendeprt | ( | self, | |
host, | |||
port | |||
) |
Send a EPRT command with the current host and the given port number.
Definition at line 259 of file ftplib.py.
References FTP.af, string.joinfields, and FTP.voidcmd().
def sendport | ( | self, | |
host, | |||
port | |||
) |
Send a PORT command with the current host and the given port number.
Definition at line 249 of file ftplib.py.
References dospath.join(), and FTP.voidcmd().
def set_debuglevel | ( | self, | |
level | |||
) |
def set_pasv | ( | self, | |
val | |||
) |
def size | ( | self, | |
filename | |||
) |
Retrieve the size of a file.
Definition at line 502 of file ftplib.py.
References FTP.sendcmd(), and string.strip().
def storbinary | ( | self, | |
cmd, | |||
fp, | |||
blocksize = 8192 |
|||
) |
Store a file in binary mode.
Definition at line 418 of file ftplib.py.
References FTP.transfercmd(), FTP.voidcmd(), and FTP.voidresp().
def storlines | ( | self, | |
cmd, | |||
fp | |||
) |
Store a file in line mode.
Definition at line 429 of file ftplib.py.
References FTP.transfercmd(), FTP.voidcmd(), and FTP.voidresp().
def transfercmd | ( | self, | |
cmd, | |||
rest = None |
|||
) |
Like ntransfercmd() but returns only the socket.
Definition at line 344 of file ftplib.py.
References FTP.ntransfercmd().
def voidcmd | ( | self, | |
cmd | |||
) |
Send a command and expect a response beginning with '2'.
Definition at line 244 of file ftplib.py.
References FTP.putcmd(), and FTP.voidresp().
def voidresp | ( | self) |
|
static |