telnet

package
v0.0.0-...-0e0b088 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IAC  nvtCmd = 255 // 0xFF	Interpret as Command
	DONT nvtCmd = 254 // 0xFE	Don't do something
	DO   nvtCmd = 253 // 0xFD	Do something
	WONT nvtCmd = 252 // 0xFC	Won't do something
	WILL nvtCmd = 251 // 0xFB	Will do something
	SB   nvtCmd = 250 // 0xFA	Subnegotiation Begin
	GA   nvtCmd = 249 // 0xF9	Go Ahead
	EL   nvtCmd = 248 // 0xF8	Erase Line
	EC   nvtCmd = 247 // 0xF7	Erase Character
	AYT  nvtCmd = 246 // 0xF6	Are You Here?
	NOP  nvtCmd = 241 // 0xF1	No operation
	SE   nvtCmd = 240 // 0xF0	Subnegotiation End
)
View Source
const (
	O_GMCP   nvtOpt = 201 // 0xC9	Generic MUD Communication Protocol
	O_ZMP    nvtOpt = 93  // 0x5D	Zenith MUD Protocol
	O_MXP    nvtOpt = 91  // 0x5B	MUD eXtension Protocol
	O_MSSP   nvtOpt = 70  // 0x46	MUD Server Status Protocol
	O_NENV   nvtOpt = 39  // 0x27	[RFC1572] New Environment
	O_NAWS   nvtOpt = 31  // 0x1F	[RFC1073] Negotiate About Window Size
	O_TTYPE  nvtOpt = 24  // 0x18	[RFC1091] Terminal Type
	O_ECHO   nvtOpt = 1   // 0x01	[RFC857]  Echo
	O_BINARY nvtOpt = 0   // 0x00	[RFC856]  Binary Transmission
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IACPacket

type IACPacket struct {
	// contains filtered or unexported fields
}

func (*IACPacket) Bytes

func (c *IACPacket) Bytes() []byte

func (*IACPacket) Scan

func (c *IACPacket) Scan(b byte) bool

Scan will put b in packet, return false indicate not need any more byte

func (*IACPacket) String

func (c *IACPacket) String() string

type IACParseStatus

type IACParseStatus int
const (
	WANT_CMD IACParseStatus = iota
	WANT_OPT
	WANT_SUBOPT
	WANT_DATA
	WANT_NOTHING
)

type IACReactor

type IACReactor struct {
	// contains filtered or unexported fields
}

func NewIACReactor

func NewIACReactor(cfg *NVTOptionConfig) *IACReactor

func (*IACReactor) React

func (r *IACReactor) React(m *IACPacket) *IACPacket

type NVT

type NVT struct {
	Option *SessionOption
	// contains filtered or unexported fields
}

Session is a telnet session based on net.Conn

func NewNVT

func NewNVT(ch chan<- []byte, host, port string, opt *SessionOption) *NVT

NewSession will return a new session with host and output message to out

func (*NVT) Close

func (t *NVT) Close()

Close will close session

func (*NVT) IsAlive

func (s *NVT) IsAlive() bool

IsAlive

func (*NVT) RunAfter

func (s *NVT) RunAfter(d time.Duration, f func())

RunAfter wil call f only once when d duration elapsed

func (*NVT) RunEvery

func (s *NVT) RunEvery(d time.Duration, f func())

RunEvery will call f periodly when every d duaration elapsed

func (*NVT) Send

func (s *NVT) Send(data []byte) bool

Send wil send data to session

type NVTCommand

type NVTCommand interface {
	String() string
	Byte() byte
}

type NVTCommandHandler

type NVTCommandHandler func(cfg *NVTOptionConfig, data *IACPacket) *IACPacket

type NVTCommandHandlerMap

type NVTCommandHandlerMap map[NVTCommand]NVTCommandHandler

type NVTOption

type NVTOption interface {
	String() string
	Byte() byte
}

type NVTOptionConfig

type NVTOptionConfig struct {
	// contains filtered or unexported fields
}

func NewNVTOptionConfig

func NewNVTOptionConfig() *NVTOptionConfig

func (*NVTOptionConfig) Get

func (c *NVTOptionConfig) Get(o NVTOption) bool

func (*NVTOptionConfig) GetRemote

func (c *NVTOptionConfig) GetRemote(o NVTOption) bool

func (*NVTOptionConfig) Set

func (c *NVTOptionConfig) Set(o NVTOption, v bool)

type ScheduleTask

type ScheduleTask struct {
	// contains filtered or unexported fields
}

type SessionOption

type SessionOption struct {
	DebugColor     bool
	DebugAnsiColor bool
	DebugIAC       bool
	GAVisible      bool
	NVTOptionCfg   *NVTOptionConfig
}

SessionOption contains some options of session

type TaskHandler

type TaskHandler func()

type TaskType

type TaskType int
const (
	Timer TaskType = iota
	Ticker
)

type TickTaskMap

type TickTaskMap map[time.Duration][]ScheduleTask

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL