Modules

Using modules

Modules are higher-level features provided by BOF. They can rely on one or more layer, depending on what they do. Basically, each module is a collection of functions to call in a script.

List of modules:

  • Discovery: Functions to gather initial information on industrial devices on a network, using targeted techniques. Rely on several protocols.

Discovery

Module: Discovery

Functions for targeted and multicast discovery of industrial devices on a network.

bof.modules.discovery.knx_discovery(ip: str = '224.0.23.12', port=3671, **kwargs)

Search for KNX devices on an network using multicast.

Implementation in KNX layer.

bof.modules.discovery.lldp_discovery(iface: str = 'eth0', timeout: int = 30) → list

Search for devices on an network by listening to LLDP requests.

Converts back asynchronous to synchronous with sleep (silly I know). If you want to keep asynchrone, call directly start_listening and stop_listening in your code.

Implementation in LLDP layer.

bof.modules.discovery.modbus_discovery(ip_range: object, port: int = 502) → list

Retrieve informations from one or more Modbus devices.

Sends several Modbus request to gather device identification details and coils and registers values.

Parameters:
  • ip_range – Can be a single IP, or an IP range with format X.X.X.X/Y
  • port – Modbus port to connect to (default: 502).
Raises:

BOFProgrammingError – if ip_range is invalid.

Warning: This method tries to establish a TCP connection to every device, so it is better to first make sure that the devices you are trying to contact are actual Modbus devices.

bof.modules.discovery.multicast_discovery(iface: str = 'eth0', pndcp_multicast: str = '01:0e:cf:00:00:00', knx_multicast: str = '224.0.23.12', verbose: bool = False)

Discover devices on a network using dedicated multicast addresses.

Currently, LLDP and KNX are supported.

Parameters:
  • lldp_multicast – Multicast MAC address for LLDP requests.
  • knx_multicast – Multicast IP address for KNXnet/IP requests.
bof.modules.discovery.profinet_discovery(iface: str = 'eth0', mac_addr: str = '01:0e:cf:00:00:00') → list

Search for devices on an network using multicast Profinet DCP requests.

Implementation in Profinet layer.