# bagpotato/gg-ramsomware architecture

> Architecture diagram of the GitHub repository bagpotato/gg-ramsomware, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bagpotato/gg-ramsomware
- Repository: https://github.com/bagpotato/gg-ramsomware

## Overview

This is an educational Windows ransomware with two runtime binaries: `gg` discovers volumes, encrypts eligible files, writes ransom notes and can change the wallpaper; `unlock` scans supplied or available drive roots and restores `.locked` files. The main excerpts show the principal orchestration and several internal stages, but omit some wiring; the graph therefore includes only evidenced relationships. The README identifies the product but does not document further capabilities.

Main entry points: [`src/main.rs`](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs) (Encrypt runner), [`src/bin/unlock.rs`](https://github.com/bagpotato/gg-ramsomware/blob/main/src/bin/unlock.rs) (Unlock runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_attack["Encryption run"]
  node_encrypt_app["Encrypt runner<br/>[main.rs]"]
  node_options["Run options<br/>[main.rs]"]
  node_volume_scan["Volume discovery<br/>[main.rs]"]
  node_file_collect["File collection<br/>[main.rs]"]
  node_key_derive["Key derivation<br/>[main.rs]"]
  node_file_encrypt["File encryption<br/>[main.rs]"]
end

subgraph group_presentation["Victim presentation"]
  node_ransom_notes["Ransom notes<br/>[main.rs]"]
  node_wallpaper_build["Wallpaper builder<br/>[main.rs]"]
  node_wallpaper_set["Wallpaper setter<br/>[main.rs]"]
end

subgraph group_recovery["File recovery"]
  node_unlock_app["Unlock runner<br/>[unlock.rs]"]
  node_decrypt_file["File decryption<br/>[unlock.rs]"]
end

node_operator(("Operator"))
node_image_source(("Image source"))

node_operator -->|"starts"| node_encrypt_app
node_encrypt_app -->|"parses"| node_options
node_encrypt_app -->|"discovers"| node_volume_scan
node_encrypt_app -->|"collects"| node_file_collect
node_encrypt_app -->|"derives key"| node_key_derive
node_encrypt_app -->|"encrypts files"| node_file_encrypt
node_encrypt_app -->|"writes notes"| node_ransom_notes
node_encrypt_app -->|"builds wallpaper"| node_wallpaper_build
node_wallpaper_build -->|"fetches image"| node_image_source
node_encrypt_app -->|"sets wallpaper"| node_wallpaper_set
node_wallpaper_build -->|"provides image"| node_wallpaper_set
node_operator -->|"starts"| node_unlock_app
node_unlock_app -->|"decrypts matches"| node_decrypt_file

click node_encrypt_app "https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs"
click node_options "https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs"
click node_volume_scan "https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs"
click node_file_collect "https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs"
click node_key_derive "https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs"
click node_file_encrypt "https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs"
click node_ransom_notes "https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs"
click node_wallpaper_build "https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs"
click node_wallpaper_set "https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs"
click node_unlock_app "https://github.com/bagpotato/gg-ramsomware/blob/main/src/bin/unlock.rs"
click node_decrypt_file "https://github.com/bagpotato/gg-ramsomware/blob/main/src/bin/unlock.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_encrypt_app,node_options,node_volume_scan,node_file_collect,node_key_derive,node_file_encrypt toneBlue
class node_ransom_notes,node_wallpaper_build,node_wallpaper_set toneAmber
class node_unlock_app,node_decrypt_file toneMint
class node_operator,node_image_source toneIndigo
```

## Components

### Encryption run

- [Encrypt runner](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs): `src/main.rs`
- [Run options](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs): `src/main.rs`
- [Volume discovery](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs): `src/main.rs`
- [File collection](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs): `src/main.rs`
- [Key derivation](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs): `src/main.rs`
- [File encryption](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs): `src/main.rs`

### Victim presentation

- [Ransom notes](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs): `src/main.rs`
- [Wallpaper builder](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs): `src/main.rs`
- [Wallpaper setter](https://github.com/bagpotato/gg-ramsomware/blob/main/src/main.rs): `src/main.rs`

### File recovery

- [Unlock runner](https://github.com/bagpotato/gg-ramsomware/blob/main/src/bin/unlock.rs): `src/bin/unlock.rs`
- [File decryption](https://github.com/bagpotato/gg-ramsomware/blob/main/src/bin/unlock.rs): `src/bin/unlock.rs`

### Other components

- **Operator**
- **Image source**

## Connections

- Operator → Encrypt runner: starts (evidence: `src/main.rs`)
- Encrypt runner → Run options: parses (evidence: `src/main.rs`)
- Encrypt runner → Volume discovery: discovers (evidence: `src/main.rs`)
- Encrypt runner → File collection: collects (evidence: `src/main.rs`)
- Encrypt runner → Key derivation: derives key (evidence: `src/main.rs`)
- Encrypt runner → File encryption: encrypts files (evidence: `src/main.rs`)
- Encrypt runner → Ransom notes: writes notes (evidence: `src/main.rs`)
- Encrypt runner → Wallpaper builder: builds wallpaper (evidence: `src/main.rs`)
- Wallpaper builder → Image source: fetches image (evidence: `src/main.rs`)
- Encrypt runner → Wallpaper setter: sets wallpaper (evidence: `src/main.rs`)
- Wallpaper builder → Wallpaper setter: provides image (evidence: `src/main.rs`)
- Operator → Unlock runner: starts (evidence: `src/bin/unlock.rs`)
- Unlock runner → File decryption: decrypts matches (evidence: `src/bin/unlock.rs`)
