# nyx-off/honeypot-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/nyx-off/honeypot-dashboard
- Repository: https://github.com/nyx-off/honeypot-dashboard

## Overview

##### Project type and purpose
- This is a Docker‐based, multi‐container full‐stack application whose goal is to deploy a Cowrie honeypot, ingest its logs, store them in MongoDB, and present a real-time web dashboard (Flask + SocketIO) to monitor attacks.

##### File structure
- Top level:
- cowrie/ – Cowrie honeypot configuration, rootfs, SSH/Telnet keys, and log directory
- ingestion/ – Python script (ingest.py) that monitors cowrie/log and writes to MongoDB
- dashboard/ – Flask app (app.py), templates, requirements.txt, optional GeoIP DB
- docker-compose.yml – Orchestrates 4 services (cowrie, mongo, ingestion, dashboard)
- Notice the shared volume cowrie/log mounted into ingestion.
- cowrie/cowrie.cfg and cowrie/etc/userdb.txt define honeypot behavior.

##### Extract architectural insights from README
- Four Docker services: cowrie, mongo, ingestion, dashboard
- Data flow: Attacker → Cowrie → Log files → Ingestion → MongoDB ← Dashboard
- Dashboard communicates with clients via WebSockets for real-time updates.
- Optional GeoIP lookup happens in the dashboard container.

##### Essential details to capture
- Shared volume path: cowrie/log → mounted into ingestion
- Docker Compose service names and inter‐service network
- Real-time update mechanism: MongoDB → Dashboard → Client via WebSockets
- Config files: cowrie/cowrie.cfg, userdb.txt, GeoLite2-City.mmdb (if used)
- Entrypoints: cowrie.tac for Cowrie, ingest.py for ingestion, app.py for dashboard

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Actor
    Attacker["Attacker"]:::external

    %% Cowrie Honeypot
    subgraph "Cowrie Honeypot Container" 
        style CowrieContainer fill:#ccf,stroke:#333,stroke-width:1px
        CowrieContainer["cowrie (SSH/Telnet honeypot)"]:::container
        cfg["cowrie.cfg"]:::config
        tac["cowrie.tac"]:::config
        userdb["userdb.txt"]:::config
        keys["SSH/Telnet host keys"]:::config
        rootfs["rootfs/"]:::config
        logvol["cowrie/log Volume"]:::storage
    end

    %% Ingestion Service
    subgraph "Ingestion Service Container"
        ingestionContainer["ingestion (Python script)"]:::container   
        ingest["ingest.py"]:::script
        ingDocker["Dockerfile"]:::config
    end

    %% MongoDB Data Store
    MongoDB["MongoDB"]:::db

    %% Dashboard Service
    subgraph "Dashboard Service Container"
        dashboardContainer["dashboard (Flask + SocketIO)"]:::container
        app["app.py"]:::script
        templates["templates/index.html"]:::config
        reqs["requirements.txt"]:::config
        dashDocker["Dockerfile"]:::config
    end

    %% Web Client
    WebClient["Web Client (Browser)"]:::client

    %% Orchestration
    compose["docker-compose.yml"]:::config

    %% Data Flows
    Attacker -->|"SSH/Telnet 2222/2223"| CowrieContainer
    CowrieContainer -.->|"writes logs"| logvol
    logvol -.->|"shared volume"| ingestionContainer
    ingestionContainer -->|"inserts JSON events"| MongoDB
    MongoDB -->|"reads queries"| dashboardContainer
    MongoDB -->|"change stream"| dashboardContainer
    dashboardContainer -->|"WebSocket updates"| WebClient
    WebClient -->|"REST calls"| dashboardContainer

    %% Click Events
    click cfg "https://github.com/nyx-off/honeypot-dashboard/blob/main/cowrie/cowrie.cfg"
    click tac "https://github.com/nyx-off/honeypot-dashboard/blob/main/cowrie/cowrie.tac"
    click userdb "https://github.com/nyx-off/honeypot-dashboard/blob/main/cowrie/etc/userdb.txt"
    click keys "https://github.com/nyx-off/honeypot-dashboard/tree/main/cowrie/keys/"
    click rootfs "https://github.com/nyx-off/honeypot-dashboard/tree/main/cowrie/data/rootfs/"
    click logvol "https://github.com/nyx-off/honeypot-dashboard/tree/main/cowrie/log/"
    click ingest "https://github.com/nyx-off/honeypot-dashboard/blob/main/ingestion/ingest.py"
    click ingDocker "https://github.com/nyx-off/honeypot-dashboard/tree/main/ingestion/Dockerfile"
    click app "https://github.com/nyx-off/honeypot-dashboard/blob/main/dashboard/app.py"
    click templates "https://github.com/nyx-off/honeypot-dashboard/blob/main/dashboard/templates/index.html"
    click reqs "https://github.com/nyx-off/honeypot-dashboard/blob/main/dashboard/requirements.txt"
    click dashDocker "https://github.com/nyx-off/honeypot-dashboard/tree/main/dashboard/Dockerfile"
    click compose "https://github.com/nyx-off/honeypot-dashboard/blob/main/docker-compose.yml"

    %% Styles
    classDef external fill:#f88,stroke:#800,stroke-width:1px;
    classDef container fill:#ccf,stroke:#339,stroke-width:1px;
    classDef db fill:#cfc,stroke:#393,stroke-width:1px;
    classDef storage fill:#ffc,stroke:#aa0,stroke-width:1px;
    classDef client fill:#ccc,stroke:#666,stroke-width:1px;
    classDef script fill:#eef,stroke:#33a,stroke-width:1px;
    classDef config fill:#efe,stroke:#2a2,stroke-width:1px;
```
