Modbus probe
The Modbus probe opens a Modbus/TCP connection to a device and runs one or several operations on it in order, recording each one with its request and the bytes that came back. VirtuProbe speaks Modbus directly, written against the MODBUS Application Protocol Specification and the Messaging on TCP/IP Implementation Guide rather than wrapped around a third-party library, so you can put an illegal quantity or a deliberately malformed frame on the wire and see what the device did with it.
A probe is a host, a port, a unit id and an ordered list of operations. One send opens the connection, runs the operations on it in order and closes it. Modbus is strict request and response, one transaction at a time, so each operation is sent and its single reply read before the next begins.

Connection
Section titled “Connection”| Field | Description |
|---|---|
| Host | The address of the device (default: localhost) |
| Port | The TCP port (default: 502) |
| Unit id | The Modbus unit (slave) id used by any operation that does not set its own (default: 1) |
Modbus/TCP as this probe speaks it carries no transport authentication and no encryption, so there is no credential or TLS field. A per-operation Unit id overrides the probe’s for one operation, which is how you address several devices behind one gateway in a single probe.
Operations
Section titled “Operations”Each operation is a function and the arguments that function needs. Add operations with Add
operation, reorder or remove them, switch any one off with its checkbox so it stays in the probe
without being sent. An operation may carry a Label, which names it in the response and the
history and is how an extractor or a later chain step addresses it. Without a label it is named by a
generated summary, for example READ_HOLDING_REGISTERS @0 x10.
| Function | Reads | Fields |
|---|---|---|
| READ_COILS | Coils (bits) | Address, Quantity |
| READ_DISCRETE_INPUTS | Discrete inputs (bits) | Address, Quantity |
| READ_HOLDING_REGISTERS | Holding registers (16-bit words) | Address, Quantity |
| READ_INPUT_REGISTERS | Input registers (16-bit words) | Address, Quantity |
| READ_FIFO_QUEUE | A FIFO queue | Address |
Writes
Section titled “Writes”| Function | Writes | Fields |
|---|---|---|
| WRITE_SINGLE_COIL | One coil | Address, Value (zero is off, non-zero is on) |
| WRITE_SINGLE_REGISTER | One register | Address, Value |
| WRITE_MULTIPLE_COILS | A block of coils | Address, Coils (a comma list of 1/0) |
| WRITE_MULTIPLE_REGISTERS | A block of registers | Address, Values (a comma list of numbers) |
| MASK_WRITE_REGISTER | One register, through an AND and an OR mask | Address, And mask, Or mask |
| READ_WRITE_MULTIPLE_REGISTERS | Writes a block, then reads a block, in one transaction | Read address, Read quantity, Write address, Values |
Diagnostics and status
Section titled “Diagnostics and status”The specification classifies these five as serial line usage. They are sendable over Modbus/TCP all the same, because many gateways and PLCs do answer them (Report server id is a common fingerprint), and how a target reacts to one it was not expected to receive is itself the finding.
| Function | Asks for | Fields |
|---|---|---|
| READ_EXCEPTION_STATUS | The device’s exception status byte | none |
| DIAGNOSTICS | A diagnostic sub-function | Sub function, Data (hex) |
| GET_COMM_EVENT_COUNTER | The communication event counter | none |
| GET_COMM_EVENT_LOG | The communication event log | none |
| REPORT_SERVER_ID | The device’s own id and run state | none |
File, record and device identification
Section titled “File, record and device identification”| Function | Does | Fields |
|---|---|---|
| READ_FILE_RECORD | Reads a record from a file | File number, Record number, Record length |
| WRITE_FILE_RECORD | Writes a record to a file | File number, Record number, Values |
| ENCAPSULATED_INTERFACE_TRANSPORT | Device identification (MEI type 14), or any encapsulated interface payload | MEI type, Read device id code, Object id, Data (hex) |
Encapsulated interface transport with no MEI type, or with MEI type 14 and a Read device id code, sends a Read device identification request. Any other MEI type carries the Data (hex) payload as raw bytes. The payload inside the envelope (a CANopen request, for example) is a separate protocol and is returned raw.
SunSpec scan
Section titled “SunSpec scan”| Function | Does | Fields |
|---|---|---|
| SUNSPEC_SCAN | Walks the SunSpec model chain and decodes the models the bundled catalog knows | Base address (default: 40000) |
A SunSpec scan confirms the SunS marker at the base address, walks the chain of model blocks to its
end marker. For every model the catalog knows it renders the named engineering values beside the raw
registers. A scale factor in a model is applied, so a scaled integer reads as its real value. The
catalog is a bundled data file; a model it does not know still appears as its id and length.
| Function | Does | Fields |
|---|---|---|
| RAW | Sends an arbitrary function code and data bytes with no argument validation | Function code, Data (hex) |
Raw is the fuzzing and MITM escape hatch: it puts whatever bytes you give it on the wire, including a function code the specification does not define. A raw send counts as changing the target unless its code is a known read, because a frame of unknown effect is treated as a write so the write-safety gate still applies.
A hex field accepts spaces, commas and 0x prefixes, so 11 03 00, 110300 and 0x11,0x03,0x00
are the same three bytes.
Writes are held back
Section titled “Writes are held back”Modbus devices run plant, so a write is sent only when three conditions hold: writes are enabled for the workspace in Settings > Advanced, the probe is armed for writes with the Write arm switch above the operation list and, on an interactive send from the editor, you confirm it. A chain, headless or MCP send has nobody to confirm, so the two gates decide and a write with either unmet fails cleanly. A blocked operation is a visible, failed exchange that was never sent, not an error on the probe. Reads never need arming.
The write functions and a raw send change the target; the reads, the diagnostics and the SunSpec scan do not. An operation that changes the target carries a modifies target chip in the editor, drawn from the same catalogue the write-safety gate reads, so the chip cannot say one thing while the gate does another.
Response
Section titled “Response”The response lists every operation as a row with a pass or fail marker, its command summary, its
duration and a chip for anything notable (an exception, a blocked write with its reason, or a
mocked reply). A chip at the top names the transport outcome when it is not OK. A transport
error shows above the list.

A row expands to the reply. A register read shows registers=[...], a bit read shows coils=[...],
and everything else shows the response PDU as hex. When an operation carried a typed decode, the
decoded value is shown beside the registers. The raw response PDU is shown as hex under the reply.
A completed transaction is OK even when the device answered with a Modbus exception: the bytes
arrived, so the transport succeeded and only the protocol disagreed. An exception response shows its
code, one of ILLEGAL_FUNCTION, ILLEGAL_DATA_ADDRESS, ILLEGAL_DATA_VALUE, SERVER_DEVICE_FAILURE,
ACKNOWLEDGE, SERVER_DEVICE_BUSY, MEMORY_PARITY_ERROR, GATEWAY_PATH_UNAVAILABLE or
GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND.
When the transport itself did not complete, the outcome names how it ended: CONNECT_REFUSED
(nothing listening), CONNECT_TIMEOUT, READ_TIMEOUT, CONNECTION_RESET, EOF (the peer closed
early), MALFORMED_FRAME (bytes arrived that were not a Modbus frame) or RESOLVE_FAILED. For a
port probe the difference between nothing listening and answered then reset is often the whole
finding, which is why the outcome is named rather than collapsed into one error. A transport failure
part way through a probe ends the remaining operations, because nothing further can reach the device.
A write that the gate refused reports BLOCKED. The probe as a whole passes when every operation
ran, none came back as a Modbus exception and none was blocked.
Extractors
Section titled “Extractors”The per-exchange extractors take a command prefix, matched case-insensitively against an operation’s
summary or its label, so an operation you labelled setpoint is addressed as setpoint. A blank
expression means the last operation, since a probe’s verdict is usually whatever it finished by
asking.
| Extractor | Returns |
|---|---|
MODBUS_SUCCESS | true when the probe as a whole passed, otherwise false. Ignores the expression |
MODBUS_TRANSPORT_OUTCOME | The transport outcome of the probe as a whole (OK, CONNECT_REFUSED, READ_TIMEOUT, …). Ignores the expression |
MODBUS_REGISTERS | The registers a read returned, comma-separated, or blank when the operation was not a register read |
MODBUS_COILS | The coil or discrete-input bits a read returned, comma-separated as 1/0, or blank when the operation was not a bit read |
MODBUS_EXCEPTION_CODE | The Modbus exception code of one operation, or blank when the device did not answer with an exception |
MODBUS_DECODED | The typed-decoded value of a register read that carried a decode, or blank when it had none |
MODBUS_REPLY | The reply of one operation, as it reads in the response |
MODBUS_RAW_PDU | The raw response PDU as hex (function code plus data), the lossless handle for a raw or fuzz operation whose reply has no register shape |
Chains
Section titled “Chains”Modbus is a chain step. {{variable}} placeholders resolve into the host and the text fields of an
operation, its label and its hex data, before the probe is sent. The numeric addressing fields (the
address, the quantity, a register value) are literal in a chain step and do not take a placeholder.
A chain step is an automated send, so a write needs writes enabled for the workspace and the probe
armed; there is nobody to confirm. With either unmet the step fails and nothing is sent, with
MODBUS_TRANSPORT_OUTCOME set to BLOCKED. One pattern is to write a register, read it back in the
next operation and assert on MODBUS_REGISTERS. Another is HTTP then Modbus: change a setpoint
through the system’s own API, then read the register it is supposed to drive.
The proxy and mock rules
Section titled “The proxy and mock rules”Through the proxy, Modbus/TCP is recognised by its MBAP header, which the client sends first. The capture decodes each message: the unit id, the function, the address and quantity of a read request, the registers or coils of a read reply, an exception, or the raw PDU for anything else.
A mock rule matches on host, unit (the unit id) and function (by name such as
READ_HOLDING_REGISTERS, or by code such as 3 or 0x03); a blank field matches anything. Its one
action is MOCK, which answers the request in place of the device with one of:
- values, the coil bits or register values a read is answered with (sized to the quantity the request asked for, zeros where the list runs short),
- responseBytes, a raw PDU payload as hex, for a data-carrying function with no register shape such as report server id or device identification,
- exception, an exception code by name or number, which fault-injects any function.
A matched MOCK never reaches the device. When the rule names nothing the function can be answered with, the request is dropped rather than relayed, which shows as a matched-but-blocked exchange. A write with no explicit payload is answered with the acknowledgement the device would have sent. The proxy can also draft a mock from a captured session, pre-filled with what the device really answered, as a starting point to change.
VirtuProbe’s own probe, chain and script sends honour a mock rule marked to apply to outgoing traffic: a matched operation is answered from the rule and never sent, showing a mocked chip in the response.
A local server to test against
Section titled “A local server to test against”virtuprobe-docker/modbus-simple is one Modbus/TCP server on port 502, unit id 1 (it answers any
unit id), with a seeded data model and a SunSpec map. Writes are accepted, so a write followed by a
read confirms it landed.
cd virtuprobe-docker/modbus-simple && docker compose up --build -d| Table | Function codes | Seed |
|---|---|---|
| Holding registers | read with FC03, write with FC06 / 16 / 22 / 23 | address 0 to 9 hold 100, 200, … 1000 |
| Input registers | read with FC04 | address 0 to 9 hold 11, 22, … 110 |
| Coils | read with FC01, write with FC05 / 15 | address 0 to 15 alternate off, on |
| Discrete inputs | read with FC02 | address 0 to 15 alternate on, off |
A read past the end of a block comes back as ILLEGAL_DATA_ADDRESS, a Modbus exception rather than a
transport error, so the probe sees the device answer and refuse. A SunSpec model chain sits at base
40000: the SunS marker, a Common model with identity strings (Mn=VirtuProbe, Md=modbus-simple,
Vr=0.0.1, SN=SN-0001), an inverter model, then the end marker.
Things to try:
- Read:
READ_HOLDING_REGISTERSaddress0quantity10returns100to1000;READ_COILSaddress0quantity16returns the alternating pattern. - Write (writes enabled, probe armed):
WRITE_SINGLE_REGISTERaddress0value4242, thenREAD_HOLDING_REGISTERSaddress0quantity1returns4242. - Exception:
READ_HOLDING_REGISTERSaddress60000quantity1returnsILLEGAL_DATA_ADDRESS. - SunSpec:
SUNSPEC_SCANbase40000returns the Common model identity and the inverter model.
What the probe does not cover
Section titled “What the probe does not cover”- Modbus RTU and ASCII, the serial line framings. This probe speaks Modbus/TCP. The serial line diagnostics codes are still sendable over TCP, because a gateway may answer them.
- Transport security. Modbus/TCP as this probe speaks it has no authentication and no encryption.
- The payload inside an encapsulated interface transport. A CANopen or other inner protocol is carried and returned as raw bytes, not decoded.
Writing a probe file by hand
Section titled “Writing a probe file by hand”A probe file written by hand or over MCP is shaped like this. An absent key takes the default a person would have chosen and never arms writes.
- Operations are the
operationslist, each an object with afunctionand the fields that function needs.{"function": "READ_HOLDING_REGISTERS", "address": 0, "quantity": 10}is a whole read. writeArmedis the per-probe arm. Absent orfalsemeans a write is held back.- A typed decode rides on a register read as a
decodeobject and is read byMODBUS_DECODED. It is not in the editor.typeis one ofINT16,UINT16,INT32,UINT32,INT64,UINT64,FLOAT32,FLOAT64,STRING;offsetis the register offset into the read;wordOrderandbyteOrderareBIG_ENDIAN(the Modbus and SunSpec default) orLITTLE_ENDIAN;scaleFactoris a base-10 exponent applied to an integer type;lengthis the register count for aSTRING.
{ "host": "localhost", "port": 502, "unitId": 1, "writeArmed": false, "operations": [ {"function": "READ_HOLDING_REGISTERS", "address": 40072, "quantity": 2, "label": "power", "decode": {"type": "FLOAT32", "wordOrder": "BIG_ENDIAN"}} ]}