Documentation ¶
Overview ¶
Package telnet provides a zgrab2 module that scans for telnet daemons. Default Port: 23 (TCP)
The --max-read-size flag allows setting a ceiling to the number of bytes that will be read for the banner.
The scan negotiates the options and attempts to grab the banner, using the same behavior as the original zgrab.
The output contains the banner and the negotiated options, in the same format as the original zgrab.
Index ¶
- Constants
- func GetTelnetBanner(logStruct *TelnetLog, conn net.Conn, maxReadSize int) (err error)
- func NegotiateOptions(logStruct *TelnetLog, conn net.Conn) error
- func RegisterModule()
- type Flags
- type Module
- type Scanner
- func (scanner *Scanner) GetName() string
- func (scanner *Scanner) GetPort() uint
- func (scanner *Scanner) GetTrigger() string
- func (scanner *Scanner) Init(flags zgrab2.ScanFlags) error
- func (scanner *Scanner) InitPerSender(senderID int) error
- func (scanner *Scanner) Protocol() string
- func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, interface{}, error)
- type TelnetLog
- type TelnetOption
Constants ¶
const ( // IAC means INTERPRET AS COMMAND. IAC = byte(0xff) // DONT means don't use these options. DONT = byte(0xfe) // DO means do use these options. DO = byte(0xfd) // WONT means these options won't be used. WONT = byte(0xfc) // WILL means these options will be used. WILL = byte(0xfb) // GO_AHEAD is the special go ahead command. GO_AHEAD = byte(0xf9) // IAC_CMD_LENGTH gives the length of the special IAC command (inclusive). IAC_CMD_LENGTH = 3 // READ_BUFFER_LENGTH is the size of the read buffer. READ_BUFFER_LENGTH = 8209 )
Variables ¶
This section is empty.
Functions ¶
func GetTelnetBanner ¶
GetTelnetBanner attempts to negotiate the options and fetch the telnet banner over the given connection, reading at most maxReadSize bytes.
func NegotiateOptions ¶
NegotiateOptions attempts to negotiate the connection options over the given connection.
Types ¶
type Flags ¶
type Flags struct { zgrab2.BaseFlags MaxReadSize int `long:"max-read-size" description:"Set the maximum number of bytes to read when grabbing the banner" default:"65536"` Verbose bool `long:"verbose" description:"More verbose logging, include debug fields in the scan results"` }
Flags holds the command-line configuration for the Telnet scan module. Populated by the framework.
type Module ¶
type Module struct { }
Module implements the zgrab2.Module interface.
func (*Module) NewFlags ¶
func (module *Module) NewFlags() interface{}
NewFlags returns a default Flags object.
func (*Module) NewScanner ¶
NewScanner returns a new Scanner instance.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner implements the zgrab2.Scanner interface.
func (*Scanner) GetTrigger ¶
GetTrigger returns the Trigger defined in the Flags.
func (*Scanner) InitPerSender ¶
InitPerSender initializes the scanner for a given sender.
func (*Scanner) Scan ¶
func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, interface{}, error)
Scan connects to the target (default port TCP 23) and attempts to grab the Telnet banner.
type TelnetLog ¶
type TelnetLog struct { // Banner is the telnet banner returned by the server. Banner string `json:"banner,omitempty"` // Will is the list of options that the server says that it will use. Will []TelnetOption `json:"will,omitempty"` // Do is the list of options that the server requests that the client use. Do []TelnetOption `json:"do,omitempty"` // Wont is the list of options that the server says it will *not* use. Wont []TelnetOption `json:"wont,omitempty"` // Dont is the list of options that the server requests the client *not* use. Dont []TelnetOption `json:"dont,omitempty"` }
TelnetLog is the output of the telnet grab.
type TelnetOption ¶
type TelnetOption uint16
TelnetOption provides mappings of telnet option enum values to/from their friendly names.
func (*TelnetOption) MarshalJSON ¶
func (opt *TelnetOption) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON-encoded friendly name of the telnet option.
func (*TelnetOption) Name ¶
func (opt *TelnetOption) Name() string
Name gets the friendly name of the TelnetOption (or "unknown" if it is not recognized).
func (*TelnetOption) UnmarshalJSON ¶
func (opt *TelnetOption) UnmarshalJSON(b []byte) error
UnmarshalJSON returns the TelnetOption enum value from its JSON-encoded friendly name.