modbus

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ModbusHeaderLength      = 7
	ModbusDiscreteInputCode = 0x2
	ModbusErrorAddend       = 0x80
)
View Source
const MODBUS = "modbus"

Variables

This section is empty.

Functions

This section is empty.

Types

type MODBUSPlugin

type MODBUSPlugin struct{}

func (*MODBUSPlugin) Name

func (p *MODBUSPlugin) Name() string

func (*MODBUSPlugin) PortPriority

func (p *MODBUSPlugin) PortPriority(port uint16) bool

func (*MODBUSPlugin) Priority

func (p *MODBUSPlugin) Priority() int

func (*MODBUSPlugin) Run

func (p *MODBUSPlugin) Run(conn net.Conn, timeout time.Duration, target plugins.Target) (*plugins.Service, error)

Run

modbus is a communications standard for connecting industrial devices.
modbus can be carried over a number of frame formats; this program identifies
modbus over TCP.

modbus supports diagnostic functions that could be used for fingerprinting,
however, not all implementations will support the use of these functions.
Therefore, this program utilizes a read primitive and validates both the success
response and the error response conditions.

modbus supports reading and writing to specified memory addresses using a number
of different primitives. This program utilizes the "Read Discrete Input" primitive,
which requests the value of a read-only boolean. This is the least likely primitive to
be disruptive.

Additionally, all modbus messages begin with a 7-byte header. The first two bytes are a
client-controlled transaction ID. This program generates a random transaction ID and validates
that the server echos the correct response.

Initial testing done with `docker run -it -p 502:5020 oitc/modbus-server:latest`
The default TCP port is 502, but this is unofficial.

func (*MODBUSPlugin) Type

func (p *MODBUSPlugin) Type() plugins.Protocol

Jump to

Keyboard shortcuts

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