# ashishs2020git/cybersec-lab architecture

> Architecture diagram of the GitHub repository ashishs2020git/cybersec-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashishs2020git/cybersec-lab
- Repository: https://github.com/ashishs2020git/cybersec-lab

## Overview

CyberLab is a consent-gated device file-sharing server with a companion device agent. The main workflow is agent registration and heartbeat, dashboard selection and transfer creation, then agent polling and local human approval before either downloading a file or uploading a requested one. The sampled server code also includes Nmap scanning through a Kali VM and a host-side explorer route. Some UI and route implementations were not sampled, so those branches are limited to documented or visible relationships.

Main entry points: [`server/app.py`](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/app.py) (Flask Routes), [`agent/connect.py`](https://github.com/ashishs2020git/cybersec-lab/blob/main/agent/connect.py) (Connect Agent), [`server/templates/dashboard.html`](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/templates/dashboard.html) (Browser Dashboard), [`server/nmap.py`](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/nmap.py) (Nmap Scans)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard and Server"]
  node_browser["Browser Dashboard<br/>[dashboard.html]"]
  node_server["Flask Routes<br/>[app.py]"]
  node_auth["Login<br/>[login.html]"]
  node_store[("SQLite State<br/>[devices.db]")]
  node_explorer["Host Explorer<br/>[app.py]"]
end

subgraph group_transfer["Consent-Based Transfers"]
  node_transfer_queue["Transfer Queue<br/>[app.py]"]
  node_uploads["Server Uploads"]
end

subgraph group_agent["Device Agent"]
  node_agent["Connect Agent<br/>[connect.py]"]
  node_received["Received Files<br/>[connect.py]"]
end

subgraph group_scan["Network Scanning"]
  node_nmap["Nmap Scans<br/>[nmap.py]"]
  node_executor["VM Executor<br/>[kali_executor.py]"]
  node_kali["Kali VM"]
end

node_admin(("Administrator"))
node_device_user(("Device User"))

node_admin -->|"uses"| node_browser
node_browser -->|"submits requests"| node_server
node_server -->|"renders login"| node_auth
node_server -->|"reads and writes"| node_store
node_server -->|"serves route"| node_explorer
node_browser -->|"creates transfers"| node_transfer_queue
node_server -->|"queues requests"| node_transfer_queue
node_server -->|"stores uploads"| node_uploads
node_device_user -->|"runs and approves"| node_agent
node_agent -->|"registers and polls"| node_server
node_agent -->|"accepts or rejects"| node_transfer_queue
node_agent -->|"saves accepted files"| node_received
node_agent -->|"uploads requested files"| node_server
node_server -->|"runs scan"| node_nmap
node_nmap -->|"runs guest program"| node_executor
node_executor -->|"executes in VM"| node_kali

click node_browser "https://github.com/ashishs2020git/cybersec-lab/blob/main/server/templates/dashboard.html"
click node_server "https://github.com/ashishs2020git/cybersec-lab/blob/main/server/app.py"
click node_auth "https://github.com/ashishs2020git/cybersec-lab/blob/main/server/templates/login.html"
click node_store "https://github.com/ashishs2020git/cybersec-lab/blob/main/server/devices.db"
click node_explorer "https://github.com/ashishs2020git/cybersec-lab/blob/main/server/app.py"
click node_transfer_queue "https://github.com/ashishs2020git/cybersec-lab/blob/main/server/app.py"
click node_uploads "https://github.com/ashishs2020git/cybersec-lab/tree/main/server/uploads"
click node_agent "https://github.com/ashishs2020git/cybersec-lab/blob/main/agent/connect.py"
click node_received "https://github.com/ashishs2020git/cybersec-lab/blob/main/agent/connect.py"
click node_nmap "https://github.com/ashishs2020git/cybersec-lab/blob/main/server/nmap.py"
click node_executor "https://github.com/ashishs2020git/cybersec-lab/blob/main/server/kali_executor.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_browser,node_server,node_auth,node_store,node_explorer,node_device_user toneBlue
class node_transfer_queue,node_uploads toneAmber
class node_agent,node_received toneMint
class node_nmap,node_executor,node_kali toneRose
class node_admin toneIndigo
```

## Components

### Dashboard and Server

- [Browser Dashboard](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/templates/dashboard.html): `server/templates/dashboard.html`
- [Flask Routes](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/app.py): `server/app.py`
- [Login](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/templates/login.html): `server/templates/login.html`
- [SQLite State](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/devices.db): `server/devices.db`
- [Host Explorer](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/app.py): `server/app.py`

### Consent-Based Transfers

- [Transfer Queue](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/app.py): `server/app.py`
- [Server Uploads](https://github.com/ashishs2020git/cybersec-lab/tree/main/server/uploads): `server/uploads`

### Device Agent

- [Connect Agent](https://github.com/ashishs2020git/cybersec-lab/blob/main/agent/connect.py): `agent/connect.py`
- [Received Files](https://github.com/ashishs2020git/cybersec-lab/blob/main/agent/connect.py): `agent/connect.py`

### Network Scanning

- [Nmap Scans](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/nmap.py): `server/nmap.py`
- [VM Executor](https://github.com/ashishs2020git/cybersec-lab/blob/main/server/kali_executor.py): `server/kali_executor.py`
- **Kali VM**

### Other components

- **Administrator**
- **Device User**

## Connections

- Administrator → Browser Dashboard: uses (evidence: `README.md`)
- Browser Dashboard → Flask Routes: submits requests (evidence: `README.md`)
- Flask Routes → Login: renders login (evidence: `server/app.py`)
- Flask Routes → SQLite State: reads and writes (evidence: `server/app.py`)
- Flask Routes → Host Explorer: serves route (evidence: `server/app.py`)
- Browser Dashboard → Transfer Queue: creates transfers (evidence: `README.md`)
- Flask Routes → Transfer Queue: queues requests (evidence: `server/app.py`)
- Flask Routes → Server Uploads: stores uploads (evidence: `server/app.py`)
- Device User → Connect Agent: runs and approves (evidence: `README.md`)
- Connect Agent → Flask Routes: registers and polls (evidence: `agent/connect.py`)
- Connect Agent → Transfer Queue: accepts or rejects (evidence: `agent/connect.py`)
- Connect Agent → Received Files: saves accepted files (evidence: `agent/connect.py`)
- Connect Agent → Flask Routes: uploads requested files (evidence: `agent/connect.py`)
- Flask Routes → Nmap Scans: runs scan (evidence: `server/app.py`)
- Nmap Scans → VM Executor: runs guest program (evidence: `server/nmap.py`)
- VM Executor → Kali VM: executes in VM (evidence: `server/kali_executor.py`)
