# shruthipoosa04/rl-honeypot architecture

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

- Interactive diagram: https://gitdiagram.com/shruthipoosa04/rl-honeypot
- Repository: https://github.com/shruthipoosa04/rl-honeypot

## Overview

This repository implements a Flask-based adaptive web honeypot. Incoming requests are captured as interaction events, logged, converted into an RL state, scored by a DQN agent, and optionally answered with deceptive content before the route’s normal response. A separate dataset-driven simulator exercises the state, reward, and agent modules. The README is empty; relationships below are based on the provided source excerpts and file tree, so unsampled data and UI details are represented only where their paths are evident.

Main entry points: [`honeypot_web.py`](https://github.com/shruthipoosa04/rl-honeypot/blob/main/honeypot_web.py) (Flask routes and orchestration), [`rl/simulator.py`](https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/simulator.py) (Dataset training simulator), [`logger_utils.py`](https://github.com/shruthipoosa04/rl-honeypot/blob/main/logger_utils.py) (Interaction and decision logger), [`rl/deception.py`](https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/deception.py) (Deception strategies)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Honeypot web app"]
  node_flask_app["Flask routes and orchestration<br/>[honeypot_web.py]"]
  node_views["Honeypot pages"]
end

subgraph group_learning["Adaptive learning"]
  node_state["Request state builder<br/>[state_builder.py]"]
  node_policy["DQN policy and replay<br/>[dqn_agent.py]"]
  node_reward["Threat reward scoring<br/>[reward.py]"]
  node_deception["Deception strategies<br/>[deception.py]"]
end

subgraph group_telemetry["Interaction telemetry"]
  node_logger["Interaction and decision logger<br/>[logger_utils.py]"]
  node_interaction_jsonl["Interaction JSONL<br/>[interactions.jsonl]"]
  node_interaction_db[("Interaction SQLite store<br/>[interactions.db]")]
  node_decision_jsonl["RL decision JSONL<br/>[rl_decisions.jsonl]"]
end

subgraph group_training["Offline training"]
  node_simulator["Dataset training simulator<br/>[simulator.py]"]
  node_dataset["Training CSV<br/>[csv_dataset.csv]"]
end

node_attacker(("Web requester"))

node_attacker -->|"sends requests"| node_flask_app
node_flask_app -->|"captures events"| node_logger
node_flask_app -->|"builds state"| node_state
node_flask_app -->|"chooses and trains"| node_policy
node_flask_app -->|"calculates reward"| node_reward
node_flask_app -->|"applies action"| node_deception
node_flask_app -->|"renders pages"| node_views
node_logger -->|"writes events"| node_interaction_jsonl
node_logger -->|"inserts summaries"| node_interaction_db
node_logger -->|"writes decisions"| node_decision_jsonl
node_deception -->|"renders decoys"| node_views
node_simulator -->|"reads rows"| node_dataset
node_simulator -->|"builds state"| node_state
node_simulator -->|"scores samples"| node_reward
node_simulator -->|"selects and trains"| node_policy

click node_flask_app "https://github.com/shruthipoosa04/rl-honeypot/blob/main/honeypot_web.py"
click node_views "https://github.com/shruthipoosa04/rl-honeypot/tree/main/templates"
click node_state "https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/state_builder.py"
click node_policy "https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/dqn_agent.py"
click node_reward "https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/reward.py"
click node_deception "https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/deception.py"
click node_logger "https://github.com/shruthipoosa04/rl-honeypot/blob/main/logger_utils.py"
click node_interaction_jsonl "https://github.com/shruthipoosa04/rl-honeypot/blob/main/data/interactions.jsonl"
click node_interaction_db "https://github.com/shruthipoosa04/rl-honeypot/blob/main/data/interactions.db"
click node_decision_jsonl "https://github.com/shruthipoosa04/rl-honeypot/blob/main/data/rl_decisions.jsonl"
click node_simulator "https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/simulator.py"
click node_dataset "https://github.com/shruthipoosa04/rl-honeypot/blob/main/data/csv_dataset.csv"

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_flask_app,node_views toneBlue
class node_state,node_policy,node_reward,node_deception toneAmber
class node_logger,node_interaction_jsonl,node_interaction_db,node_decision_jsonl,node_attacker toneMint
class node_simulator,node_dataset toneRose
```

## Components

### Honeypot web app

- [Flask routes and orchestration](https://github.com/shruthipoosa04/rl-honeypot/blob/main/honeypot_web.py): `honeypot_web.py`
- [Honeypot pages](https://github.com/shruthipoosa04/rl-honeypot/tree/main/templates): `templates`

### Adaptive learning

- [Request state builder](https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/state_builder.py): `rl/state_builder.py`
- [DQN policy and replay](https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/dqn_agent.py): `rl/dqn_agent.py`
- [Threat reward scoring](https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/reward.py): `rl/reward.py`
- [Deception strategies](https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/deception.py): `rl/deception.py`

### Interaction telemetry

- [Interaction and decision logger](https://github.com/shruthipoosa04/rl-honeypot/blob/main/logger_utils.py): `logger_utils.py`
- [Interaction JSONL](https://github.com/shruthipoosa04/rl-honeypot/blob/main/data/interactions.jsonl): `data/interactions.jsonl`
- [Interaction SQLite store](https://github.com/shruthipoosa04/rl-honeypot/blob/main/data/interactions.db): `data/interactions.db`
- [RL decision JSONL](https://github.com/shruthipoosa04/rl-honeypot/blob/main/data/rl_decisions.jsonl): `data/rl_decisions.jsonl`

### Offline training

- [Dataset training simulator](https://github.com/shruthipoosa04/rl-honeypot/blob/main/rl/simulator.py): `rl/simulator.py`
- [Training CSV](https://github.com/shruthipoosa04/rl-honeypot/blob/main/data/csv_dataset.csv): `data/csv_dataset.csv`

### Other components

- **Web requester**

## Connections

- Web requester → Flask routes and orchestration: sends requests (evidence: `honeypot_web.py`)
- Flask routes and orchestration → Interaction and decision logger: captures events (evidence: `honeypot_web.py`)
- Flask routes and orchestration → Request state builder: builds state (evidence: `honeypot_web.py`)
- Flask routes and orchestration → DQN policy and replay: chooses and trains (evidence: `honeypot_web.py`)
- Flask routes and orchestration → Threat reward scoring: calculates reward (evidence: `honeypot_web.py`)
- Flask routes and orchestration → Deception strategies: applies action (evidence: `honeypot_web.py`)
- Flask routes and orchestration → Honeypot pages: renders pages (evidence: `honeypot_web.py`)
- Interaction and decision logger → Interaction JSONL: writes events (evidence: `logger_utils.py`)
- Interaction and decision logger → Interaction SQLite store: inserts summaries (evidence: `logger_utils.py`)
- Interaction and decision logger → RL decision JSONL: writes decisions (evidence: `logger_utils.py`)
- Deception strategies → Honeypot pages: renders decoys (evidence: `rl/deception.py`)
- Dataset training simulator → Training CSV: reads rows (evidence: `rl/simulator.py`)
- Dataset training simulator → Request state builder: builds state (evidence: `rl/simulator.py`)
- Dataset training simulator → Threat reward scoring: scores samples (evidence: `rl/simulator.py`)
- Dataset training simulator → DQN policy and replay: selects and trains (evidence: `rl/simulator.py`)
