---
title: 'OT/ICS protocol interaction'
url: 'https://www.rawrso.me/ethical-hacking/cheat-sheets/ot-ics-protocol-interaction'
markdown: 'https://www.rawrso.me/ethical-hacking/cheat-sheets/ot-ics-protocol-interaction.md'
date: '2026-11-22'
description: 'Field Detail Summary Read/write Modbus/S7/DNP3 etc. (lab) Category OT/ICS protocol testing Phase enumeration, exploitation Interface CLI + libraries Platform Linux Licence Open source (mixed) Docs https://pymodbus.readthedocs.io/ / https://github.com/mushorg/conpot Related OT-I…'
taxonomy:
  category:
    - cheat-sheets
  tag:
    - pentest
    - cheatsheet
    - ot-ics
    - ot-ics-protocol-testing
    - enumeration
    - exploitation
---

# OT/ICS protocol interaction

| Field | Detail |
|---|---|
| **Summary** | Read/write Modbus/S7/DNP3 etc. (lab) |
| **Category** | OT/ICS protocol testing |
| **Phase** | enumeration, exploitation |
| **Interface** | CLI + libraries |
| **Platform** | Linux |
| **Licence** | Open source (mixed) |
| **Docs** | https://pymodbus.readthedocs.io/ / https://github.com/mushorg/conpot |
| **Related** | OT-ICS testing methodology and safety, OT-ICS discovery and enumeration, Wireshark and tcpdump, Metasploit |

Reading from — and, in a lab, writing to — industrial protocols. Most OT protocols were designed decades ago with **no authentication and no encryption**: anyone on the wire can read process values and, often, issue control commands. That design flaw *is* the headline OT finding; demonstrating it safely is the skill.

> **⛔ Danger — Writing to a controller changes the physical world**A Modbus "write coil" can open a valve or start a motor. **Reads** are lower-risk but still active; **writes/commands are destructive by definition** and are lab/authorised-test-rig only, never against production, ever, without explicit written sign-off and an engineer at the controls. Re-read OT-ICS testing methodology and safety.

## Modbus (TCP #tcp/502) — pymodbus

The most common and simplest OT protocol. Data model: **coils** (1-bit RW), **discrete inputs** (1-bit RO), **holding registers** (16-bit RW), **input registers** (16-bit RO). No auth, no session — a `unit ID` addresses the device.

```bash
pip install 'pymodbus[repl]'
pymodbus.console tcp --host 10.0.0.10 --port 502     # interactive REPL
```

```
# In the REPL (reads — comparatively safe, still active):
client.read_coils address=0 count=10 slave=1
client.read_holding_registers address=0 count=20 slave=1
client.read_input_registers address=0 count=10 slave=1
client.read_discrete_inputs address=0 count=10 slave=1

# Writes — LAB ONLY, these actuate the process:
# client.write_coil address=0 value=true slave=1
# client.write_register address=10 value=1234 slave=1
```

Scripted read (the kind of safe, read-only PoC you'd actually run):

```python
# modread.py  — run with: python3 -I modread.py
from pymodbus.client import ModbusTcpClient
c = ModbusTcpClient("10.0.0.10", port=502)
c.connect()
rr = c.read_holding_registers(address=0, count=20, slave=1)
print(rr.registers if not rr.isError() else rr)
c.close()
```

Other Modbus tools: **modbus-cli**, **mbtget**, **mbpoll**, Metasploit `auxiliary/scanner/scada/modbusdetect` and `modbusclient`.

## Siemens S7comm (#tcp/102) — snap7

```bash
pip install python-snap7
```

```python
# s7read.py — read a data block (read-only). python3 -I s7read.py
import snap7
c = snap7.client.Client()
c.connect("10.0.0.20", 0, 1)          # rack 0, slot 1 (S7-300/400); slot 0/1 varies by model
print(c.get_cpu_info())               # module/firmware identity
data = c.db_read(1, 0, 16)            # DB1, start 0, 16 bytes
print(data.hex())
c.disconnect()
```

S7 has `plc_stop()` / `plc_cold_start()` style calls — **never** on production; they halt the controller.

## DNP3 (#tcp/20000) — utilities

```bash
# opendnp3 / dnp3-master libraries, or:
nmap -Pn -p20000 --script dnp3-info <host>        # identify (see discovery sheet)
```

DNP3 is common in power/water. Know the concepts (outstations, data points, unsolicited responses) and that **DNP3 Secure Authentication** exists but is rarely deployed.

## EtherNet/IP & CIP (#tcp/44818) — Rockwell/Allen-Bradley

```bash
pip install cpppo
python -m cpppo.server.enip.client -a 10.0.0.30 "Tag_Name"     # read a tag
nmap -Pn -p44818 --script enip-info <host>
```

## Metasploit SCADA modules

```
search type:auxiliary scada
use auxiliary/scanner/scada/modbusdetect
use auxiliary/scanner/scada/modbus_findunitid         # enumerate valid unit IDs
use auxiliary/admin/scada/modicon_command             # LAB ONLY — issues commands
```

Treat the `admin/scada/*` modules as live-fire: they send control commands.

## Conpot — practise safely with a honeypot/simulator

The right way to learn this without risking real kit: stand up a fake ICS device and point your tools at **that**.

```bash
pip install conpot            # or run the Docker image
conpot --template default     # emulates Modbus, S7comm, BACnet, IPMI, etc. with fake data
```

Point pymodbus/snap7/Nmap NSE at Conpot to see request/response patterns in Wireshark and tcpdump with zero risk. Other practice options: **GRFICSv2** (full virtual chemical-plant ICS lab), **ModbusPal**/**pymodbus server** (simulate a slave), vendor PLC simulators (e.g. Siemens PLCSIM, Codesys).

## Analysing the protocols in Wireshark

```
modbus.func_code == 5          # write single coil (someone actuating?)
s7comm.param.func              # S7 function
dnp3.al.func                   # DNP3 application function
enip.command                   # EtherNet/IP commands
```

Follow a stream to see plaintext register values and commands — the clearest way to *demonstrate* "no auth, no encryption" to a client.

## Reporting angle

The core OT findings are usually architectural, not a CVE:

- Control protocols with **no authentication/encryption** reachable from where they shouldn't be.
- **Poor segmentation** — L1/L2 reachable from IT/DMZ (tie back to the Purdue review).
- **Exposed controllers** (internet or flat network), default creds on HMIs/EWS.
- **No integrity checks** — commands can be spoofed/replayed. Frame impact in **process/safety** terms (loss of availability, unsafe state), per OT-ICS testing methodology and safety.

## More protocol commands

```bash
# Modbus — reads are lower risk; WRITES actuate the process (lab only)
mbpoll -m tcp -a 1 -t 4 -r 1 -c 20 10.0.0.10      # read 20 holding registers
# mbpoll -m tcp -a 1 -t 0 -r 1 10.0.0.10 1        # (LAB) write coil 1 = ON
# S7 identity (python-snap7)
python3 -c "import snap7;c=snap7.client.Client();c.connect('10.0.0.20',0,1);print(c.get_cpu_info())"
# EtherNet/IP tag read
python -m cpppo.server.enip.client -a 10.0.0.30 'Tag_Name'
# Metasploit SCADA aux
# use auxiliary/scanner/scada/modbusdetect ; auxiliary/scanner/scada/modbus_findunitid
conpot --template default                          # emulated target to practise against safely
```

Capture every PoC in Wireshark (`modbus || s7comm || enip || dnp3`) as evidence; never write to production.

## Kill-chain usage

### Enumeration

```bash
mbpoll -m tcp -a 1 -t 4 -r 1 -c 20 10.0.0.10   # read Modbus registers
```

### Exploitation

```bash
# LAB ONLY: write a coil/register to actuate the process
```

## Where it fits

The deepest, most dangerous OT phase — mostly a **lab/Conpot/off-production** activity. Reads demonstrate exposure; writes demonstrate impact but only on kit you're authorised to actuate. Pair every PoC with a Wireshark capture as evidence, and keep the safety priority front and centre.

---

## Navigation

- Parent: [Pentest Tools — Map of Content](https://www.rawrso.me/ethical-hacking/cheat-sheets.md)
- Previous: [OT/ICS discovery & enumeration](https://www.rawrso.me/ethical-hacking/cheat-sheets/ot-ics-discovery-and-enumeration.md)
- Next: [OT/ICS testing — methodology & safety](https://www.rawrso.me/ethical-hacking/cheat-sheets/ot-ics-testing-methodology-and-safety.md)
