# find-vulnerabilities/rust-antivirus architecture

> Architecture diagram of the GitHub repository find-vulnerabilities/rust-antivirus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/find-vulnerabilities/rust-antivirus
- Repository: https://github.com/find-vulnerabilities/rust-antivirus

## Overview

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: [`rust_antivirus/src/engine.rs`](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/engine.rs) (Engine), [`rust_antivirus/src/main.rs`](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/main.rs) (Main), [`rust_antivirus/src/ipc/mod.rs`](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/ipc/mod.rs) (IPC), [`rust_antivirus/src/ipc/named_pipe.rs`](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/ipc/named_pipe.rs) (Named pipe)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Main app"]
  node_main["Main<br/>entrypoint<br/>[main.rs]"]
  node_engine["Engine<br/>coordination<br/>[engine.rs]"]
  node_gui["GUI<br/>desktop ui<br/>[gui.rs]"]
  node_subprocess["Process mgr<br/>supervision"]
  node_process_monitor["Process scan<br/>monitoring<br/>[process_monitor.rs]"]
  node_memory_scanner["Memory scan<br/>analysis<br/>[memory_scanner.rs]"]
end

subgraph group_workers["Worker processes"]
  node_file_worker["File monitor<br/>worker binary<br/>[file_monitor.rs]"]
  node_memory_worker["Memory monitor<br/>worker binary<br/>[memory_monitor.rs]"]
end

subgraph group_shared["Shared infra"]
  node_config["Config<br/>[mod.rs]"]
  node_ipc_mod["IPC<br/>messaging<br/>[mod.rs]"]
  node_ipc_msg["Messages<br/>protocol<br/>[message.rs]"]
  node_ipc_pipe["Named pipe<br/>transport<br/>[named_pipe.rs]"]
  node_utils["Utils<br/>support<br/>[utils.rs]"]
  node_config_bundle[("Config pack<br/>asset bundle<br/>[Configuration.zip]")]
end

node_main -->|"boots"| node_engine
node_main -->|"hosts"| node_gui
node_main -->|"supervises"| node_subprocess
node_main -->|"loads"| node_config
node_main -->|"connects"| node_ipc_mod
node_engine -->|"uses"| node_process_monitor
node_engine -->|"uses"| node_memory_scanner
node_engine -->|"receives"| node_ipc_mod
node_engine -->|"applies"| node_config
node_engine -->|"shares"| node_utils
node_subprocess -->|"starts"| node_file_worker
node_subprocess -->|"starts"| node_memory_worker
node_file_worker -->|"reports"| node_ipc_pipe
node_memory_worker -->|"reports"| node_ipc_pipe
node_ipc_pipe -->|"encodes"| node_ipc_msg
node_ipc_mod -->|"uses"| node_ipc_pipe
node_ipc_mod -->|"defines"| node_ipc_msg
node_config_bundle -->|"packages"| node_config

click node_main "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/main.rs"
click node_engine "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/engine.rs"
click node_gui "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/gui.rs"
click node_subprocess "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/subprocess_manager.rs"
click node_process_monitor "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/process_monitor.rs"
click node_memory_scanner "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/memory_scanner.rs"
click node_config "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/config/mod.rs"
click node_ipc_mod "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/ipc/mod.rs"
click node_ipc_msg "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/ipc/message.rs"
click node_ipc_pipe "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/ipc/named_pipe.rs"
click node_utils "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/utils.rs"
click node_config_bundle "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/Configuration.zip"
click node_file_worker "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/bin/file_monitor.rs"
click node_memory_worker "https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/bin/memory_monitor.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_engine,node_gui,node_subprocess,node_process_monitor,node_memory_scanner toneBlue
class node_file_worker,node_memory_worker toneAmber
class node_config,node_ipc_mod,node_ipc_msg,node_ipc_pipe,node_utils,node_config_bundle toneMint
```

## Components

### Main app

Primary desktop application that loads configuration, drives policy, and hosts the GUI.

- [Main](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/main.rs): entrypoint · Desktop application startup and top-level orchestration. · `rust_antivirus/src/main.rs`
- [Engine](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/engine.rs): coordination · Central policy and detection coordination layer. · `rust_antivirus/src/engine.rs`
- [GUI](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/gui.rs): desktop ui · Local egui-based user interface and control surface. · `rust_antivirus/src/gui.rs`
- [Process mgr](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/subprocess_manager.rs): supervision · Starts and supervises helper executables. · `rust_antivirus/src/subprocess_manager.rs`
- [Process scan](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/process_monitor.rs): monitoring · Realtime process inspection and suspicious activity detection. · `rust_antivirus/src/process_monitor.rs`
- [Memory scan](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/memory_scanner.rs): analysis · 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](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/bin/file_monitor.rs): worker binary · Standalone file monitoring process. · `rust_antivirus/src/bin/file_monitor.rs`
- [Memory monitor](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/bin/memory_monitor.rs): worker binary · Standalone memory monitoring process. · `rust_antivirus/src/bin/memory_monitor.rs`

### Shared infra

Common configuration, IPC, and support modules used across the system.

- [Config](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/config/mod.rs): runtime config · Centralized runtime settings and detection parameters. · `rust_antivirus/src/config/mod.rs`
- [IPC](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/ipc/mod.rs): messaging · Inter-process communication boundary for events and control messages. · `rust_antivirus/src/ipc/mod.rs`
- [Messages](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/ipc/message.rs): protocol · Structured IPC message definitions. · `rust_antivirus/src/ipc/message.rs`
- [Named pipe](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/ipc/named_pipe.rs): transport · Windows named-pipe transport for process-to-process communication. · `rust_antivirus/src/ipc/named_pipe.rs`
- [Utils](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/src/utils.rs): support · Shared helper routines used across the application. · `rust_antivirus/src/utils.rs`
- [Config pack](https://github.com/find-vulnerabilities/rust-antivirus/blob/main/rust_antivirus/Configuration.zip): asset bundle · Deployment bundle containing the packaged runtime configuration and executables. · `rust_antivirus/Configuration.zip`

## Connections

- 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.
