# CafeSentinel - Technical Documentation ## Overview CafeSentinel is a network monitoring and occupancy tracking application for internet cafes. It monitors network infrastructure (router, server, internet gateway), tracks client PC activity, **monitors game server latency**, captures screenshots, and sends notifications to Discord channels. The application uses a dual-process self-healing architecture where two executables monitor each other and automatically restart on failure. All sensitive configuration and credential data is encrypted and stored in disguised file formats for security. ## Technical Stack - **GUI Framework:** PySide6 (Qt for Python) - **Network Monitoring:** Raw ICMP sockets (requires admin privileges) - **Screenshot Capture:** mss library, output as WebP format - **HTTP Server:** Flask with CORS support (REST API for remote management) - **Encryption:** cryptography library (Fernet symmetric encryption) - **Notifications:** Discord webhooks via requests library - **Hardware Monitoring:** pythonnet + LibreHardwareMonitor (CPU/GPU temps, VRAM detection) - **Compilation:** Nuitka with optional LTO optimization - **Platform:** Windows only (uses Windows-specific process management) ## Project Structure ``` CafeSentinel/ ├── controllers/ │ └── system_tray_app.py # System tray controller, starts all services ├── models/ │ ├── app_logger.py # Daily rotating log system with retention │ ├── config_manager.py # Encrypted config singleton manager │ ├── discord_notifier.py # Discord webhook client │ ├── event_logger.py # CSV incident logging │ ├── game_server_loader.py # Multi-game relay IP loader │ ├── network_tools.py # ICMP ping implementation │ ├── screen_capture.py # Screenshot capture (mss library) │ ├── security_manager.py # Password vault with Fernet encryption │ ├── sentinel_worker.py # Main monitoring worker thread │ ├── session_manager.py # PC occupancy tracking │ └── system_monitor.py # Hardware profiling and telemetry (NEW) ├── data/ │ └── relays/ # Game server relay IP databases │ ├── dota2_relays.json # Dota 2 regional relay IPs │ ├── cs2_relays.json # Counter-Strike 2 relay IPs │ ├── valorant_relays.json # VALORANT relay IPs │ └── apex_relays.json # Apex Legends relay IPs ├── libs/ │ └── LibreHardwareMonitor/ # Hardware monitoring DLLs (NEW) ├── utils/ │ └── resource_manager.py # Path resolution for compiled/script mode ├── views/ │ ├── main_window.py # GUI dashboard │ ├── setup_wizard.py # First-run password setup │ ├── settings_dialog.py # Local configuration editor │ └── settings_pages/ │ ├── network_page.py # Network settings tab │ ├── monitoring_page.py # Monitoring settings tab │ ├── discord_page.py # Discord settings tab │ └── system_page.py # System settings tab (stealth, tray, retention) ├── assets/icons/ # Icon resources ├── api_server.py # Flask REST API server ├── interface.py # Main application entry point ├── watchdog_service.py # Watchdog process entry point ├── startup_manager.py # Windows startup registration ├── resources.qrc # Qt resource file ├── build.py # Nuitka build script ├── cscf.dll # Encrypted configuration (auto-generated) ├── cron.dll # Encrypted password vault (first-run) ├── info.log # Current day log file ├── probes/ # Archived log files folder └── config_backups/ # Encrypted config backup folder ``` ## Documentation Index | Module | Description | |--------|-------------| | **[01_System_Architecture.html](./01_System_Architecture.html)** | Core dual-process architecture, security/encryption layer, and build system details. | | **[02_Core_Logic.html](./02_Core_Logic.html)** | Deep dive into SentinelWorker, Watchdog, SystemTrayController, and Network Logic. | | **[03_Features_and_Modules.html](./03_Features_and_Modules.html)** | Specifics on Game Monitoring, Screenshot System, and Discord Integration. | | **[04_Configuration_Reference.html](./04_Configuration_Reference.html)** | Complete JSON schema, validation rules, hot-reload, and setup details. | | **[05_API_and_Logging.html](./05_API_and_Logging.html)** | REST API endpoints, logging rotation/retention, and data structures. | | **[06_Operations_Manual.html](./06_Operations_Manual.html)** | Deployment, troubleshooting guides, and version history. |