mysql

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0, ISC Imports: 4 Imported by: 3

Documentation

Overview

Package mysql provides the mysql implementation of the zgrab2.Module. Grabs the HandshakePacket (or ERRPacket) that the server sends immediately upon connecting, and then if applicable negotiate an SSL connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterModule

func RegisterModule()

RegisterModule is called by modules/mysql.go to register the scanner.

Types

type Flags

type Flags struct {
	zgrab2.BaseFlags
	zgrab2.TLSFlags
	Verbose bool `long:"verbose" description:"More verbose logging, include debug fields in the scan results"`
}

Flags give the command-line flags for the MySQL module.

func (*Flags) Help

func (f *Flags) Help() string

Help returns the module's help string.

func (*Flags) Validate

func (f *Flags) Validate(args []string) error

Validate validates the flags and returns nil on success.

type Module

type Module struct {
}

Module is the implementation of the zgrab2.Module interface.

func (*Module) Description added in v0.1.3

func (m *Module) Description() string

Description returns an overview of this module.

func (*Module) NewFlags

func (m *Module) NewFlags() interface{}

NewFlags returns a new default flags object.

func (*Module) NewScanner

func (m *Module) NewScanner() zgrab2.Scanner

NewScanner returns a new Scanner object.

type ScanResults

type ScanResults struct {
	// ProtocolVersion is the 8-bit unsigned integer representing the
	// server's protocol version sent in the initial HandshakePacket from
	// the server.
	// This has been 10 for all MySQL versionssince 3.2.2 (from 1998).
	ProtocolVersion byte `json:"protocol_version"`

	// ServerVersion is a null-terminated string giving the specific
	// server version in the initial HandshakePacket. Often of the format
	// x.y.z, but not always.
	ServerVersion string `json:"server_version,omitempty"`

	// ConnectionID is the server's internal identifier for this client's
	// connection, sent in the initial HandshakePacket.
	ConnectionID uint32 `json:"connection_id,omitempty" zgrab:"debug"`

	// AuthPluginData is optional plugin-specific data, whose meaning
	// depends on the value of AuthPluginName. Returned in the initial
	// HandshakePacket.
	AuthPluginData []byte `json:"auth_plugin_data,omitempty" zgrab:"debug"`

	// CharacterSet is the identifier for the character set the server is
	// using. Returned in the initial HandshakePacket.
	CharacterSet byte `json:"character_set,omitempty" zgrab:"debug"`

	// StatusFlags is the set of status flags the server returned in the
	// initial HandshakePacket. Each true entry in the map corresponds to
	// a bit set to 1 in the flags, where the keys correspond to the
	// #defines in the MySQL docs.
	StatusFlags map[string]bool `json:"status_flags,omitempty"`

	// CapabilityFlags is the set of capability flags the server returned
	// initial HandshakePacket. Each true entry in the map corresponds to
	// a bit set to 1 in the flags, where the keys correspond to the
	// #defines in the MySQL docs.
	CapabilityFlags map[string]bool `json:"capability_flags,omitempty"`

	// AuthPluginName is the name of the authentication plugin, returned
	// in the initial HandshakePacket.
	AuthPluginName string `json:"auth_plugin_name,omitempty" zgrab:"debug"`

	// ErrorCode is only set if there is an error returned by the server,
	// for example if the scanner is not on the allowed hosts list.
	ErrorCode *int `json:"error_code,omitempty"`

	// ErrorID is the friendly name of the error code, if recognized.
	ErrorID string `json:"error_id,omitempty"`

	// ErrorMessage is an optional string describing the error. Only set
	// if there is an error.
	ErrorMessage string `json:"error_message,omitempty"`

	// RawPackets contains the base64 encoding of all packets sent and
	// received during the scan.
	RawPackets []string `json:"raw_packets,omitempty" zgrab:"debug"`

	// TLSLog contains the usual shared TLS logs.
	TLSLog *zgrab2.TLSLog `json:"tls,omitempty"`
}

ScanResults contains detailed information about the scan.

type Scanner

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

Scanner is the implementation of the zgrab2.Scanner interface.

func (*Scanner) GetName

func (s *Scanner) GetName() string

GetName returns the name from the command line flags.

func (*Scanner) GetTrigger

func (scanner *Scanner) GetTrigger() string

GetTrigger returns the Trigger defined in the Flags.

func (*Scanner) Init

func (s *Scanner) Init(flags zgrab2.ScanFlags) error

Init initializes the Scanner with the command-line flags.

func (*Scanner) InitPerSender

func (s *Scanner) InitPerSender(senderID int) error

InitPerSender does nothing in this module.

func (*Scanner) Protocol

func (s *Scanner) Protocol() string

Protocol returns the protocol identifer for the scanner.

func (*Scanner) Scan

func (s *Scanner) Scan(t zgrab2.ScanTarget) (status zgrab2.ScanStatus, result interface{}, thrown error)

Scan probles the target for a MySQL server.

  1. Connects and waits to receive the handshake packet.
  2. If the server supports SSL, send an SSLRequest packet, then perform the standard TLS actions.
  3. Process and return the results.

Jump to

Keyboard shortcuts

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