# bcicdis/security architecture

> Architecture diagram of the GitHub repository bcicdis/security, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bcicdis/security
- Repository: https://github.com/bcicdis/security

## Overview

##### Project type and purpose
- From the README (“System Security Monitoring”) and file tree, this is an open‐source security tool comprising:
- A system monitoring daemon written in Ada (src/monitor_daemon.adb, default.gpr, obj/)
- A stand-alone Python “military_grade_encryption” module for encrypting/decrypting data (cryptography/military_grade_encryption/)
- Purpose: continuously collect system events/logs, provide military‐grade encryption utilities to secure those logs or other files.

##### File structure
- Top‐level:
- src/ & obj/ → Ada sources, compiled artifacts, logs, GNAT project file
- cryptography/military_grade_encryption/ → Python CLI tools (encrypt.py, decrypt.py), package (encryptor/) and sample data
- default.gpr → Ada build configuration
- Patterns:
- Separate language boundaries (Ada vs. Python)
- CLI + library structure in Python (encryptor package under utils & aes_encryptor)
- Build artifacts isolated under obj/

a. Main components
1. Monitor Daemon (Ada)
– Source: src/monitor_daemon.adb
– Build: default.gpr → obj/monitor_daemon.exe
– Output: system event logs (obj/monitor_log.txt)
2. Encryption CLI (Python)
– encrypt.py / decrypt.py
– Uses encryptor library: aes_encryptor.py + utils.py
3. AES Encryptor Library (Python package)
4. Data Store / Filesystem
– Plain logs, sample.txt, encrypted files (.enc)
5. (Optional) External Systems / Admin Console
– Operators invoke Python scripts on the logs or feed files to the daemon.

b. Relationships & data flow
– Monitor Daemon → writes plain-text logs → Data Store
– Operator/Admin → runs encrypt.py against logs → calls AES Encryptor Library → produces encrypted .enc files → back to Data Store
– decrypt.py reverses the flow for analysis
– (Future) Daemon could call encryption library directly via subprocess or API

c. Architectural patterns & principles
– Separation of concerns:
- Monitoring (Ada)
- Encryption (Python CLI + library)
– Layered approach: CLI layer atop a reusable library layer
– Clear build vs. runtime separation (obj/ vs. src/cryptography)
– Single Responsibility Principle: each component focuses on one aspect

d. Key technologies & frameworks
– Ada / GNAT (default.gpr) for high-integrity daemon
– Python 3.x for encryption utilities
– AES algorithm (in aes_encryptor.py)
– Standard filesystem as data store

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Ada Monitoring Layer
    subgraph "Ada Monitoring" 
        direction TB
        MD_src["Monitor Daemon Source"]:::ada
        MD_build["Daemon Build Config"]:::ada
        MD_artifact["Compiled Daemon & Logs"]:::ada
        MD_src -->|"configured by"| MD_build
        MD_build -->|"builds"| MD_artifact
    end

    %% Data Store for Plain Logs
    DataStore_plain["Plain Logs & Data Store"]:::datastore

    %% Python Encryption CLI Layer
    subgraph "Python Encryption CLI" 
        direction TB
        CLI_encrypt["encrypt.py"]:::python
        CLI_decrypt["decrypt.py"]:::python

        subgraph "Encryptor Library"
            direction TB
            AES["aes_encryptor.py"]:::python
            Utils["utils.py"]:::python
        end

        CLI_encrypt -->|"uses"| AES
        CLI_encrypt -->|"uses"| Utils
        CLI_decrypt -->|"uses"| AES
        CLI_decrypt -->|"uses"| Utils
    end

    %% Encrypted Data Store
    DataStore_enc["Encrypted Files Store"]:::datastore

    %% Operator/Admin
    Admin["Operator/Admin"]:::external

    %% Data Flows
    MD_artifact -->|".txt"| DataStore_plain
    Admin -->|"runs"| CLI_encrypt
    Admin -->|"runs"| CLI_decrypt
    CLI_encrypt -->|".enc"| DataStore_enc
    DataStore_enc -->|".enc"| CLI_decrypt
    DataStore_plain -->|".txt"| CLI_encrypt
    DataStore_plain -->|".txt"| CLI_decrypt

    %% Click Events
    click MD_src "https://github.com/bcicdis/security/blob/main/src/monitor_daemon.adb"
    click MD_build "https://github.com/bcicdis/security/blob/main/default.gpr"
    click MD_artifact "https://github.com/bcicdis/security/tree/main/obj/"
    click CLI_encrypt "https://github.com/bcicdis/security/blob/main/cryptography/military_grade_encryption/encrypt.py"
    click CLI_decrypt "https://github.com/bcicdis/security/blob/main/cryptography/military_grade_encryption/decrypt.py"
    click AES "https://github.com/bcicdis/security/tree/main/cryptography/military_grade_encryption/encryptor/"
    click Utils "https://github.com/bcicdis/security/tree/main/cryptography/military_grade_encryption/encryptor/"
    click DataStore_plain "https://github.com/bcicdis/security/tree/main/cryptography/military_grade_encryption/data/"
    click DataStore_enc "https://github.com/bcicdis/security/tree/main/cryptography/military_grade_encryption/data/"

    %% Styles
    classDef ada fill:#cfe2f3,stroke:#0366d6,color:#000
    classDef python fill:#d9ead3,stroke:#6aa84f,color:#000
    classDef datastore fill:#f9cb9c,stroke:#b45f06,color:#000
    classDef external fill:#eeeeee,stroke:#aaaaaa,color:#000
```
