Skip to content

About

Industrial protocol analyzer. Modbus TCP and CAN/OBD-II decoding with CSV logging.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

scada-protocol-analyzer

Industrial protocol analyzer. Modbus TCP and CAN bus decoding with time-series logging.

Covers

SCADA Systems Engineer (entry-level) · Automation & Controls Engineer (entry-level) · PLC Programmer (entry-level) · Instrumentation & Controls Engineer · Control Systems Engineer · Field Automation Engineer

Output

See docs/modbus-output.json and docs/can-log.csv. Both are reproducible: tests/test_modbus.py asserts that a scan against a live slave returns exactly the committed JSON, and docs/can-log.csv is generated by analyzer.obd.

Quickstart

pip install -r requirements.txt
python -m analyzer modbus --host 192.168.1.10 --start 0 --count 10
python -m analyzer can --interface can0 --seconds 30

Protocol notes

Modbus TCP — FC03 read holding registers. parse_mbap / parse_pdu return {"error": ...} rather than raising on truncated frames, odd byte counts, or exception responses, and scan() does the same for transport failures, so a caller always gets something it can write to a report.

CAN — OBD-II mode-01 responses on 0x7E8–0x7EF, decoded as ISO 15765-2 single frames: byte 0 is the PCI, byte 1 the response SID 0x41, byte 2 the PID, byte 3 onward the payload. Multi-frame transfers are recognised and skipped rather than mis-decoded.

Tests

pip install pytest
python -m pytest tests -q

28 tests, no hardware needed: the Modbus tests run against a throwaway TCP slave bound to an ephemeral localhost port, and the CAN tests use real frame bytes including negative responses, truncated frames, and multi-frame PCIs.

What works

Modbus TCP read-holding-registers with robust framing errors, CAN/OBD-II PID decode with correct ISO-TP indexing, CSV logging, test suite, CI.

What doesn't

DNP3 and OPC UA are not implemented. No Modbus RTU yet. Multi-frame ISO-TP transfers are skipped, not reassembled. No live dashboard yet. The CAN path has not been run against a real socketcan interface here — only decode_frame has.

License

MIT

About

Industrial protocol analyzer. Modbus TCP and CAN/OBD-II decoding with CSV logging.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages