# mazenturk201/turk-ransomware architecture

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

- Interactive diagram: https://gitdiagram.com/mazenturk201/turk-ransomware
- Repository: https://github.com/mazenturk201/turk-ransomware

## Overview

##### Project type and purpose
- This is a small Python-based “ransomware” / screen-locker tool for Windows, intended for penetration-testing demos.
- It consists of two scripts:
- Turk Ransowm.py – the main locker application that grabs the screen, displays a full-screen GUI, intercepts keystrokes, and enforces the lock.
- Unlock.py – the solver that listens for the “Delete” key and terminates the lock.
- The requirements.txt (likely including tkinter) and README confirm a pure-Python desktop tool, no network or server components.

##### File structure
- Top level:
- README.md – project overview, usage instructions
- Turk Ransowm.py – entry point / locker logic
- Unlock.py – unlock logic
- requirements.txt – external Python dependencies (e.g., tkinter)
- No frontend/backend split, no database, no external services beyond the Python runtime and OS APIs.
- Key architectural choice: single-process Python app with two modules, one for locking, one for unlocking via key listener.

##### README for additional insights
- Confirms use of Python3 and Linux dependency note on python3-tk (GUI toolkit).
- Usage: run the main script, it locks the device, “Delete” key triggers Unlock.py.
- No mention of encryption or data exfiltration—primarily a demo screen lock.

a. Main components to show:
- Python Runtime Environment (Python3 interpreter)
- Operating System (Windows desktop environment, with OS APIs for windowing and input)
- GUI module (tkinter window that covers screen)
- Event Handler (keyboard listener for “Delete” key)
- Unlock module (Unlock.py logic to close the GUI and exit)
- (Optional) Requirements loader (pip installs dependencies)
b. Relationships & interactions:
1. User invokes “python3 Turk Ransowm.py” → Python Runtime loads main script.
2. Main script imports tkinter, spawns full-screen window.
3. Event Handler is registered on the window to capture all keystrokes.
4. On any key: if key is “Delete”, call Unlock.py (spawn second Python process or invoke its function)
5. Unlock.py signals the GUI to close / process to terminate, restoring user control.
c. Architectural patterns / principles:
- Single process with modularized sub-component for unlocking.
- Event-driven GUI pattern (register listeners, callback on key events).
- OS abstraction: uses Python standard library and tkinter for cross-platform GUI.
d. Key technologies & libraries:
- Python 3 interpreter
- tkinter (for GUI and input capture)
- Standard library modules (subprocess or os for invoking Unlock.py)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entities and Dependencies
    subgraph "External Dependencies"
        Python["Python 3 Interpreter"]:::external
        OS["OS Windowing & Input APIs (tkinter)"]:::external
    end

    User(("User")):::external

    %% Project Components
    subgraph "Project Files"
        Main["Turk Ransomware (Main)"]:::core
        EventHandler["Event Handler (Key Listener)"]:::core
        Unlock["Unlock Module"]:::core
        Requirements["requirements.txt"]:::external
        README["README.md"]:::external
    end

    %% Interactions
    User -->|"runs 'python Turk Ransowm.py'"| Python
    Requirements -->|"pip install dependencies"| Python
    Python -->|"loads main script"| Main
    Main -->|"imports tkinter"| OS
    Main -->|"spawns full-screen GUI"| OS
    Main -->|"registers key event handler"| EventHandler
    OS -->|"key press events"| EventHandler
    EventHandler -->|"Delete key detected"| Unlock
    Unlock -->|"signals GUI to close"| Main
    Main -->|"closes window and exits"| Python

    %% Click Events
    click Main "https://github.com/mazenturk201/turk-ransomware/blob/main/Turk Ransowm.py"
    click Unlock "https://github.com/mazenturk201/turk-ransomware/blob/main/Unlock.py"
    click Requirements "https://github.com/mazenturk201/turk-ransomware/blob/main/requirements.txt"
    click README "https://github.com/mazenturk201/turk-ransomware/blob/main/README.md"

    %% Styles
    classDef core fill:#bbf,stroke:#000,stroke-width:1px
    classDef external fill:#ccc,stroke:#000,stroke-width:1px
```
