Skip to content

Commit ad2c8ed

Browse files
authored
Merge pull request #4 from niwciu/develop
pull request containing changes from develop for v1.0.2 release
2 parents 90cad43 + 92d16f1 commit ad2c8ed

File tree

16 files changed

+448
-28
lines changed

16 files changed

+448
-28
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Build & Release App
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Uruchamiaj tylko przy tagach np. v1.0.2
7+
8+
jobs:
9+
build_ubuntu:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Install dependencies & build
22+
run: |
23+
python -m venv venv
24+
source venv/bin/activate
25+
pip install -r requirements.txt
26+
pip install pyinstaller
27+
pyinstaller --onefile --name "ModbusSniffer" modbus_sniffer_GUI.py
28+
chmod +x dist/ModbusSniffer
29+
30+
# Tworzenie archiwum
31+
mkdir -p release
32+
tar -czvf release/ModbusSniffer-linux.tar.gz -C dist ModbusSniffer
33+
34+
# Sprawdzenie, czy plik został utworzony
35+
ls -al release
36+
37+
- name: Upload Ubuntu artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: ubuntu-build
41+
path: release/ModbusSniffer-linux.tar.gz
42+
43+
build_windows:
44+
runs-on: windows-latest
45+
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: '3.11'
54+
55+
- name: Install dependencies & build
56+
run: |
57+
python -m venv venv
58+
.\venv\Scripts\activate
59+
pip install -r requirements.txt
60+
pip install pyinstaller
61+
pyinstaller --onefile --noconsole --name "ModbusSniffer.exe" --icon="./images/icon.ico" modbus_sniffer_GUI.py
62+
63+
- name: Upload Windows artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: windows-build
67+
path: dist\ModbusSniffer.exe
68+
69+
release:
70+
needs: [build_ubuntu, build_windows]
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- name: Checkout code
75+
uses: actions/checkout@v4
76+
77+
- name: Extract changelog for tag
78+
id: changelog
79+
run: |
80+
if [[ "${GITHUB_REF}" =~ refs/tags/ ]]; then
81+
TAG_NAME="${GITHUB_REF#refs/tags/}"
82+
echo "Extracted TAG_NAME: $TAG_NAME"
83+
84+
CONTENT=$(awk -v tag="$TAG_NAME" '
85+
BEGIN { found=0 }
86+
$0 ~ "^# +" tag {
87+
found=1
88+
}
89+
found && $0 ~ "^# +v[0-9]+\\.[0-9]+\\.[0-9]+" && $0 !~ tag {
90+
exit
91+
}
92+
found { print }
93+
' CHANGELOG.md)
94+
95+
echo "Extracted changelog:"
96+
echo "$CONTENT"
97+
98+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
99+
echo "$CONTENT" >> $GITHUB_OUTPUT
100+
echo "EOF" >> $GITHUB_OUTPUT
101+
102+
echo "release_name=$TAG_NAME" >> $GITHUB_OUTPUT
103+
else
104+
echo "Not a tag release. Skipping changelog extraction."
105+
echo "changelog=No changelog found." >> $GITHUB_OUTPUT
106+
echo "release_name=Unnamed release" >> $GITHUB_OUTPUT
107+
fi
108+
109+
- name: Download Ubuntu artifact
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: ubuntu-build
113+
path: dist/
114+
115+
- name: Download Windows artifact
116+
uses: actions/download-artifact@v4
117+
with:
118+
name: windows-build
119+
path: dist/
120+
121+
- name: Create GitHub Release
122+
uses: softprops/action-gh-release@v1
123+
with:
124+
tag_name: ${{ github.ref_name }}
125+
name: ${{ steps.changelog.outputs.release_name }}
126+
body: ${{ steps.changelog.outputs.changelog }}
127+
files: |
128+
dist/ModbusSniffer-linux.tar.gz
129+
dist/ModbusSniffer.exe
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Changelog
2+
# v1.0.2 – What's Changed 🚀
3+
4+
## 📦 Build System
5+
- ⚙️ Added cross-platform build scripts for Windows and Ubuntu using GitHub Actions
6+
- 🖥️ Configured PyInstaller with platform-specific settings and application icon
7+
8+
## 🧾 Documentation
9+
- 📚 Updated README with clearer setup and usage instructions
10+
- 📥 Added instructions on downloading prebuilt executables
11+
12+
## 🖼️ Visual Polish
13+
- 🧊 Added custom application icons for Windows and Linux builds
14+
15+
## 📑 Project Management
16+
- 🆕 Introduced structured `CHANGELOG.md` for tracking changes
17+
18+
**Full Changelog**: https://github.com/niwciu/ModbusSniffer/compare/v1.0.1...v1.0.2
19+
20+
</br></br>
21+
# v1.0.1 – What's Changed 🚀
22+
23+
## 🖥️ GUI Improvements
24+
- 🛠️ Reorganized Settings section and updated to use comboboxes
25+
- 🔌 Added auto-detection for serial devices
26+
- 🧹 Introduced Clear View button for quick UI reset
27+
- 🧾 Added data formatting for improved table data presentation
28+
29+
## ⚙️ Modbus Parser Improvements (New Version)
30+
- 🔧 Refactored the module for better standardization and easier future extensibility
31+
- 🐞 Fixed bugs and applied improvements after validating all functions that the parser can interpret
32+
33+
**Full Changelog**: https://github.com/niwciu/ModbusSniffer/compare/v1.0.0...v1.0.1
34+
35+
</br></br>
36+
# v1.0.0 – Initial Release 🎉
37+
38+
This project is a fork of [BADAndrea ModbusSniffer](https://github.com/BADAndrea/ModbusSniffer)
39+
40+
## This version brings:
41+
- 💻 Code Refactor: Modular architecture with clear separation into modules and classes
42+
- 🛠️ Parser Overhaul: Fully rewritten ModbusParser as a dedicated class
43+
- 🖥️ GUI Added: A basic graphical interface for easier use
44+
- 🔄 CLI → GUI: All command-line functionality integrated into the GUI
45+
- 📋 Frame Table: Real-time view of the latest captured frames
46+
- 🌈 Live Logging: Color-coded request–response pairs; unmatched requests highlighted in red

ModbusSniffer.desktop

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=PLACEHOLDER_NAME
4+
Exec=PLACEHOLDER_EXEC
5+
Icon=PLACEHOLDER_ICON
6+
Terminal=false
7+
Categories=Utility;

README.md

Lines changed: 111 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,105 @@ This version brings:
3535
---
3636

3737

38-
# 🛠️ Installation & Setup
38+
# 🛠️ Build & Install
3939
## 1. General Requirements
4040

4141
### - Python 3 installed
4242
### - pip3 installed
43+
#### Linux
4344
```bash
4445
sudo apt install python3-pip
4546
```
47+
#### Windows
48+
```powershell
49+
python -m ensurepip --upgrade
50+
```
4651

47-
## 1. Clone the Repository
52+
## 2. Clone the Repository
4853

4954
```bash
5055
git clone https://github.com/niwciu/ModbusSniffer.git
5156
cd ModbusSniffer
5257
```
58+
__________________________
59+
60+
61+
## 3. Build Executable (for Ubuntu and Windows)
62+
If you'd like to generate a standalone executable application for Ubuntu or Windows, you can follow the steps below.
63+
64+
65+
> **Note:** f you only want to **run** the GUI app without generating a standalone executable, you can skip the build process and go straight to running the Python script as shown in
66+
>
67+
> **▶️ Running GUI app without build**.
68+
69+
### Ubuntu (Linux) - Build with build.sh
70+
71+
## 3. Build Executable (for Ubuntu and Windows)
72+
If you'd like to generate a standalone executable application for Ubuntu or Windows, you can follow the steps below.
73+
74+
> **Note:** If you only want to **run** the app and not build it, skip this step and go to **▶️ Running GUI app without build**.
75+
76+
> **Alternative Option:** If you don't want to build the application yourself, you can **download pre-built executables** for both Ubuntu and Windows from [this link](#) (insert actual download link here).
77+
78+
### Ubuntu (Linux) - Build with build.sh
79+
80+
If you are using Ubuntu (or any other Linux-based OS), there's a script to automatically generate the application for you, and it will also add the application to your system's menu as a clickable entry.
81+
82+
1. Run the following command to build the executable:
83+
84+
```bash
85+
sudo chmod +x build.sh
86+
./build.sh
87+
```
88+
89+
> **Note:**
90+
This script will:
91+
>* Cleans up previous build files (build/, dist/, .spec, __pycache__).
92+
>* Create a virtual environment.
93+
>* Install the necessary dependencies.
94+
>* Use PyInstaller to build the application.
95+
>* Copy the resulting executable to the appropriate folder.
96+
>* Create a .desktop shortcut and add it to ~/.local/share/applications/, making the application available from your system's menu.
97+
98+
2. After running build.sh, you will find the built application in the dist/ folder. The .desktop file will also be placed in your system's application menu, allowing you to easily launch the application without needing to manually navigate to the executable.
99+
### Windows - Build & Install
100+
101+
1. Run the following command to build the executable:
102+
103+
```powershell
104+
./build.bat
105+
```
106+
> **Note:**
107+
What build.bat does
108+
> * Cleans up previous build files (build/, dist/, .spec, __pycache__).
109+
> * Creates and activates a virtual environment (.venv/).
110+
> * Installs dependencies from requirements.txt and installs PyInstaller.
111+
> * Builds a standalone .exe from the Python script using PyInstaller and a custom icon.
112+
> * Creates desktop and Start Menu shortcuts pointing to the executable, using the icon.
113+
> * Deactivates the virtual environment and pauses for user review.
114+
115+
116+
2. After running build.sh, you will find the built application in the dist/ folder. You will find also shortcuts on desktop as well as in the start menu on your system.
117+
118+
> **Alternative Option:** You can also **download pre-built executables** for Windows from [this link](#) (insert actual download link here).
119+
120+
121+
# ▶️ Running GUI app without build
122+
## 1. General Requirements
123+
124+
### - Python 3 installed
125+
### - pip3 installed
126+
```bash
127+
sudo apt install python3-pip
128+
```
129+
130+
## 2. Clone the Repository
53131

54-
## 2. Create and Activate Virtual Environment
132+
```bash
133+
git clone https://github.com/niwciu/ModbusSniffer.git
134+
cd ModbusSniffer
135+
```
136+
## 3. Create and Activate Virtual Environment
55137

56138
### Linux / macOS
57139

@@ -67,49 +149,53 @@ python -m venv .venv # create venv
67149
.\.venv\Scripts\Activate.ps1 # activate
68150
```
69151

70-
## 3. Install Dependencies
152+
## 4. Install Dependencies
71153

72154
```bash
73155
pip install -r requirements.txt
74156
```
75-
## 4. Deactivate Virtual Environment
157+
158+
## 5.Run GUI app
159+
160+
```bash
161+
python3 modbus_sniffer_GUI.py
162+
```
163+
164+
## 6. Deactivate Virtual Environment
76165
```bash
77166
deactivate
78167
```
79168

80-
# 🎮 Usage
81-
## Create and Activate Virtual Environment befor running app
82-
(Info can be found in section **🛠️ Installation & Setup** above)
83-
## CLI Mode
84-
### Detail information aout usage of CLI version
169+
# 🎮 CLI app Usage
170+
171+
## 1. Clone the Repository
172+
173+
```bash
174+
git clone https://github.com/niwciu/ModbusSniffer.git
175+
cd ModbusSniffer
176+
```
177+
178+
## 2. Detail information aout usage of CLI version
179+
85180

86181
```bash
87182
python3 modbus_sniffer.py -h
88183
```
89-
### Example of usage
184+
## 3. Example of usage - running sniffer on port USB0 with baudrate 115200 and no parity
90185

91186
```bash
92187
python3 modbus_sniffer.py -p /dev/ttyUSB0 -b 115200 -r none
93188
```
94189

95-
## GUI Mode
96-
97-
```bash
98-
python modbus_sniffer_GUI.py
99-
```
100190

101191
---
102192

103-
# 🆕 What’s New (Changelog)
193+
# 🆕 What’s New
104194

105-
1. 📦 **Modularization:** Splitted code into modules and classes for maintainability
106-
2. 🧩 **Parser Rework:** `ModbusParser` class completely rewritten for clarity and extensibility
107-
3. 🖼️ **GUI Interface:** Added a simple, user-friendly GUI
108-
4. 🔁 **Full CLI Feature Set in GUI:** All previous CLI commands available via graphical menus (CSV under dev)
109-
5. 📊 **Frame Table View:** Displays the last captured frames with filtering options
110-
6. 🌈 **Enhanced Live Logging:** Color distinction for request/response pairs; unmatched requests marked in red
195+
For the full changelog, including detailed descriptions of all updates, please refer to the [CHANGELOG.md](CHANGELOG.md).
111196

112197
---
198+
113199
# 🔧 ToDo
114200

115201
- Integrate CSV logging with new modbus parser
@@ -154,4 +240,5 @@ Fork maintained by **niwciu** with enhancements described above.
154240

155241
![myEmbeddedWayBanerWhiteSmaller](https://github.com/user-attachments/assets/f4825882-e285-4e02-a75c-68fc86ff5716)
156242
***
157-
</div>
243+
</div>
244+

0 commit comments

Comments
 (0)