# naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot architecture

> Architecture diagram of the GitHub repository naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot
- Repository: https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot

## Overview

HoneyNet is an AI-assisted router that classifies incoming SSH and web traffic, then steers it to a honeypot; a Flask dashboard also presents and exports honeypot activity. The graph includes the documented dataset-preparation and model-training stages, although some stages were not sampled directly. The router’s packet handling and dashboard parsing are excerpted; links for other documented pipeline steps and the router-to-dashboard report use README evidence.

Main entry points: [`ai_config_for_router/ai_router.py`](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/ai_router.py) (AI packet router), [`dashboard/app.py`](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/app.py) (Flask dashboard), [`dashboard/cowrie_parser.py`](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/cowrie_parser.py) (Cowrie log parser), [`dashboard/dvwa_parser.py`](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/dvwa_parser.py) (DVWA log parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Traffic routing"]
  node_router["AI packet router<br/>[ai_router.py]"]
  node_classifier["TF-IDF classifier<br/>[ai_router.py]"]
  node_iptables["iptables DNAT"]
end

subgraph group_learning["Model preparation"]
  node_dataset_prep["Dataset preparation<br/>[prep_dataset.py]"]
  node_label_fix["Label correction<br/>[fix_labels.py]"]
  node_noise["Noise augmentation<br/>[add_noise.py]"]
  node_recon["Recon augmentation<br/>[add_recon.py]"]
  node_training["Model training<br/>[train_model.py]"]
  node_dataset["Prepared dataset"]
  node_model["Model artifacts<br/>[model.pkl]"]
end

subgraph group_dashboard["Activity dashboard"]
  node_dashboard_app["Flask dashboard<br/>[app.py]"]
  node_cowrie_parser["Cowrie log parser<br/>[cowrie_parser.py]"]
  node_dvwa_parser["DVWA log parser<br/>[dvwa_parser.py]"]
  node_ip_cache[("Real IP cache<br/>[cache.py]")]
  node_dashboard_view["Dashboard view<br/>[dashboard.html]"]
end

subgraph group_honeypots["Honeypot services"]
  node_cowrie_logs["Cowrie logs"]
  node_apache_logs["Apache access log"]
  node_cowrie["Cowrie honeypot"]
  node_dvwa["DVWA honeypot"]
end

node_attacker(("Attacker"))

node_attacker -->|"sends traffic"| node_router
node_router -->|"classifies payload"| node_classifier
node_classifier -->|"loads artifacts"| node_model
node_router -->|"installs DNAT"| node_iptables
node_iptables -->|"forwards SSH"| node_cowrie
node_iptables -->|"forwards web"| node_dvwa
node_dataset_prep -->|"exports dataset"| node_dataset
node_dataset -->|"relabels rows"| node_label_fix
node_label_fix -->|"augments data"| node_noise
node_noise -->|"adds samples"| node_recon
node_recon -->|"trains from data"| node_training
node_training -->|"saves artifacts"| node_model
node_cowrie_logs -->|"reads events"| node_cowrie_parser
node_apache_logs -->|"reads requests"| node_dvwa_parser
node_cowrie_parser -->|"looks up IP"| node_ip_cache
node_dvwa_parser -->|"reads latest IP"| node_ip_cache
node_dashboard_app -->|"loads Cowrie logs"| node_cowrie_parser
node_dashboard_app -->|"loads DVWA logs"| node_dvwa_parser
node_dashboard_app -->|"renders view"| node_dashboard_view
node_router -->|"reports attacker IP"| node_dashboard_app

click node_router "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/ai_router.py"
click node_classifier "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/ai_router.py"
click node_dataset_prep "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/prep_dataset.py"
click node_label_fix "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/fix_labels.py"
click node_noise "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/add_noise.py"
click node_recon "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/add_recon.py"
click node_training "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/train_model.py"
click node_model "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/model/model.pkl"
click node_dashboard_app "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/app.py"
click node_cowrie_parser "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/cowrie_parser.py"
click node_dvwa_parser "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/dvwa_parser.py"
click node_ip_cache "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/cache.py"
click node_dashboard_view "https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/templates/dashboard.html"

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_router,node_classifier,node_iptables toneBlue
class node_dataset_prep,node_label_fix,node_noise,node_recon,node_training,node_dataset,node_model toneAmber
class node_dashboard_app,node_cowrie_parser,node_dvwa_parser,node_ip_cache,node_dashboard_view toneMint
class node_cowrie_logs,node_apache_logs,node_cowrie,node_dvwa toneRose
class node_attacker toneIndigo
```

## Components

### Traffic routing

- [AI packet router](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/ai_router.py): `ai_config_for_router/ai_router.py`
- [TF-IDF classifier](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/ai_router.py): `ai_config_for_router/ai_router.py`
- **iptables DNAT**

### Model preparation

- [Dataset preparation](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/prep_dataset.py): `ai_config_for_router/prep_dataset.py`
- [Label correction](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/fix_labels.py): `ai_config_for_router/fix_labels.py`
- [Noise augmentation](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/add_noise.py): `ai_config_for_router/add_noise.py`
- [Recon augmentation](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/add_recon.py): `ai_config_for_router/add_recon.py`
- [Model training](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/train_model.py): `ai_config_for_router/train_model.py`
- **Prepared dataset**
- [Model artifacts](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/ai_config_for_router/model/model.pkl): `ai_config_for_router/model/model.pkl`

### Activity dashboard

- [Flask dashboard](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/app.py): `dashboard/app.py`
- [Cowrie log parser](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/cowrie_parser.py): `dashboard/cowrie_parser.py`
- [DVWA log parser](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/dvwa_parser.py): `dashboard/dvwa_parser.py`
- [Real IP cache](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/cache.py): `dashboard/cache.py`
- [Dashboard view](https://github.com/naderyb/implementation-of-an-intelligent-defense-router-with-an-integrated-honeypot/blob/main/dashboard/templates/dashboard.html): `dashboard/templates/dashboard.html`

### Honeypot services

- **Cowrie logs**
- **Apache access log**
- **Cowrie honeypot**
- **DVWA honeypot**

### Other components

- **Attacker**

## Connections

- Attacker → AI packet router: sends traffic (evidence: `README.md`)
- AI packet router → TF-IDF classifier: classifies payload (evidence: `ai_config_for_router/ai_router.py`)
- TF-IDF classifier → Model artifacts: loads artifacts (evidence: `ai_config_for_router/ai_router.py`)
- AI packet router → iptables DNAT: installs DNAT (evidence: `ai_config_for_router/ai_router.py`)
- iptables DNAT → Cowrie honeypot: forwards SSH (evidence: `README.md`)
- iptables DNAT → DVWA honeypot: forwards web (evidence: `README.md`)
- Dataset preparation → Prepared dataset: exports dataset (evidence: `README.md`)
- Prepared dataset → Label correction: relabels rows (evidence: `README.md`)
- Label correction → Noise augmentation: augments data (evidence: `README.md`)
- Noise augmentation → Recon augmentation: adds samples (evidence: `README.md`)
- Recon augmentation → Model training: trains from data (evidence: `README.md`)
- Model training → Model artifacts: saves artifacts (evidence: `ai_config_for_router/train_model.py`)
- Cowrie logs → Cowrie log parser: reads events (evidence: `dashboard/cowrie_parser.py`)
- Apache access log → DVWA log parser: reads requests (evidence: `dashboard/dvwa_parser.py`)
- Cowrie log parser → Real IP cache: looks up IP (evidence: `dashboard/cowrie_parser.py`)
- DVWA log parser → Real IP cache: reads latest IP (evidence: `dashboard/dvwa_parser.py`)
- Flask dashboard → Cowrie log parser: loads Cowrie logs (evidence: `dashboard/app.py`)
- Flask dashboard → DVWA log parser: loads DVWA logs (evidence: `dashboard/app.py`)
- Flask dashboard → Dashboard view: renders view (evidence: `README.md`)
- AI packet router → Flask dashboard: reports attacker IP (evidence: `README.md`)
