dnp3

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0, ISC Imports: 6 Imported by: 0

Documentation

Overview

Package dnp3 provides a zgrab2 module that scans for dnp3. Default port: 20000 (TCP)

Copied unmodified from the original zgrab. Connects, and reads the banner. Returns the raw response.

Index

Constants

View Source
const (
	LINK_MIN_HEADER_LENGTH        = 10     // minimum link header length in bytes
	LINK_START_FIELD              = 0x0564 // Pre-set 2-byte start field
	LINK_DIR_BIT                  = 1      // Direction bit
	LINK_PRM_BIT                  = 1      // Primary message bit
	LINK_FCB_BIT                  = 0      // Frame count bit
	LINK_FCV_BIT                  = 0      // Frame count valid bit
	LINK_BROADCAST_ADDRESS        = 0x0001 // Broadcast address w/o mandatory application response
	LINK_UNCONFIRMED_USER_DATA_FC = 0x4    // don't require link layer response function code
	LINK_REQUEST_STATUS_FC        = 0x9    // 4-bit function code for requesting link status
	LINK_STATUS_FC                = 0xB    // 4-bit response function code for link status
	FUNCTION_CODE_NOT_SUPPORTED   = 0xF    // Unsupported function code response
	TRANSPORT_START_SEQUENCE      = 0x00   // starting sequence number for transport packet
	APP_START_SEQUENCE            = 0x00   // starting sequence number for application packet
	APP_CON_BIT                   = 0      // no app acknowledgement
	APP_UNS_BIT                   = 0      // not an unsolicited response
	APP_FUNC_CODE_READ            = 0x01   // 1-byte function code for reading
	APP_GROUP_0                   = 0x00   // group 0 refers to all static data
	APP_GROUP_0_QUALIFIER         = 0x00   // objects are packed without index prefix
	APP_GROUP_0_RANGE             = 0x0000 // no range due to no qualifier
	APP_GROUP_0_SOFTWARE_VERSION  = 0xF2   // group 0 attribute - device manufacturer's software version
	APP_GROUP_0_HARDWARE_VERSION  = 0xF3   // group 0 attribute - device manufacturer's hardware version
	APP_GROUP_0_LOCATION          = 0xF5   // group 0 attribute - device location
	APP_GROUP_0_DEVICE_ID         = 0xF6   // group 0 attribute - device application id
	APP_GROUP_0_DEVICE_NAME       = 0xF7   // group 0 attribute - device name
	APP_GROUP_0_SERIAL_NUMBER     = 0xF8   // group 0 attribute - device manufacturer's serial number
	APP_GROUP_0_DNP3_SUBSET       = 0xF9   // subset of the dnp3 protocol that is implemented
	APP_GROUP_0_PRODUCT_NAME      = 0xFA   // group 0 attribute - device manufacturer's product name and model
	APP_GROUP_0_ALL_ATTRIBUTES    = 0xFE   // get all available group 0 attributes in single response
	APP_GROUP_0_LIST_ATTRIBUTES   = 0xFF   // list available group 0 attributes
)

DNP3 Flags

Variables

This section is empty.

Functions

func Crc16

func Crc16(bs []byte) (crc uint16)

func GetDNP3Banner

func GetDNP3Banner(logStruct *DNP3Log, connection net.Conn) (err error)

func RegisterModule

func RegisterModule()

RegisterModule registers the zgrab2 module.

Types

type DNP3Log

type DNP3Log struct {
	IsDNP3      bool   `json:"is_dnp3"`
	RawResponse []byte `json:"raw_response,omitempty"`
}

type Flags

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

Flags holds the command-line configuration for the dnp3 scan module. Populated by the framework.

func (*Flags) Help

func (flags *Flags) Help() string

Help returns the module's help string.

func (*Flags) Validate

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

Validate checks that the flags are valid. On success, returns nil. On failure, returns an error instance describing the error.

type Module

type Module struct {
}

Module implements the zgrab2.Module interface.

func (*Module) Description

func (module *Module) Description() string

Description returns an overview of this module.

func (*Module) NewFlags

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

NewFlags returns a default Flags object.

func (*Module) NewScanner

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

NewScanner returns a new Scanner instance.

type Scanner

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

Scanner implements the zgrab2.Scanner interface.

func (*Scanner) GetName

func (scanner *Scanner) GetName() string

GetName returns the Scanner name defined in the Flags.

func (*Scanner) GetTrigger

func (scanner *Scanner) GetTrigger() string

GetTrigger returns the Trigger defined in the Flags.

func (*Scanner) Init

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

Init initializes the Scanner.

func (*Scanner) InitPerSender

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

InitPerSender initializes the scanner for a given sender.

func (*Scanner) Protocol

func (scanner *Scanner) Protocol() string

Protocol returns the protocol identifier of the scan.

func (*Scanner) Scan

func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, interface{}, error)

Scan probes for a DNP3 service. Connects to the configured TCP port (default 20000) and reads the banner.

Jump to

Keyboard shortcuts

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