mqtt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0, ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterModule

func RegisterModule()

RegisterModule registers the MQTT zgrab2 module.

Types

type Connection

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

Connection holds the state for a single connection to the MQTT server.

func (*Connection) ReadMQTTv3Packet

func (mqtt *Connection) ReadMQTTv3Packet() error

ReadMQTTv3Packet reads and parses the CONNACK packet from the server.

func (*Connection) ReadMQTTv5Packet

func (mqtt *Connection) ReadMQTTv5Packet() error

ReadMQTTv5Packet reads and parses the CONNACK or DISCONNECT packet from the server for MQTT v5.0.

func (*Connection) SendMQTTConnectPacket

func (mqtt *Connection) SendMQTTConnectPacket(v5 bool) error

SendMQTTConnectPacket constructs and sends an MQTT CONNECT packet to the server.

type Flags

type Flags struct {
	zgrab2.BaseFlags
	zgrab2.TLSFlags

	Verbose bool `long:"verbose" description:"More verbose logging, include debug fields in the scan results"`
	V5      bool `long:"v5" description:"Scanning MQTT v5.0. Otherwise scanning MQTT v3.1.1"`
	UseTLS  bool `long:"tls" description:"Use TLS for the MQTT connection"`
}

Flags are the MQTT-specific command-line flags.

func (*Flags) Help

func (f *Flags) Help() string

Help returns this module's help string.

func (*Flags) Validate

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

Validate flags

type Module

type Module struct {
}

Module implements the zgrab2.Module interface.

func (*Module) Description

func (m *Module) Description() string

Description returns an overview of this module.

func (*Module) NewFlags

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

NewFlags returns the default flags object to be filled in with the command-line arguments.

func (*Module) NewScanner

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

NewScanner returns a new Scanner instance.

type ScanResults

type ScanResults struct {
	SessionPresent    bool           `json:"session_present,omitempty"`
	ConnectReturnCode byte           `json:"connect_return_code,omitempty"`
	Response          string         `json:"response,omitempty"`
	TLSLog            *zgrab2.TLSLog `json:"tls,omitempty"`
}

ScanResults is the output of the scan.

type Scanner

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

Scanner implements the zgrab2.Scanner interface, and holds the state for a single scan.

func (*Scanner) GetDialerGroupConfig

func (scanner *Scanner) GetDialerGroupConfig() *zgrab2.DialerGroupConfig

func (*Scanner) GetName

func (s *Scanner) GetName() string

GetName returns the configured name for the Scanner.

func (*Scanner) GetTrigger

func (s *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 instance with the flags from the command line.

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 identifier for the scanner.

func (*Scanner) Scan

func (s *Scanner) Scan(ctx context.Context, dialGroup *zgrab2.DialerGroup, t *zgrab2.ScanTarget) (status zgrab2.ScanStatus, result any, thrown error)

Scan performs the configured scan on the MQTT server.

Jump to

Keyboard shortcuts

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