-
Install system dependencies:
- Python 3.9 or later from python.org
- Npcap from npcap.com (Windows only)
- Node.js and npm for web interface development
-
Clone the repository and set up a virtual environment:
git clone https://github.com/networkmonitor/networkmonitor.git cd networkmonitor python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install development dependencies:
pip install -r requirements.txt pip install -r requirements-build.txt
-
Install web interface dependencies:
cd networkmonitor/web npm install
- Windows 10 or later (64-bit)
- Python 3.9 or later
- Npcap for packet capture (Windows)
- Make sure to select "Install Npcap in WinPcap API-compatible Mode" during installation
- Python 3.8 or higher
- pip (Python package manager)
- Git
- Download from: https://nsis.sourceforge.io/Download
- Run the installer and select full installation
- Add NSIS installation directory to PATH (usually
C:\Program Files (x86)\NSIS) - Install required NSIS plugins:
- Download EnvVarUpdate plugin: https://nsis.sourceforge.io/mediawiki/images/7/7f/EnvVarUpdate.7z
- Extract the files to your NSIS installation:
- Copy
Include\EnvVarUpdate.nshtoC:\Program Files (x86)\NSIS\Include - Copy
Plugin\x86-ansi\EnvVarUpdate.dlltoC:\Program Files (x86)\NSIS\Plugins\x86-ansi - Copy
Plugin\x86-unicode\EnvVarUpdate.dlltoC:\Program Files (x86)\NSIS\Plugins\x86-unicode
- Copy
- Download GTK3 runtime installer: https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases
- Run the installer and select Complete installation
- IMPORTANT: Make sure to check "Add to PATH" option during installation
- After installation, verify that the GTK3 bin directory (e.g.,
C:\Program Files\GTK3-Runtime Win64\bin) is in your PATH - Restart your terminal/IDE after installation
- To verify installation: Open a new command prompt and run
gdk-pixbuf-query-loaders --version - If you continue to have issues with Cairo:
- Download the latest GTK3 bundle from MSYS2: https://www.msys2.org/
- Install MSYS2
- Open MSYS2 terminal and run:
pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-cairo - Add the MSYS2 bin directory to your PATH (e.g.,
C:\msys64\mingw64\bin)
- Download Visual Studio Build Tools: https://visualstudio.microsoft.com/visual-cpp-build-tools/
- Run the installer and select:
- C++ build tools
- Windows 10 SDK
- Python development support (optional)
- Install system packages:
sudo apt install net-tools iptables tcpdump
# Install basic build dependencies
sudo apt update
sudo apt install -y build-essential python3-dev python3-pip
# Install Cairo and GTK3 for icon conversion
sudo apt install -y libcairo2-dev libgirepository1.0-dev pkg-config
# Install networking tools
sudo apt install -y net-tools iptables tcpdump
# Install NSIS (for creating installers on Linux)
sudo apt install -y nsispip3 install cairosvg pillow pyinstaller- Install Homebrew packages:
brew install libpcap tcpdump
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install dependencies
brew install cairo pkg-config
brew install gtk+3
brew install python3
# Optional: Install NSIS (for cross-building Windows installers)
brew install makensispip3 install cairosvg pillow pyinstaller- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windows- Install runtime dependencies:
pip install -r requirements.txt- Install build dependencies (only needed for packaging):
pip install -r requirements-build.txt-
Create and activate a virtual environment:
python -m venv venv # Windows venv\Scripts\activate # Linux/macOS source venv/bin/activate
-
Install runtime dependencies:
pip install -r requirements.txt
-
Install build dependencies (only needed for packaging):
pip install -r requirements-build.txt
Run the application in debug mode:
python start_networkmonitor.pyOr use the batch file on Windows (includes additional debug output):
run_networkmonitor.bat- Clone the repository:
git clone https://github.com/umerfarok/networkmonitor.git
cd networkmonitor- Build the package:
python build.pyThe build process will:
- Clean previous builds
- Convert SVG icon to ICO format (if GTK3 runtime is installed)
- Create a standalone executable
- Create an installer (on Windows, if NSIS is installed)
Build outputs will be available in the dist directory:
- Windows:
NetworkMonitor.exeandNetworkMonitor_Setup_0.1.0.exe - Linux:
NetworkMonitorexecutable - macOS:
NetworkMonitorexecutable or.appbundle
Building on Linux creates a standalone executable that can be run on similar Linux distributions:
# Make the executable executable
chmod +x dist/NetworkMonitor
# Run the application
sudo ./dist/NetworkMonitorBuilding on macOS creates a standalone executable:
# Make the executable executable
chmod +x dist/NetworkMonitor
# Run the application
sudo ./dist/NetworkMonitorThe Windows executable requires Administrator privileges to run properly:
- Right-click on the executable
- Select "Run as Administrator"
If you see "cairo library not found" errors:
- Make sure GTK3 is properly installed as described in the prerequisites
- Verify that GTK3 bin directory is in your PATH environment variable
- Install Python packages:
pip install cairosvg Pillow - Try installing Cairo directly:
pip install pycairo - For Windows, consider using MSYS2 to install Cairo:
- Install MSYS2: https://www.msys2.org/
- Run:
pacman -S mingw-w64-x86_64-cairo
- Restart your terminal/IDE completely (not just the command prompt)
- Run build again
If installer creation fails:
- Ensure NSIS is installed and in PATH
- Install EnvVarUpdate plugin as described in prerequisites (Windows only)
- Check if the NSIS Include and Plugins directories contain the required files
- Run
makensis -VERSIONin terminal to verify NSIS is accessible
If you see missing DLL errors when running the built executable:
- Windows: Install Visual C++ Redistributable 2015-2022
- Linux: Install required system libraries using apt
- macOS: Install required libraries using brew
- Ensure all dependencies are installed:
pip install -r requirements.txt
- Follow PEP 8 guidelines
- Use type hints where possible
- Document public functions and classes
python -m pytest tests/- Add runtime dependencies to
requirements.txt - Add build dependencies to
requirements-build.txt - Update
setup.pyfor runtime dependencies
-
Keep dependencies organized:
- requirements.txt: Runtime dependencies
- requirements-build.txt: Build-time dependencies
- package.json: Web interface dependencies
-
Version constraints:
- Use >= for minimum version requirements
- Test thoroughly with latest versions
- Document any version-specific issues
-
System dependencies:
- Document clearly in README.md
- Provide detailed installation instructions
- Include version requirements
-
Test installation scenarios:
- Clean Windows installation
- Various Python versions
- Different Npcap versions
- With/without admin rights
-
Test dependency checks:
- Missing Python
- Missing Npcap
- Missing packages
- Version conflicts
Implement graceful fallbacks and clear error messages for:
- Missing system dependencies
- Package installation failures
- Permission issues
- Version compatibility problems
-
Update version in:
setup.pybuild.pynetworkmonitor/__init__.py
-
Create a new build:
python build.py- Test the installer from
distdirectory
-
Update version numbers:
- pyproject.toml
- installer.nsi
- package.json
-
Build release artifacts:
python build.py
-
Test installation package:
- Fresh Windows installation
- Different Python versions
- Verify dependency handling
- Check error messages
-
Create release checklist:
- Version numbers updated
- Changelog updated
- Dependencies documented
- Installation tested
- Release notes complete
- Run
python -m pip checkto verify dependencies - Use
python -m pip install --upgrade pip setuptools wheelto update basic tools - Clear pip cache if needed:
python -m pip cache purge
- Run the installer as Administrator (Windows)
- Run with sudo on Linux/macOS
- Check system logs for installation errors
- Check logs in
networkmonitor.log - Run with
--debugflag for verbose output - Verify all dependencies are installed
networkmonitor/
├── __init__.py # Package initialization
├── cli.py # Command-line interface
├── dependency_check.py # Dependency verification
├── launcher.py # Application launcher
├── monitor.py # Core monitoring functionality
├── npcap_helper.py # Windows Npcap support
├── server.py # Web server component
├── splash.py # Splash screen UI
└── web/ # Web interface files
The status dashboard is built using Tkinter with a modern, dark theme design. The implementation can be found in run_app.py and launcher.py. Here are the key technical details:
The UI uses a consistent color scheme defined as:
- Background: #1e1e1e (Dark background)
- Foreground: #e0e0e0 (Light text)
- Accent: #007acc (Blue accent)
- Success: #2ecc71 (Green)
- Error: #e74c3c (Red)
- Warning: #f1c40f (Yellow)
- Header Background: #252526
- Button Background: #333333
- Button Hover: #404040
-
Header Section
- Professional gradient background effect
- Centered title with Segoe UI bold font
- Application icon integration
- Fixed height with proper padding
-
Status Section
- Dynamic status indicator with smooth color transitions
- Clear status message display
- Color-coded states (running/error/warning)
- Background highlighting for better visibility
-
URL Display
- Interactive URL label with hover effects
- One-click copy functionality
- Visual feedback on interactions
- Direct browser launch capability
-
Control Panel
- Modern flat-design buttons
- Consistent button sizing and spacing
- Hover effects for better UX
- Background operation support
- Safe exit handling
The application now supports system tray operation with:
- Custom tray icon display
- Right-click context menu
- Status preservation while minimized
- Quick restore functionality
- Clean application exit
-
Window Configuration
- Minimum size: 500x300 pixels
- Responsive layout adaptation
- DPI-aware scaling
- Multi-monitor support
- Proper window manager hints
-
Font Usage
- Primary UI: Segoe UI (Windows system font)
- Fallback fonts for cross-platform compatibility
- Size scaling based on screen resolution
- Consistent font weights
-
Layout Standards
- Standard padding: 20px horizontal, 15px vertical
- Consistent component spacing
- Proper alignment and anchoring
- Responsive grid system
-
Event Handling
- Non-blocking UI operations
- Threaded server management
- Periodic status updates
- Clean exit procedures
- Error handling and recovery
- Follow the color scheme:
element = tk.Widget(
parent,
bg=COLORS['bg'],
fg=COLORS['fg'],
activebackground=COLORS['button_hover']
)- Use the button creation helper:
new_button = create_button(
text="Action",
command=handler_function,
width=15
)- Status Updates:
def update_status(state, message):
# Update indicator color
color = COLORS[state] if state in COLORS else COLORS['warning']
status_indicator.update_color(color)
# Update message
status_var.set(message)
# Trigger UI update
root.update_idletasks()-
Visual Testing
- Window sizing and minimum constraints
- HiDPI display compatibility
- Color contrast verification
- Animation smoothness
- Font rendering quality
-
Functionality Testing
- Button interactions
- Status updates
- URL handling
- Copy functionality
- System tray operations
- Exit handling
-
Performance Testing
- UI responsiveness
- Memory usage
- CPU utilization
- Thread management
- Resource cleanup
Ensure all UI-related dependencies are installed:
pip install -r requirements.txtCritical packages:
- tkinter (built into Python)
- pystray>=0.19.0 (system tray support)
- Pillow>=10.0.0 (image processing)
-
UI Changes
- Maintain dark theme consistency
- Follow existing color scheme
- Use proper padding and spacing
- Ensure responsive behavior
- Add appropriate documentation
-
Code Style
- Follow PEP 8 guidelines
- Document all UI components
- Use type hints where applicable
- Include error handling
- Write modular, reusable code
-
Pull Requests
- Include UI screenshots if applicable
- Document visual changes
- Test across different resolutions
- Verify system tray functionality
- Check resource usage
-
Prerequisites:
- Python 3.9 or later
- Npcap (Windows only)
- Git
-
Clone and Setup:
git clone https://github.com/umerfarok/netmoniter.git cd netmoniter python -m venv venv source venv/bin/activate # or `venv\Scripts\activate` on Windows pip install -r requirements.txt pip install -r requirements-build.txt
python build.pypython -m pytest tests/See CONTRIBUTING.md for guidelines.