Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QModbusUniversal - Universal Modbus Testing Tool

A powerful Qt-based Modbus testing application with visual modeling capabilities for protocol development, testing, and monitoring.

Features

Core Functionality

  • Multi-Protocol Support: Both Modbus TCP and Modbus RTU
  • Visual Register Modeling: Create, edit, and manage Modbus registers with an intuitive UI
  • Real-time Monitoring: Continuous polling of register values
  • Trigger System: Event-based actions when register conditions are met
  • Project Management: Save and load complete protocol configurations

Register Management

  • Support for all Modbus register types:

    • Coils (FC01/FC05/FC15)
    • Discrete Inputs (FC02)
    • Holding Registers (FC03/FC06/FC16)
    • Input Registers (FC04)
  • Multiple data types:

    • Bool (1 bit)
    • UInt16 / Int16 (16-bit integers)
    • UInt32 / Int32 (32-bit integers)
    • Float32 (IEEE 754 floating point)
  • Read-only and read-write register support

  • Individual register polling intervals

  • Batch read operations

Connection Management

  • TCP Configuration:

    • IP address and port
    • Configurable timeout and retries
  • RTU Configuration:

    • Serial port selection
    • Baud rate (9600-115200)
    • Data bits, stop bits, parity
  • Connection status monitoring

  • Automatic reconnection handling

Trigger System

  • Condition-based event monitoring
  • Supported conditions: ==, !=, >, <, >=, <=
  • Custom action descriptions
  • Real-time trigger evaluation during polling

Building the Application

Prerequisites

Ubuntu/Debian

sudo apt-get update
sudo apt-get install qt5-default qtbase5-dev qttools5-dev-tools
sudo apt-get install libqt5serialbus5-dev libqt5serialport5-dev

Fedora/RHEL

sudo dnf install qt5-qtbase-devel qt5-qttools-devel
sudo dnf install qt5-qtserialbus-devel qt5-qtserialport-devel

macOS

brew install qt@5
export PATH="/usr/local/opt/qt@5/bin:$PATH"

Windows

Download and install Qt from https://www.qt.io/download Make sure to include:

  • Qt 5.12+ (or Qt 6.x)
  • Qt SerialBus module
  • Qt SerialPort module

Build with qmake

cd QModbusUniversal-master
qmake QModbusUniversal.pro
make

Build with CMake (Alternative)

mkdir build
cd build
cmake ..
make

Running the Application

Linux/macOS

./QModbusUniversal

Windows

QModbusUniversal.exe

Usage Guide

Creating a New Project

  1. File → New Project to start fresh
  2. Configure connection settings:
    • Choose TCP or RTU
    • Enter connection parameters
    • Set slave ID (default: 1)

Adding Registers

  1. Click Add Register button
  2. Configure register properties:
    • Name (identifier)
    • Register Type (Coil, Holding Register, etc.)
    • Address (0-65535)
    • Data Type (Bool, UInt16, Int32, etc.)
    • Description (optional)
    • Read Only checkbox
    • Poll Interval (0 = manual only)

Reading/Writing Data

Manual Operations

  • Read All: Read all configured registers once
  • Read Selected: Read currently selected register
  • Write Selected: Write to selected register (if not read-only)
  • Double-click value cell to quickly write new value

Continuous Polling

  1. Set poll interval (milliseconds)
  2. Click Start in Polling section
  3. Only registers with poll interval > 0 will be polled
  4. Click Stop to halt polling

Setting Up Triggers

  1. Switch to Triggers tab
  2. Click Add Trigger
  3. Configure:
    • Select register to monitor
    • Choose condition (==, !=, >, <, >=, <=)
    • Enter threshold value
    • Describe action (logged when triggered)
  4. Triggers are evaluated during polling

Saving Projects

  • File → Save Project (Ctrl+S)
  • File → Save Project As... (Ctrl+Shift+S)
  • Projects saved as .mbproj JSON files
  • Contains all registers, triggers, and settings

Project Structure

QModbusUniversal/
├── main.cpp                 # Application entry point
├── mainwindow.h/.cpp/.ui    # Main window and UI logic
├── modbusregister.h/.cpp    # Register data model
├── modbusproject.h/.cpp     # Project container with serialization
├── registerdialog.h/.cpp/.ui # Register configuration dialog
├── triggerdialog.h/.cpp/.ui  # Trigger configuration dialog
├── QModbusUniversal.pro     # Qt project file
├── CMakeLists.txt           # CMake build configuration
└── README.md                # This file

Data Type Conversions

Register Layout

  • Bool: 1 register (0 or 1)
  • UInt16/Int16: 1 register
  • UInt32/Int32/Float32: 2 registers (big-endian)

Byte Order

All multi-register values use big-endian byte order:

  • First register contains most significant 16 bits
  • Second register contains least significant 16 bits

Testing and Development

Testing Modbus Penetrations

This tool is particularly useful for:

  • Protocol fuzzing and edge case testing
  • Penetration testing of Modbus implementations
  • Validating device behavior under various conditions
  • Simulating client interactions

Development Workflow

  1. Create protocol model (registers)
  2. Connect to device/simulator
  3. Test read/write operations
  4. Set up triggers for monitoring
  5. Enable polling for continuous monitoring
  6. Save project for later use

Troubleshooting

Connection Issues

  • TCP: Verify host IP and port are correct
  • RTU: Check serial port permissions (sudo chmod 666 /dev/ttyUSB0)
  • Verify slave ID matches device configuration
  • Increase timeout if device is slow to respond

Build Issues

  • Ensure Qt SerialBus module is installed
  • Check Qt version (minimum Qt 5.12)
  • On Linux, you may need to install libqt5serialbus5-dev package

Runtime Issues

  • Check log tab for error messages
  • Verify register addresses match device configuration
  • Ensure data types match register contents
  • For RTU, verify serial parameters match device

License

This project is provided as-is for educational and testing purposes.

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.

About

Universal Modbus Testing Tool

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages