How find-vulnerabilities/rust-antivirus works
This repository is a Windows antivirus system written in Rust. The architecture is centered around a main desktop application plus two helper executables for real-time monitoring. The project is not a library-only design; it is a multi-binary system with runtime coordination between components.
1. Overall shape
The core app appears to orchestrate antivirus functions such as process monitoring, memory analysis, file monitoring, junk cleanup, and a GUI. The main executable in src/main.rs likely acts as the supervisor and entrypoint for startup, configuration loading, and subsystem wiring.
2. Main application boundary
The main crate contains the central logic in engine.rs, UI in gui.rs, and domain-specific monitoring/scanning modules. This suggests a layered structure where the engine owns policy and coordination, while the GUI is a presentation layer and the monitors/scanners are worker subsystems.
3. Multi-binary runtime model
There are separate binaries under src/bin/: file_monitor.rs and memory_monitor.rs. The README also instructs users to place rust_antivirus.exe, file_monitor.exe, and memory_monitor.exe together in a Configuration folder, which strongly indicates the main app launches or supervises these helper processes rather than embedding everything in one process.
4. Process supervision and orchestration
subprocess_manager.rs is likely responsible for starting, stopping, and supervising those helper executables. This is an important architectural boundary: the main process manages lifecycle, while the helper processes perform continuous monitoring in isolation.
5. IPC layer
The src/ipc/ directory contains message.rs, mod.rs, and named_pipe.rs, indicating a dedicated inter-process communication layer. On Windows, named pipes are a natural fit for main-process-to-worker communication, so the data flow likely runs between the GUI/engine and the separate monitor binaries through structured messages.
6. Monitoring and scanning subsystems
process_monitor.rs suggests real-time detection of suspicious processes, likely tied to process enumeration and termination decisions. memory_scanner.rs indicates in-memory inspection of processes for anomalous behavior. file_monitor.rs as a separate binary implies file system event watching and immediate response to suspicious file changes.
7. Configuration and environment handling
src/config/mod.rs suggests centralized configuration management for thresholds, paths, detection rules, or runtime options. The presence of Configuration.zip and packaging instructions implies the application depends on a specific deployment layout, likely including executables, config files, and possibly model/rule assets.
8. Detection and response flow
A plausible runtime flow is: the main app loads config, starts the GUI, launches helper monitors, receives events through IPC, and then applies policy decisions such as alerting, isolation, or termination. The “engine” module likely consolidates these decisions so UI and workers do not directly implement detection policy themselves.
9. GUI role
gui.rs uses egui according to the README. That means the UI is local/desktop rather than browser-based. The GUI likely displays scan status, events, and control actions, and serves as the user-facing control plane for the backend monitor processes.
10. Utility and support code
utils.rs likely contains shared helpers used across engine, IPC, and monitoring code. In a repo like this, utilities commonly include path handling, logging helpers, Windows-specific glue, or process/file helper routines.
11. Platform and tooling implications
The repo is explicitly Windows-focused and Rust-based, with multiple compiled executables. The architecture therefore depends on native Windows process/file/memory APIs and on Rust’s concurrency and process management capabilities, rather than a server-client deployment model.
12. Key architecture diagram boundaries
For an accurate diagram, draw: the main GUI/engine process; two external worker processes (file_monitor and memory_monitor); the IPC channel using named pipes; and the shared configuration/assets bundle under Configuration. The main process should be shown as the orchestrator, with monitor processes as independent producers of security events and the engine as the decision point.
Main entry points: engine.rs Engine · main.rs Main · mod.rs IPC · named_pipe.rs Named pipe
Components 14
Main app
Primary desktop application that loads configuration, drives policy, and hosts the GUI.
- Main · Desktop application startup and top-level orchestration.
rust_antivirus/src/main.rs - Engine · Central policy and detection coordination layer.
rust_antivirus/src/engine.rs - GUI · Local egui-based user interface and control surface.
rust_antivirus/src/gui.rs - Process mgr · Starts and supervises helper executables.
rust_antivirus/src/subprocess_manager.rs - Process scan · Realtime process inspection and suspicious activity detection.
rust_antivirus/src/process_monitor.rs - Memory scan · In-memory process inspection and anomaly analysis.
rust_antivirus/src/memory_scanner.rs
Worker processes
External helper binaries used for continuous monitoring and isolation of realtime work.
- File monitor · Standalone file monitoring process.
rust_antivirus/src/bin/file_monitor.rs - Memory monitor · Standalone memory monitoring process.
rust_antivirus/src/bin/memory_monitor.rs
Shared infra
Common configuration, IPC, and support modules used across the system.
- Config · Centralized runtime settings and detection parameters.
rust_antivirus/src/config/mod.rs - IPC · Inter-process communication boundary for events and control messages.
rust_antivirus/src/ipc/mod.rs - Messages · Structured IPC message definitions.
rust_antivirus/src/ipc/message.rs - Named pipe · Windows named-pipe transport for process-to-process communication.
rust_antivirus/src/ipc/named_pipe.rs - Utils · Shared helper routines used across the application.
rust_antivirus/src/utils.rs - Config pack · Deployment bundle containing the packaged runtime configuration and executables.
rust_antivirus/Configuration.zip
Connections 18
- Main → Engine: boots · Main startup initializes the core engine.
- Main → GUI: hosts · Main application launches the desktop UI.
- Main → Process mgr: supervises · Main process manages helper process lifecycle.
- Main → Config: loads · Startup reads runtime configuration.
- Main → IPC: connects · Main process establishes IPC channels.
- Engine → Process scan: uses · Engine delegates realtime process monitoring.
- Engine → Memory scan: uses · Engine delegates memory analysis.
- Engine → IPC: receives · Engine consumes worker events and commands.
- Engine → Config: applies · Detection policy is driven by configuration.
- Engine → Utils: shares · Engine reuses common helpers.
- Process mgr → File monitor: starts · Supervisor launches the file monitor binary.
- Process mgr → Memory monitor: starts · Supervisor launches the memory monitor binary.
- File monitor → Named pipe: reports · File monitor sends events over named pipes.
- Memory monitor → Named pipe: reports · Memory monitor sends events over named pipes.
- Named pipe → Messages: encodes · Transport carries structured messages.
- IPC → Named pipe: uses · IPC layer binds to named-pipe transport.
- IPC → Messages: defines · IPC module defines message contracts.
- Config pack → Config: packages · Deployment bundle includes runtime config and assets.