nbrain-industrial-ot-zkteco-modbus
# `nbrain-industrial-ot-zkteco-modbus` — Industrial OT `Modbus RTU/TCP`, `IEC 62443-3-3` AI Agent Safety Firewall & `ZKTeco` Biometric Attendance Protocol + MCP Server
[](./LICENSE)
[](./pyproject.toml)
[](./server.json)
Engineered by **[Eng. Nadeem Mohamed Badr El-Din](https://nadeembadr.com)** at **[NBrain (`منظومة إن برين` — nbra.in)](https://nbra.in)** from production factory ERP, water-treatment telemetry, and Odoo 19 ZKTeco biometric integrations.
## Capabilities
1. **Modbus RTU (`CRC-16/MODBUS` `0xA001` LSB-first) & Modbus TCP (`MBAP` 7-byte header)**: Deterministic binary framing, hex/byte decoding, and CRC-16 corruption detection.
2. **`IEC 62443-3-3` AI Agent Read-Only Firewall**: Prevents autonomous AI agents from issuing destructive coil/register writes (`FC05`, `FC06`, `FC0F`, `FC10`, `FC16`, `FC17`) to PLCs unless an `HMAC-SHA256` dual-control authorization token is verified.
3. **ZKTeco Biometric Protocol (`ZK Packed 32-Bit Epoch` & `ADMS / iClock ATTLOG`)**: Exact conversion of ZKTeco's non-Unix 31-day-month packed 32-bit integer timestamps + `ATTLOG` shift overtime (`1.5x` `Decimal`) payroll bridge.
## Quick Verification
```bash
PYTHONPATH=src python -m unittest discover -s tests -v
```
TDQS
Scored across 4 tools
Each tool has a clearly distinct role: Modbus frame encoding/decoding, IEC 62443 command safety auditing, ZKTeco timestamp conversion, and ZKTeco ATTLOG reconciliation. The two Modbus tools are separated by codec vs. safety enforcement, and the two ZKTeco tools by timestamp conversion vs. log processing.
All names use snake_case and begin with an action verb, making the set readable and predictable. The compound verbs such as frame_and_verify and decode_or_encode are semantically justified but slightly reduce strict verb_noun uniformity.
Four tools is well within the expected range for a specialized industrial OT integration toolkit. Each tool covers a distinct, non-trivial operation and none appears redundant.
The tools cover the advertised narrow utilities: Modbus frame codec, IEC 62443 command audit, ZKTeco epoch conversion, and ATTLOG reconciliation. However, there is no direct Modbus transaction/read-write tool or broader ZKTeco ADMS/device management surface, leaving notable operational gaps.