# shehzade/peeping-tom architecture

> Architecture diagram of the GitHub repository shehzade/peeping-tom, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shehzade/peeping-tom
- Repository: https://github.com/shehzade/peeping-tom

## Overview

Peeping-tom is a Windows keystroke-monitoring client paired with a Python listener. Its documented flow is keystroke capture, periodic encrypted callback, server-side decryption, and log collection; the server also provides key generation. The sampled client code shows startup and AES encryption, while the README documents the callback and server workflow. Keyboard-hook internals and server request handling were not excerpted, so those connections are shown only where documented, with evidence limits noted in the graph.

Main entry points: [`peeping-client/peeping-client.cpp`](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/peeping-client.cpp) (Client startup), [`toms-server/toms_server.py`](https://github.com/shehzade/peeping-tom/blob/master/toms-server/toms_server.py) (Server listener), [`peeping-client/APIHook.h`](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/APIHook.h) (Keyboard hook), [`peeping-client/Exfiltrate.h`](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Exfiltrate.h) (HTTP callback)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Windows client"]
  node_client_runtime["Client startup<br/>[peeping-client.cpp]"]
  node_hook["Keyboard hook<br/>[APIHook.h]"]
  node_capture["Key capture<br/>[Keyboard.h]"]
  node_timer["Callback timer<br/>[Timer.h]"]
  node_transport["HTTP callback<br/>[Exfiltrate.h]"]
end

subgraph group_crypto["Encryption"]
  node_transform["AES encryption<br/>[Transformer.h]"]
  node_cryptopp["Crypto++ primitives"]
end

subgraph group_server["Python server"]
  node_listener["Server listener<br/>[toms_server.py]"]
  node_decrypt["Log decryption<br/>[decryption.py]"]
  node_collection["Log collection<br/>[collection.py]"]
  node_keygen["Key generation<br/>[key_generation.py]"]
end

subgraph group_support["Client support"]
  node_auxiliary["Client utilities<br/>[Auxiliary.h]"]
  node_io["File operations<br/>[IO.h]"]
end

node_target(("Target system"))
node_tunnel["Public tunnel"]
node_logfile["Keylog file"]

node_target -.->|"receives key events"| node_hook
node_client_runtime -->|"installs hook"| node_hook
node_hook -.->|"captures keys"| node_capture
node_hook -.->|"starts callback timer"| node_timer
node_timer -.->|"triggers callback"| node_transport
node_transport -.->|"encrypts payload"| node_transform
node_transform -->|"uses primitives"| node_cryptopp
node_client_runtime -->|"sets encryption key"| node_transform
node_transport -.->|"sends callback"| node_tunnel
node_tunnel -.->|"forwards request"| node_listener
node_listener -->|"uses decryption"| node_decrypt
node_listener -->|"routes received logs"| node_collection
node_decrypt -.->|"provides plaintext logs"| node_collection
node_collection -->|"writes logs"| node_logfile
node_listener -->|"offers keygen mode"| node_keygen
node_client_runtime -->|"uses utilities"| node_auxiliary
node_client_runtime -->|"creates app-data directory"| node_io
node_auxiliary -->|"uses file operations"| node_io

click node_client_runtime "https://github.com/shehzade/peeping-tom/blob/master/peeping-client/peeping-client.cpp"
click node_hook "https://github.com/shehzade/peeping-tom/blob/master/peeping-client/APIHook.h"
click node_capture "https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Keyboard.h"
click node_timer "https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Timer.h"
click node_transform "https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Transformer.h"
click node_cryptopp "https://github.com/shehzade/peeping-tom/tree/master/peeping-client/crypto-headers"
click node_transport "https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Exfiltrate.h"
click node_listener "https://github.com/shehzade/peeping-tom/blob/master/toms-server/toms_server.py"
click node_decrypt "https://github.com/shehzade/peeping-tom/blob/master/toms-server/decryption.py"
click node_collection "https://github.com/shehzade/peeping-tom/blob/master/toms-server/collection.py"
click node_keygen "https://github.com/shehzade/peeping-tom/blob/master/toms-server/key_generation.py"
click node_auxiliary "https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Auxiliary.h"
click node_io "https://github.com/shehzade/peeping-tom/blob/master/peeping-client/IO.h"

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_client_runtime,node_hook,node_capture,node_timer,node_transport toneBlue
class node_transform,node_cryptopp toneAmber
class node_listener,node_decrypt,node_collection,node_keygen toneMint
class node_auxiliary,node_io toneRose
class node_target,node_tunnel,node_logfile toneIndigo
```

## Components

### Windows client

- [Client startup](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/peeping-client.cpp): `peeping-client/peeping-client.cpp`
- [Keyboard hook](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/APIHook.h): `peeping-client/APIHook.h`
- [Key capture](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Keyboard.h): `peeping-client/Keyboard.h`
- [Callback timer](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Timer.h): `peeping-client/Timer.h`
- [HTTP callback](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Exfiltrate.h): `peeping-client/Exfiltrate.h`

### Encryption

- [AES encryption](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Transformer.h): `peeping-client/Transformer.h`
- [Crypto++ primitives](https://github.com/shehzade/peeping-tom/tree/master/peeping-client/crypto-headers): `peeping-client/crypto-headers`

### Python server

- [Server listener](https://github.com/shehzade/peeping-tom/blob/master/toms-server/toms_server.py): `toms-server/toms_server.py`
- [Log decryption](https://github.com/shehzade/peeping-tom/blob/master/toms-server/decryption.py): `toms-server/decryption.py`
- [Log collection](https://github.com/shehzade/peeping-tom/blob/master/toms-server/collection.py): `toms-server/collection.py`
- [Key generation](https://github.com/shehzade/peeping-tom/blob/master/toms-server/key_generation.py): `toms-server/key_generation.py`

### Client support

- [Client utilities](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/Auxiliary.h): `peeping-client/Auxiliary.h`
- [File operations](https://github.com/shehzade/peeping-tom/blob/master/peeping-client/IO.h): `peeping-client/IO.h`

### Other components

- **Target system**
- **Public tunnel**
- **Keylog file**

## Connections

- Target system → Keyboard hook: receives key events
- Client startup → Keyboard hook: installs hook (evidence: `peeping-client/peeping-client.cpp`)
- Keyboard hook → Key capture: captures keys (evidence: `peeping-client/APIHook.h`)
- Keyboard hook → Callback timer: starts callback timer (evidence: `peeping-client/APIHook.h`)
- Callback timer → HTTP callback: triggers callback (evidence: `peeping-client/Exfiltrate.h`)
- HTTP callback → AES encryption: encrypts payload
- AES encryption → Crypto++ primitives: uses primitives (evidence: `peeping-client/Transformer.h`)
- Client startup → AES encryption: sets encryption key (evidence: `peeping-client/peeping-client.cpp`)
- HTTP callback → Public tunnel: sends callback
- Public tunnel → Server listener: forwards request
- Server listener → Log decryption: uses decryption (evidence: `toms-server/toms_server.py`)
- Server listener → Log collection: routes received logs (evidence: `toms-server/toms_server.py`)
- Log decryption → Log collection: provides plaintext logs
- Log collection → Keylog file: writes logs
- Server listener → Key generation: offers keygen mode (evidence: `toms-server/toms_server.py`)
- Client startup → Client utilities: uses utilities (evidence: `peeping-client/peeping-client.cpp`)
- Client startup → File operations: creates app-data directory (evidence: `peeping-client/peeping-client.cpp`)
- Client utilities → File operations: uses file operations (evidence: `peeping-client/Auxiliary.h`)
