Where possible, the Caldera for OT plugins leverage open-source libraries and payloads, unifying their exposure through the Caldera Adversary Emulation framework.
-
The Modbus plugin leverages the open-source python library PyModbus - version 2.5.3.
-
The PyModbus library v2.5.3 is licensed with the BSD 3-Clause License license
-
A custom command-line interface was created by our team for the PyModbus library to allow for Caldera agent interoperability. The CLI payload comes precompiled with the plugin, but can be recompiled following the instructions below.
The linux payload was compiled with Ubuntu 22.04.2 LTS, Python version 3.8-dev, Pyinstaller 5.10.1. The windows payload was compiled with Windows 10 v21H2, Python version 3.8.10, Pyinstaller 5.10.1.
- Download source
git clone <address>
- Optionally create and enter a virtual environment with the required python version above using packages like pyenv, venv, pipenv, or poetry.
pipenv shell
If you need to specify the python version you can use --python=3.8
in your pipenv command.
- Install required python packages
pip install -r ./src/requirements.txt --find-links ./lib/netact/
- Test the CLI
python ./src/modbus_cli.py -h
- Build the binary with a static builder like pyinstaller or py2exe. Alternatively you can compile the binary with cython. See this stackoverflow thread for more information: thread
pyinstaller -F ./src/modbus_cli.py
The tests
directory contains a Modbus Server python script from the PyModbus library that can be used to test all actions included in the plugin.
python tests/sync_server_ex.py
Note: Default port is 5020