Vega strike Python Modules doc
0.5.1
Documentation of the " Modules " folder of Vega strike
|
Public Member Functions | |
def | __init__ |
def | open |
def | __del__ |
def | msg |
def | set_debuglevel |
def | close |
def | get_socket |
def | fileno |
def | write |
def | read_until |
def | read_all |
def | read_some |
def | read_very_eager |
def | read_eager |
def | read_lazy |
def | read_very_lazy |
def | set_option_negotiation_callback |
def | process_rawq |
def | rawq_getchar |
def | fill_rawq |
def | sock_avail |
def | interact |
def | mt_interact |
def | listener |
def | expect |
Data Fields | |
debuglevel | |
host | |
port | |
sock | |
rawq | |
irawq | |
cookedq | |
eof | |
option_callback | |
Telnet interface class. An instance of this class represents a connection to a telnet server. The instance is initially not connected; the open() method must be used to establish a connection. Alternatively, the host name and optional port number can be passed to the constructor, too. Don't try to reopen an already connected instance. This class has many read_*() methods. Note that some of them raise EOFError when the end of the connection is read, because they can return an empty string for other reasons. See the individual doc strings. read_until(expected, [timeout]) Read until the expected string has been seen, or a timeout is hit (default is no timeout); may block. read_all() Read all data until EOF; may block. read_some() Read at least one byte or EOF; may block. read_very_eager() Read all data available already queued or on the socket, without blocking. read_eager() Read either data already queued or some data available on the socket, without blocking. read_lazy() Read all data in the raw queue (processing it first), without doing any socket I/O. read_very_lazy() Reads all data in the cooked queue, without doing any socket I/O. set_option_negotiation_callback(callback) Each time a telnet option is read on the input flow, this callback (if set) is called with the following parameters : callback(telnet socket, command (DO/DONT/WILL/WONT), option) No other action is done afterwards by telnetlib.
Definition at line 121 of file telnetlib.py.
def __init__ | ( | self, | |
host = None , |
|||
port = 0 |
|||
) |
Constructor. When called without arguments, create an unconnected instance. With a hostname argument, it connects the instance; a port number is optional.
Definition at line 172 of file telnetlib.py.
def __del__ | ( | self) |
Destructor -- close the connection.
Definition at line 221 of file telnetlib.py.
References FileWrapper.close(), StringIO.close(), Shelf.close(), Chunk.close(), _Subfile.close(), SGMLParser.close(), openrsrc.close(), _socketobject.close(), SSLFakeSocket.close(), _Hqxcoderengine.close(), SSLFakeFile.close(), FileInput.close(), _fileobject.close(), _Rlecoderengine.close(), HTTPResponse.close(), BinHex.close(), GzipFile.close(), Telnet.close(), Au_read.close(), _Hqxdecoderengine.close(), Aifc_read.close(), _Rledecoderengine.close(), HTTPConnection.close(), Au_write.close(), HexBin.close(), TestSGMLParser.close(), file_wrapper.close(), FTP.close(), SMTP.close(), and HTTP.close().
def close | ( | self) |
Close the connection.
Definition at line 247 of file telnetlib.py.
References Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, POP3.sock, FTP.sock, NNTP.sock, Telnet.sock, SMTP.sock, HTTPConnection.sock, and HTTPSConnection.sock.
def expect | ( | self, | |
list, | |||
timeout = None |
|||
) |
Read until one from a list of a regular expressions matches. The first argument is a list of regular expressions, either compiled (re.RegexObject instances) or uncompiled (strings). The optional second argument is a timeout, in seconds; default is no timeout. Return a tuple of three items: the index in the list of the first regular expression that matches; the match object returned; and the text read up till and including the match. If EOF is read and no text was read, raise EOFError. Otherwise, when nothing matches, return (-1, None, text) where text is the text received so far (may be the empty string if a timeout happened). If a regular expression ends with a greedy match (e.g. '.*') or if more than one expression can match the same input, the results are undeterministic, and may depend on the I/O timing.
Definition at line 513 of file telnetlib.py.
References Telnet.cookedq, Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, _fileobject.fileno(), Telnet.fileno(), TCPServer.fileno(), file_wrapper.fileno(), addbase.fileno, Telnet.fill_rawq(), Telnet.process_rawq(), Telnet.read_very_lazy(), and pre.search().
def fileno | ( | self) |
Return the fileno() of the socket object used internally.
Definition at line 258 of file telnetlib.py.
def fill_rawq | ( | self) |
Fill raw queue from exactly one recv() system call. Block if no data is immediately available. Set self.eof when connection is closed.
Definition at line 447 of file telnetlib.py.
References Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, Telnet.irawq, NetrcParseError.msg, GetoptError.msg, Error.msg, HTTPResponse.msg, HTTPError.msg, Telnet.msg(), and Telnet.rawq.
def get_socket | ( | self) |
Return the socket object used internally.
Definition at line 254 of file telnetlib.py.
References POP3.sock, FTP.sock, NNTP.sock, Telnet.sock, SMTP.sock, HTTPConnection.sock, and HTTPSConnection.sock.
def interact | ( | self) |
Interaction function, emulates a very dumb telnet client.
Definition at line 468 of file telnetlib.py.
References Telnet.mt_interact(), Telnet.read_eager(), Devnull.write(), Pickler.write, openrsrc.write(), _Hqxcoderengine.write(), StreamWriter.write(), GzipFile.write(), StringIO.write(), _Rlecoderengine.write(), InteractiveInterpreter.write(), _fileobject.write(), BinHex.write(), Telnet.write(), StreamReaderWriter.write(), ConfigParser.write(), _SpoofOut.write(), StreamRecoder.write(), Marshaller.write, and file_wrapper.write.
def listener | ( | self) |
Helper for mt_interact() -- this executes in the other thread.
Definition at line 500 of file telnetlib.py.
References Telnet.read_eager().
def msg | ( | self, | |
msg, | |||
args | |||
) |
Print a debug message, when the debug level is > 0. If extra arguments are present, they are substituted in the message using the standard string formatting operator.
Definition at line 225 of file telnetlib.py.
References HTTPResponse.debuglevel, Telnet.debuglevel, SMTP.debuglevel, HTTPConnection.debuglevel, HTTP.debuglevel, POP3.host, FTP.host, NNTP.host, Telnet.host, HTTPConnection.host, POP3.port, FTP.port, NNTP.port, Telnet.port, and HTTPConnection.port.
def mt_interact | ( | self) |
Multithreaded version of interact().
Definition at line 490 of file telnetlib.py.
References Telnet.listener(), Devnull.write(), Pickler.write, openrsrc.write(), _Hqxcoderengine.write(), StreamWriter.write(), GzipFile.write(), StringIO.write(), _Rlecoderengine.write(), InteractiveInterpreter.write(), _fileobject.write(), BinHex.write(), Telnet.write(), StreamReaderWriter.write(), ConfigParser.write(), _SpoofOut.write(), StreamRecoder.write(), Marshaller.write, and file_wrapper.write.
def open | ( | self, | |
host, | |||
port = 0 |
|||
) |
Connect to a host. The optional second argument is the port number, which defaults to the standard telnet port (23). Don't try to reopen an already connected instance.
Definition at line 192 of file telnetlib.py.
References Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, POP3.host, FTP.host, NNTP.host, Telnet.host, HTTPConnection.host, POP3.port, FTP.port, NNTP.port, Telnet.port, HTTPConnection.port, POP3.sock, FTP.sock, NNTP.sock, Telnet.sock, SMTP.sock, HTTPConnection.sock, HTTPSConnection.sock, and socket.socket().
def process_rawq | ( | self) |
Transfer from raw queue to cooked queue. Set self.eof when connection is closed. Don't block unless in the midst of an IAC sequence.
Definition at line 387 of file telnetlib.py.
References Telnet.cookedq, NetrcParseError.msg, GetoptError.msg, Error.msg, HTTPResponse.msg, HTTPError.msg, Telnet.msg(), Telnet.option_callback, Telnet.rawq, Telnet.rawq_getchar(), POP3.sock, FTP.sock, NNTP.sock, Telnet.sock, SMTP.sock, HTTPConnection.sock, and HTTPSConnection.sock.
def rawq_getchar | ( | self) |
Get next char from raw queue. Block if no data is immediately available. Raise EOFError when connection is closed.
Definition at line 429 of file telnetlib.py.
References Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, Telnet.fill_rawq(), Telnet.irawq, and Telnet.rawq.
def read_all | ( | self) |
Read all data until EOF; block until connection closed.
Definition at line 306 of file telnetlib.py.
References Telnet.cookedq, Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, Telnet.fill_rawq(), and Telnet.process_rawq().
def read_eager | ( | self) |
Read readily available data. Raise EOFError if connection closed and no cooked data available. Return '' if no cooked data available otherwise. Don't block unless in the midst of an IAC sequence.
Definition at line 345 of file telnetlib.py.
References Telnet.cookedq, Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, Telnet.fill_rawq(), Telnet.process_rawq(), Telnet.read_very_lazy(), and Telnet.sock_avail().
def read_lazy | ( | self) |
Process and return data that's already in the queues (lazy). Raise EOFError if connection closed and no data available. Return '' if no cooked data available otherwise. Don't block unless in the midst of an IAC sequence.
Definition at line 359 of file telnetlib.py.
References Telnet.process_rawq(), and Telnet.read_very_lazy().
def read_some | ( | self) |
Read at least one byte of cooked data unless EOF is hit. Return '' if EOF is hit. Block if no data is immediately available.
Definition at line 316 of file telnetlib.py.
References Telnet.cookedq, Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, Telnet.fill_rawq(), and Telnet.process_rawq().
def read_until | ( | self, | |
match, | |||
timeout = None |
|||
) |
Read until a given string is encountered or until timeout. When no match is found, return whatever is available instead, possibly the empty string. Raise EOFError if the connection is closed and no cooked data is available.
Definition at line 274 of file telnetlib.py.
References Telnet.cookedq, Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, Telnet.fill_rawq(), sre_parse.max, Telnet.process_rawq(), and Telnet.read_very_lazy().
def read_very_eager | ( | self) |
Read everything that's possible without blocking in I/O (eager). Raise EOFError if connection closed and no cooked data available. Return '' if no cooked data available otherwise. Don't block unless in the midst of an IAC sequence.
Definition at line 331 of file telnetlib.py.
References Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, Telnet.fill_rawq(), Telnet.process_rawq(), Telnet.read_very_lazy(), and Telnet.sock_avail().
def read_very_lazy | ( | self) |
Return any data available in the cooked queue (very lazy). Raise EOFError if connection closed and no data available. Return '' if no cooked data available otherwise. Don't block.
Definition at line 370 of file telnetlib.py.
References Telnet.cookedq, Telnet.eof, _Hqxdecoderengine.eof, _Rledecoderengine.eof, and Telnet.rawq.
def set_debuglevel | ( | self, | |
debuglevel | |||
) |
Set the debug level. The higher it is, the more debug output you get (on sys.stdout).
Definition at line 239 of file telnetlib.py.
References HTTPResponse.debuglevel, Telnet.debuglevel, SMTP.debuglevel, HTTPConnection.debuglevel, and HTTP.debuglevel.
def set_option_negotiation_callback | ( | self, | |
callback | |||
) |
Provide a callback function called after each receipt of a telnet option.
Definition at line 383 of file telnetlib.py.
References Telnet.option_callback.
def sock_avail | ( | self) |
def write | ( | self, | |
buffer | |||
) |
Write a string to the socket, doubling any IAC characters. Can block if the connection is blocked. May raise socket.error if the connection is closed.
Definition at line 262 of file telnetlib.py.
References NetrcParseError.msg, GetoptError.msg, Error.msg, HTTPResponse.msg, HTTPError.msg, and Telnet.msg().
cookedq |
Definition at line 186 of file telnetlib.py.
debuglevel |
Definition at line 180 of file telnetlib.py.
eof |
Definition at line 187 of file telnetlib.py.
host |
Definition at line 181 of file telnetlib.py.
irawq |
Definition at line 185 of file telnetlib.py.
option_callback |
Definition at line 188 of file telnetlib.py.
port |
Definition at line 182 of file telnetlib.py.
rawq |
Definition at line 184 of file telnetlib.py.
sock |
Definition at line 183 of file telnetlib.py.