# vvarma8111/python-keylogger-with-aes-gcm-encryption architecture

> Architecture diagram of the GitHub repository vvarma8111/python-keylogger-with-aes-gcm-encryption, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vvarma8111/python-keylogger-with-aes-gcm-encryption
- Repository: https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption

## Overview

This repository is a keyboard-capture and encrypted-log prototype. Its main workflow listens for keyboard events, normalizes and appends them to a plaintext log, then encrypts that log when Escape is released. A separate command-line path encrypts or decrypts files. The graph reflects the README and sampled source; it does not infer behavior from the checked-in log artifacts, and it omits unsampled implementation details.

Main entry points: [`aes_encrypt_decrypt.py`](https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/aes_encrypt_decrypt.py) (Encrypt file), [`mainfile.py`](https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/mainfile.py) (Event listener)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Keyboard capture"]
  node_listener["Event listener<br/>[mainfile.py]"]
  node_capture_callback["Capture and format keys<br/>[mainfile.py]"]
  node_stop_callback["Escape shutdown<br/>[mainfile.py]"]
  node_plain_log["Plaintext log"]
end

subgraph group_crypto["File encryption"]
  node_encrypt_file["Encrypt file"]
  node_decrypt_file["Decrypt file"]
  node_derive_key["Derive password key"]
  node_encrypted_log["Encrypted log"]
end

subgraph group_cli["Command-line tools"]
  node_cli_dispatch["CLI dispatch"]
  node_encrypted_input["Encrypted input file"]
  node_decrypted_output["Decrypted output file"]
end

node_keyboard(("Keyboard input"))
node_cli_user(("CLI user"))

node_keyboard -->|"emits events"| node_listener
node_listener -->|"press callback"| node_capture_callback
node_listener -->|"release callback"| node_stop_callback
node_capture_callback -->|"appends keys"| node_plain_log
node_stop_callback -->|"appends stop marker"| node_plain_log
node_stop_callback -->|"calls on Escape"| node_encrypt_file
node_encrypt_file -->|"reads input"| node_plain_log
node_encrypt_file -->|"derives password key"| node_derive_key
node_encrypt_file -->|"writes ciphertext"| node_encrypted_log
node_cli_user -->|"supplies command"| node_cli_dispatch
node_cli_dispatch -->|"dispatches encrypt"| node_encrypt_file
node_cli_dispatch -->|"dispatches decrypt"| node_decrypt_file
node_decrypt_file -->|"reads input"| node_encrypted_input
node_decrypt_file -->|"derives password key"| node_derive_key
node_decrypt_file -->|"writes plaintext"| node_decrypted_output

click node_listener "https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/mainfile.py"
click node_capture_callback "https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/mainfile.py"
click node_stop_callback "https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/mainfile.py"
click node_encrypt_file "https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/aes_encrypt_decrypt.py"
click node_decrypt_file "https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/aes_encrypt_decrypt.py"
click node_derive_key "https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/aes_encrypt_decrypt.py"
click node_cli_dispatch "https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/aes_encrypt_decrypt.py"

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_listener,node_capture_callback,node_stop_callback,node_plain_log,node_cli_user toneBlue
class node_encrypt_file,node_decrypt_file,node_derive_key,node_encrypted_log toneAmber
class node_cli_dispatch,node_encrypted_input,node_decrypted_output toneMint
class node_keyboard toneIndigo
```

## Components

### Keyboard capture

- [Event listener](https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/mainfile.py): `mainfile.py`
- [Capture and format keys](https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/mainfile.py): `mainfile.py`
- [Escape shutdown](https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/mainfile.py): `mainfile.py`
- **Plaintext log**

### File encryption

- [Encrypt file](https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/aes_encrypt_decrypt.py): `aes_encrypt_decrypt.py`
- [Decrypt file](https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/aes_encrypt_decrypt.py): `aes_encrypt_decrypt.py`
- [Derive password key](https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/aes_encrypt_decrypt.py): `aes_encrypt_decrypt.py`
- **Encrypted log**

### Command-line tools

- [CLI dispatch](https://github.com/vvarma8111/python-keylogger-with-aes-gcm-encryption/blob/main/aes_encrypt_decrypt.py): `aes_encrypt_decrypt.py`
- **Encrypted input file**
- **Decrypted output file**

### Other components

- **Keyboard input**
- **CLI user**

## Connections

- Keyboard input → Event listener: emits events (evidence: `mainfile.py`)
- Event listener → Capture and format keys: press callback (evidence: `mainfile.py`)
- Event listener → Escape shutdown: release callback (evidence: `mainfile.py`)
- Capture and format keys → Plaintext log: appends keys (evidence: `mainfile.py`)
- Escape shutdown → Plaintext log: appends stop marker (evidence: `mainfile.py`)
- Escape shutdown → Encrypt file: calls on Escape (evidence: `mainfile.py`)
- Encrypt file → Plaintext log: reads input (evidence: `aes_encrypt_decrypt.py`)
- Encrypt file → Derive password key: derives password key (evidence: `aes_encrypt_decrypt.py`)
- Encrypt file → Encrypted log: writes ciphertext (evidence: `aes_encrypt_decrypt.py`)
- CLI user → CLI dispatch: supplies command (evidence: `aes_encrypt_decrypt.py`)
- CLI dispatch → Encrypt file: dispatches encrypt (evidence: `aes_encrypt_decrypt.py`)
- CLI dispatch → Decrypt file: dispatches decrypt (evidence: `aes_encrypt_decrypt.py`)
- Decrypt file → Encrypted input file: reads input (evidence: `aes_encrypt_decrypt.py`)
- Decrypt file → Derive password key: derives password key (evidence: `aes_encrypt_decrypt.py`)
- Decrypt file → Decrypted output file: writes plaintext (evidence: `aes_encrypt_decrypt.py`)
