Documentation ¶
Overview ¶
Package bacnet provides a zgrab2 module that scans for bacnet. Default Port: 47808 / 0xBAC0 (UDP)
Behavior and output copied identically from original zgrab.
Index ¶
- Constants
- func ReadVLC(c net.Conn) (vlc *VLC, npdu *NPDU, apdu *APDU, leftovers []byte, err error, isBACNet bool)
- func RegisterModule()
- func SendVLC(c net.Conn, payload []byte) error
- type APDU
- type Flags
- type Frame
- type Log
- func (log *Log) QueryApplicationSoftwareRevision(c net.Conn) (err error)
- func (log *Log) QueryDescription(c net.Conn) (err error)
- func (log *Log) QueryDeviceID(c net.Conn) (err error)
- func (log *Log) QueryFirmwareRevision(c net.Conn) (err error)
- func (log *Log) QueryLocation(c net.Conn) (err error)
- func (log *Log) QueryModelName(c net.Conn) (err error)
- func (log *Log) QueryObjectName(c net.Conn) (err error)
- func (log *Log) QueryVendorName(c net.Conn) (err error)
- func (log *Log) QueryVendorNumber(c net.Conn) (err error)
- type Module
- type NPDU
- type ObjectID
- type PropertyID
- type ReadProperty
- type ReadPropertyRequest
- type Scanner
- func (scanner *Scanner) GetName() string
- 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 SegmentParameters
- type VLC
Constants ¶
const ( VLC_TYPE_IP byte = 0x81 VLC_FUNCTION_UNICAST_NPDU byte = 0x0a )
VLC Header constants
const ( NPDU_VERSION_ASHRAE_135_1995 byte = 0x01 NPDU_FLAG_EXPECTING_RESPONSE byte = 0x04 )
NPDU header constant
const (
MAX_BACNET_FRAME_LEN = 1476
)
const (
SERVER_CHOICE_READ_PROPERTY byte = 0x0c
)
APDU Server Choice constants
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APDU ¶
type APDU struct { TypeAndFlags byte `json:"type_and_flags"` SegmentSizes SegmentParameters `json:"segment_sizes"` InvokeID byte `json:"invoke_id"` ServerChoice byte `json:"server_choice"` }
type Flags ¶
type Flags struct { zgrab2.BaseFlags zgrab2.UDPFlags Verbose bool `long:"verbose" description:"More verbose logging, include debug fields in the scan results"` }
Flags holds the command-line configuration for the bacnet scan module. Populated by the framework.
type Log ¶
type Log struct { IsBACNet bool `json:"is_bacnet"` InstanceNumber uint32 `json:"instance_number"` VendorID uint16 `json:"vendor_id"` VendorName string `json:"vendor_name,omitempty"` FirmwareRevision string `json:"firmware_revision,omitempty"` ApplicationSoftwareRevision string `json:"application_software_revision,omitempty"` ObjectName string `json:"object_name,omitempty"` ModelName string `json:"model_name,omitempty"` Description string `json:"description,omitempty"` Location string `json:"location,omitempty"` }
func (*Log) QueryApplicationSoftwareRevision ¶
type Module ¶
type Module struct { }
Module implements the zgrab2.Module interface.
func (*Module) Description ¶
Description returns text uses in the help for this module.
func (*Module) NewFlags ¶
func (module *Module) NewFlags() interface{}
NewFlags returns a default Flags object.
func (*Module) NewScanner ¶
NewScanner returns a new Scanner instance.
type PropertyID ¶
type PropertyID byte
const ( PID_OID PropertyID = 75 PID_VENDOR_NUMBER PropertyID = 0x78 PID_VENDOR_NAME PropertyID = 0x79 PID_FIRMWARE_REVISION PropertyID = 0x2c PID_APPLICATION_SOFTWARE_REVISION PropertyID = 0x0c PID_OBJECT_NAME PropertyID = 0x4d PID_MODEL_NAME PropertyID = 0x46 PID_DESCRIPTION PropertyID = 0x1c PID_LOCATION PropertyID = 0x3a )
type ReadProperty ¶
type ReadProperty struct { Object ObjectID `json:"object"` Property PropertyID `json:"property"` }
func (*ReadProperty) Marshal ¶
func (rp *ReadProperty) Marshal() ([]byte, error)
type ReadPropertyRequest ¶
type ReadPropertyRequest struct { NPDU NPDU `json:"npdu"` APDU APDU `json:"apdu"` Selection ReadProperty `json:"read_property"` }
func NewReadPropertyRequest ¶
func NewReadPropertyRequest(oid ObjectID, pid PropertyID) *ReadPropertyRequest
func (*ReadPropertyRequest) Marshal ¶
func (rp *ReadPropertyRequest) Marshal() (out []byte, err error)
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 probes for a BACNet service. Behavior taken from original zgrab. Connects to the configured port over UDP (default 47808/0xBAC0). Attempts to query the following in sequence; if any fails, returning anything that has been detected so far. (Unless QueryDeviceID fails, the service is considered to be detected) 1. Device ID 2. Vendor Number 3. Vendor Name 4. Firmware Revision 5. App software revision 6. Object name 7. Model name 8. Description 9. Location The result is a bacnet.Log, and contains any of the above.
type SegmentParameters ¶
type SegmentParameters struct {
// contains filtered or unexported fields
}