runtimepy.net.tcp.telnet package#

Submodules#

runtimepy.net.tcp.telnet.codes module#

Code enumerations relevant to the telnet (RFC 854) protocol.

class runtimepy.net.tcp.telnet.codes.TelnetCode(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: IntEnum

An enumeration of byte values important to the telnet protocol.

AO = 245#
AYT = 246#
BREAK = 243#
DATA_MARK = 242#
DO = 253#
DONT = 254#
EC = 247#
EL = 248#
GA = 249#
IAC = 255#
IP = 244#
NOP = 241#
SB = 250#
SE = 240#
WILL = 251#
WONT = 252#
static is_option_code(val: int) bool[source]#

Determine if the integer value is an option code.

class runtimepy.net.tcp.telnet.codes.TelnetNvt(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: IntEnum

Telnet data relevant to the NVT printer and keyboard.

BEL = 7#
BS = 8#
CR = 13#
FF = 12#
HT = 9#
LF = 10#
NUL = 0#
VT = 11#
static is_nvt(val: int) bool[source]#

Determine if a byte value is an NVT printer or keyboard code.

to_stream(stream: BinaryIO) bool[source]#

Add text to the provided stream based on this NVT instance. Return whether or not any data was written to the stream.

Module contents#

A module implementing a basic telnet (RFC 854) connection interface.

class runtimepy.net.tcp.telnet.BasicTelnet(transport: Transport, protocol: QueueProtocol)[source]#

Bases: Telnet

A simple telnet implementation.

async handle_nvt(action: TelnetNvt) None[source]#

Handle a signal for the network virtual-terminal.

async process_command(code: TelnetCode) None[source]#

Process a telnet command.

async process_option(code: TelnetCode, option: int, _: BinaryIO) None[source]#

Process a telnet option.

async process_text(data: str) bool[source]#

Process a text frame.

class runtimepy.net.tcp.telnet.Telnet(transport: Transport, protocol: QueueProtocol)[source]#

Bases: TcpConnection

A class implementing a basic telnet interface.

abstract async handle_nvt(action: TelnetNvt) None[source]#

Handle a signal for the network virtual-terminal.

log_alias = 'TELNET'#
async process_binary(data: bytes) bool[source]#

Process a binary frame.

abstract async process_command(code: TelnetCode) None[source]#

Process a telnet command.

abstract async process_option(code: TelnetCode, option: int, stream: BinaryIO) None[source]#

Process a telnet option.

async process_telnet_message(data: bytes) bool[source]#

By default, treat all incoming data bytes as text.

send_command(code: TelnetCode) None[source]#

Send a telnet command.

send_option(option: TelnetCode, code: int) None[source]#

Send a telnet option sequence. if the ‘SB’ is the desired code, the additional data can be sent using the ‘send_binary’ method directly.

class runtimepy.net.tcp.telnet.TelnetCode(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: IntEnum

An enumeration of byte values important to the telnet protocol.

AO = 245#
AYT = 246#
BREAK = 243#
DATA_MARK = 242#
DO = 253#
DONT = 254#
EC = 247#
EL = 248#
GA = 249#
IAC = 255#
IP = 244#
NOP = 241#
SB = 250#
SE = 240#
WILL = 251#
WONT = 252#
static is_option_code(val: int) bool[source]#

Determine if the integer value is an option code.

class runtimepy.net.tcp.telnet.TelnetNvt(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: IntEnum

Telnet data relevant to the NVT printer and keyboard.

BEL = 7#
BS = 8#
CR = 13#
FF = 12#
HT = 9#
LF = 10#
NUL = 0#
VT = 11#
static is_nvt(val: int) bool[source]#

Determine if a byte value is an NVT printer or keyboard code.

to_stream(stream: BinaryIO) bool[source]#

Add text to the provided stream based on this NVT instance. Return whether or not any data was written to the stream.