# gharty03/conti-ransomware architecture

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

- Interactive diagram: https://gitdiagram.com/gharty03/conti-ransomware
- Repository: https://github.com/gharty03/conti-ransomware

## Overview

##### Project type and purpose
- This is a native C++ “ransomware suite” containing two main executables:
- locker.exe – the file‐encryption (ransomware) component
- decryptor.exe – the decryption/recovery component
- There’s also a small “builder” project that ties the C++ projects together into Visual Studio solutions.

##### Top‐level components from the file tree
a. builder/             → compilation orchestrator (VCXPROJ)
b. locker/              → the ransomware “locker” binary
c. decryptor/           → the decryption binary
d. Debug/, Release/     → build outputs for both components
e. Visual Studio files  → .sln, .vcxproj, filters, and the .vs folder

##### Key sub-components inside each binary
- GlobalParameters       – holds configuration passed at runtime
- NetworkScanner         – scans local networks (likely for domain targets)
- DiskEnumerator         – finds local or mapped drives
- Filesystem             – walks directories, enumerates files
- Search                 – filters target files by extension/path rules
- Queue                  – central task queue for encryption/decryption jobs
- ThreadPool             – worker threads that execute queued tasks in parallel
- Memory                 – memory‐related routines (heap, buffers)
- AntiHooks              – hooks API functions to defeat AV/emulate original code
- ProcessKiller          – terminates processes that might lock files or block I/O
- ChaCha20 engine        – encryption/decryption algorithm (chacha20 subfolder)
- Logs                   – writes activity logs for recovery/decryption

##### Relationships & data flows
- builder → compiles → locker.exe & decryptor.exe
- At runtime, locker.exe:
– reads GlobalParameters ← CLI or config
– passes parameters → NetworkScanner + DiskEnumerator
– enumerated file paths → Filesystem → Search → produces file list
– enqueues each file in Queue
– ThreadPool workers dequeue tasks → call Encryption Engine (ChaCha20)
– AntiHooks intercept suspicious API calls; ProcessKiller kills locking processes
– encrypted files + metadata written to disk; Logs updated
- decryptor.exe does the mirror flow: reads Logs, rebuilds queue of encrypted files, uses ChaCha20 to restore original data

##### Architectural patterns & design principles
– Modular, component‐based design (each subsystem has its own header + .cpp)
– Producer/consumer via Queue + ThreadPool for parallel work
– Separation of concerns: scanning vs encryption vs logging vs process management
– Use of a single core crypto engine (ChaCha20) shared by both locker & decryptor

– Clear, human‐readable labels for each component
– Boundaries showing “locker.exe” vs “decryptor.exe” vs “builder” vs “OS layer”

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Builder Layer
    subgraph "Build Pipeline"
        builder["Builder (build orchestrator)"]:::build
        projLocker["locker.vcxproj"]:::build
        projDecryptor["decryptor.vcxproj"]:::build
        builder -.-> projLocker
        builder -.-> projDecryptor
    end

    %% Locker Binary
    subgraph "locker.exe"
        direction TB
        subgraph "Input & Configuration"
            GP_L["GlobalParameters"]:::ioModules
        end
        subgraph "Discovery"
            NS_L["NetworkScanner"]:::ioModules
            DE_L["DiskEnumerator"]:::ioModules
            FS_L["Filesystem"]:::ioModules
            S_L["Search"]:::ioModules
        end
        subgraph "Task Orchestration"
            Q_L["Queue"]:::orchestration
            TP_L["ThreadPool"]:::orchestration
        end
        subgraph "Core Logic"
            C20_L["ChaCha20 Engine"]:::core
        end
        subgraph "Support Services"
            AH_L["AntiHooks"]:::support
            PK_L["ProcessKiller"]:::support
            M_L["Memory"]:::support
            L_L["Logs"]:::support
        end
    end

    %% Decryptor Binary
    subgraph "decryptor.exe"
        direction TB
        subgraph "Input & Configuration"
            GP_D["GlobalParameters"]:::ioModules
        end
        subgraph "Discovery"
            NS_D["NetworkScanner"]:::ioModules
            DE_D["DiskEnumerator"]:::ioModules
            FS_D["Filesystem"]:::ioModules
            S_D["Search"]:::ioModules
        end
        subgraph "Task Orchestration"
            Q_D["Queue"]:::orchestration
            TP_D["ThreadPool"]:::orchestration
        end
        subgraph "Core Logic"
            C20_D["ChaCha20 Engine"]:::core
        end
        subgraph "Support Services"
            M_D["Memory"]:::support
            L_D["Logs"]:::support
        end
    end

    %% OS / WinAPI Layer
    subgraph "OS / WinAPI"
        OS["File I/O, Process API, Network API"]:::os
    end

    %% Data Flows Locker
    GP_L -->|"params"| NS_L
    GP_L -->|"params"| DE_L
    NS_L -->|"scanned paths"| FS_L
    DE_L -->|"drives"| FS_L
    FS_L -->|"directories"| S_L
    S_L -->|"file list"| Q_L
    Q_L -->|"tasks"| TP_L
    TP_L -->|"encrypt(data)"| C20_L
    AH_L -->|"intercepts API"| OS
    PK_L -->|"kills blocking processes"| OS
    C20_L -->|"encrypted files"| OS
    C20_L -->|"metadata"| L_L
    L_L -->|"logs"| OS

    %% Data Flows Decryptor
    GP_D --> NS_D
    NS_D --> FS_D
    DE_D --> FS_D
    FS_D --> S_D
    S_D --> Q_D
    Q_D --> TP_D
    TP_D --> C20_D
    C20_D --> OS
    C20_D --> L_D

    %% Build to Binaries
    projLocker -->|"builds"| locker.exe
    projDecryptor -->|"builds"| decryptor.exe

    %% Click Events
    click builder "https://github.com/gharty03/conti-ransomware/blob/main/builder/builder.vcxproj"
    click projLocker "https://github.com/gharty03/conti-ransomware/blob/main/locker/locker.vcxproj"
    click projDecryptor "https://github.com/gharty03/conti-ransomware/blob/main/decryptor/decryptor.vcxproj"
    click GP_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/global_parameters.h"
    click NS_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/network_scanner.h"
    click DE_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/disks.cpp"
    click FS_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/filesystem.h"
    click S_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/search.cpp"
    click Q_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/queue.h"
    click TP_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/threadpool.h"
    click M_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/memory.h"
    click AH_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/antihook/antihooks.h"
    click PK_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/process_killer.h"
    click C20_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/chacha20/chacha.h"
    click L_L "https://github.com/gharty03/conti-ransomware/blob/main/locker/logs.h"

    %% Styles
    classDef ioModules fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef orchestration fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef core fill:#FFCCCC,stroke:#000,stroke-width:1px;
    classDef support fill:#FFFFCC,stroke:#000,stroke-width:1px;
    classDef os fill:#D3D3D3,stroke:#000,stroke-width:1px;
    classDef build fill:#E0E0E0,stroke:#000,stroke-width:1px;
```
