CafeSentinel is a professional-grade network monitoring and occupancy tracking system designed for Internet Cafes and LAN Centers. It is engineered as a high-performance, self-healing application compiled with Nuitka for stealth and stability.
Unlike basic scripts, CafeSentinel operates as a dual-process system with mutual monitoring to ensure zero downtime, providing real-time visual auditing and automated reporting to Discord.
- Tri-Point Status: Continuously pings Router, Server, and Internet Gateway with configurable intervals.
- Cascading Failure Logic: Intelligently detects if an "Internet Outage" is actually just a "Router Failure," suppressing false alarms.
- Noise Filtering: Hysteresis logic filters transient network jitter (configurable threshold, default 10s) to prevent false incident reports from momentary packet loss.
- Dual DNS Verification: Automatically verifies internet connectivity against both primary (8.8.8.8) and secondary (1.1.1.1) DNS servers before declaring an outage.
- Visual Dashboard: Displays real-time status on a dedicated GUI grid.
- Remote Screenshots: Captures the host screen at set intervals (e.g., every 60 mins) and uploads it to a private Discord channel.
- Incident Proof: Automatically snaps a screenshot the moment an internet outage is resolved, providing visual timestamps for ISP disputes.
- Privacy Vault: Admin-protected "Privacy Mode" to temporarily disable screen capture.
- Live Counter: A dynamic System Tray badge shows the exact count of active PCs (e.g., "15").
- Session Logic: Tracks uptime/downtime of client PCs to generate usage reports.
- Smart Freeze: If the router disconnects, the system "freezes" occupancy data to prevent false "Mass Log-off" events in your reports.
Four distinct tray icons provide immediate status at a glance:
- Router: White (OK) / Red (Offline)
- Server: White (OK) / Red (Offline)
- Internet: White (OK) / Red (Offline)
- Clients: Dynamic badge showing active PC count.
CafeSentinel uses a Dual-Executable Mutual Monitoring Architecture for maximum resilience:
-
SentinelService.exe (The Watchdog): A lightweight background process that monitors the main application. If CafeSentinel crashes or is forcibly closed, the Watchdog restarts it within 2 seconds.
-
CafeSentinel.exe (The Interface): The main PySide6 GUI application that handles scanning, reporting, and user interaction. It actively monitors the Watchdog service and automatically respawns it if terminated.
Self-Healing: Both processes monitor each other via 5-second heartbeat checks. If either process is killed (even via Task Manager), the surviving process will automatically revive it, creating an unbreakable monitoring loop that can only be stopped via password-protected shutdown.
Deployment Structure:
CafeSentinel/
├── CafeSentinel.exe (Main Application)
├── config.json
├── install_monitor.bat
└── SentinelService/ (Nested Watchdog)
└── SentinelService.exe
This project is designed to be compiled, not run as a raw script. It includes a custom build.py system that utilizes Nuitka with optional Link Time Optimization (LTO) to produce optimized, standalone binaries.
- Python 3.10+
- Pip requirements:
nuitka,zstandard,pyside6,ordered-set
- Install dependencies:
pip install -r requirements.txt - Run the build script:
python build.py - Select build mode:
- Option 1: Fast Build - No LTO, console visible. Ideal for testing and debugging.
- Option 2: Production Build - Full LTO optimization, no console. For deployment.
The Build Script will automatically:
- Clean previous build artifacts.
- Compile
resources.qrcintoresources_rc.py(embedding icons). - Compile the Main App and Watchdog into separate standalone folders.
- Organize deployment with nested folder structure.
- Package everything into a
dist/CafeSentinelDeployfolder ready for deployment.
To install on a target machine:
- Copy the entire
CafeSentinelDeploy/CafeSentinelfolder from your build output to the target machine. - Navigate into the
CafeSentinelfolder and runinstall_monitor.batas Administrator.- This registers the SentinelService (Watchdog) to run with highest privileges at user logon.
- The Watchdog will then automatically launch the main application.
- The system will start automatically on next login. To start immediately, run
SentinelService\SentinelService.exemanually.
Security: The application requires administrator privileges for raw ICMP ping operations and is protected by a password-based exit mechanism to prevent unauthorized shutdown.
The application generates a config.json file on first run. You can edit this file to hot-reload settings instantly without restarting the application.
Verification Settings:
"verification_settings": {
"retry_delay_seconds": 1.0,
"secondary_target": "1.1.1.1",
"min_incident_duration_seconds": 10
}
min_incident_duration_seconds: Minimum outage duration before logging/alerting. Filters transient network jitter.
Monitor Settings:
"monitor_settings": {
"interval_seconds": 2,
"pc_subnet": "192.168.1",
"pc_start_range": 110,
"pc_count": 20
}
Screenshot Settings:
"screenshot_settings": {
"enabled": true,
"interval_minutes": 60,
"quality": 80,
"resize_ratio": 1.0
}
Refer to config.json for complete configuration options including Discord webhooks, target IPs, and occupancy tracking settings.
- Hot-reload configuration without restart
- Password-protected privacy mode and shutdown
- Automated Discord notifications with embedded screenshots
- CSV-based incident logging with timestamps
- Session-based occupancy tracking with hourly snapshots
- Cascading failure detection to prevent false alarms
- Dual DNS verification for internet connectivity
- Intelligent incident filtering with configurable thresholds
MIT License. See LICENSE file for details.
