# priyansh019/network-scanner architecture

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

- Interactive diagram: https://gitdiagram.com/priyansh019/network-scanner
- Repository: https://github.com/priyansh019/network-scanner

## Overview

SentinelPy is a web-based network security scanner. A user authenticates and requests a target scan in the React dashboard; the FastAPI backend records it, a scanner poller picks it up, scans ports and assesses services for vulnerabilities and risk, then submits results for the dashboard to display. The graph separates UI, API and persistence, and scanner processing stages. README documents the cross-process workflow; sampled source and the SOURCE INDEX support the cited internal calls. Some scanner/backend integration details are unsampled, so those links rely on documented behavior.

Main entry points: [`backend/app/api/routes/scan.py`](https://github.com/priyansh019/network-scanner/blob/main/backend/app/api/routes/scan.py) (Scan routes), [`frontend/src/api.js`](https://github.com/priyansh019/network-scanner/blob/main/frontend/src/api.js) (API client), [`scanner/integration.py`](https://github.com/priyansh019/network-scanner/blob/main/scanner/integration.py) (Port and banner scan), [`backend/app/api/routes/auth.py`](https://github.com/priyansh019/network-scanner/blob/main/backend/app/api/routes/auth.py) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web dashboard"]
  node_auth_ui["Login and register<br/>[Login.jsx]"]
  node_scan_ui["Start scan<br/>[StartScan.jsx]"]
  node_history_ui["Scan history<br/>[ScanHistory.jsx]"]
  node_result_ui["Scan results<br/>[ScanResult.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_auth_routes["Auth routes<br/>[auth.py]"]
  node_scan_routes["Scan routes<br/>[scan.py]"]
  node_mock_routes["Mock scanner routes<br/>[mock_scanner.py]"]
  node_app["FastAPI app<br/>[main.py]"]
  node_auth_security["JWT and passwords<br/>[security.py]"]
  node_scan_store[("Scan records<br/>[db_model.py]")]
  node_user_store[("User records<br/>[db_user.py]")]
  node_db_session["Database session<br/>[database.py]"]
end

subgraph group_scan["Scanner engine"]
  node_poller["Scan poller<br/>[poller.py]"]
  node_integration["Scan orchestration<br/>[integration.py]"]
  node_port_scan["Port and banner scan<br/>[integration.py]"]
end

subgraph group_security["Scan assessment"]
  node_version["Version detection"]
  node_cve["CVE matching<br/>[cve_matcher.py]"]
  node_risk["Risk classification<br/>[risk_classifier.py]"]
  node_vuln_data["Vulnerability data"]
end

node_user(("User"))
node_target(("Network target"))

node_user -->|"authenticates"| node_auth_ui
node_user -->|"requests scan"| node_scan_ui
node_user -->|"views history"| node_history_ui
node_user -->|"views results"| node_result_ui
node_auth_ui -->|"calls auth"| node_api_client
node_scan_ui -->|"starts scan"| node_api_client
node_history_ui -->|"fetches history"| node_api_client
node_result_ui -->|"fetches result"| node_api_client
node_api_client -->|"REST auth"| node_auth_routes
node_api_client -->|"REST scans"| node_scan_routes
node_app -->|"registers routes"| node_auth_routes
node_app -->|"registers routes"| node_scan_routes
node_app -->|"registers routes"| node_mock_routes
node_auth_routes -->|"uses credentials"| node_auth_security
node_auth_routes -->|"reads and writes"| node_user_store
node_scan_routes -->|"reads and writes"| node_scan_store
node_auth_routes -->|"gets session"| node_db_session
node_scan_routes -->|"gets session"| node_db_session
node_app -->|"creates tables"| node_db_session
node_scan_routes -->|"offers pending scans"| node_poller
node_poller -->|"runs scan"| node_integration
node_integration -->|"scans ports"| node_port_scan
node_port_scan -->|"connects to"| node_target
node_port_scan -->|"extracts version"| node_version
node_port_scan -->|"matches vulnerability"| node_cve
node_port_scan -->|"classifies severity"| node_risk
node_integration -->|"loads database"| node_vuln_data
node_integration -->|"posts results"| node_scan_routes
node_result_ui -.->|"displays risk"| node_risk

click node_auth_ui "https://github.com/priyansh019/network-scanner/blob/main/frontend/src/pages/Login.jsx"
click node_scan_ui "https://github.com/priyansh019/network-scanner/blob/main/frontend/src/pages/StartScan.jsx"
click node_history_ui "https://github.com/priyansh019/network-scanner/blob/main/frontend/src/pages/ScanHistory.jsx"
click node_result_ui "https://github.com/priyansh019/network-scanner/blob/main/frontend/src/pages/ScanResult.jsx"
click node_api_client "https://github.com/priyansh019/network-scanner/blob/main/frontend/src/api.js"
click node_auth_routes "https://github.com/priyansh019/network-scanner/blob/main/backend/app/api/routes/auth.py"
click node_scan_routes "https://github.com/priyansh019/network-scanner/blob/main/backend/app/api/routes/scan.py"
click node_mock_routes "https://github.com/priyansh019/network-scanner/blob/main/backend/app/api/routes/mock_scanner.py"
click node_app "https://github.com/priyansh019/network-scanner/blob/main/backend/app/main.py"
click node_auth_security "https://github.com/priyansh019/network-scanner/blob/main/backend/app/core/security.py"
click node_scan_store "https://github.com/priyansh019/network-scanner/blob/main/backend/app/model/db_model.py"
click node_user_store "https://github.com/priyansh019/network-scanner/blob/main/backend/app/model/db_user.py"
click node_db_session "https://github.com/priyansh019/network-scanner/blob/main/backend/app/database.py"
click node_poller "https://github.com/priyansh019/network-scanner/blob/main/scanner/poller.py"
click node_integration "https://github.com/priyansh019/network-scanner/blob/main/scanner/integration.py"
click node_port_scan "https://github.com/priyansh019/network-scanner/blob/main/scanner/integration.py"
click node_version "https://github.com/priyansh019/network-scanner/blob/main/scanner/modules/version_detector.py"
click node_cve "https://github.com/priyansh019/network-scanner/blob/main/scanner/modules/cve_matcher.py"
click node_risk "https://github.com/priyansh019/network-scanner/blob/main/scanner/modules/risk_classifier.py"
click node_vuln_data "https://github.com/priyansh019/network-scanner/blob/main/scanner/databases/vulnerabilities.json"

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_auth_ui,node_scan_ui,node_history_ui,node_result_ui,node_api_client,node_user toneBlue
class node_auth_routes,node_scan_routes,node_mock_routes,node_app,node_auth_security,node_scan_store,node_user_store,node_db_session toneAmber
class node_poller,node_integration,node_port_scan toneMint
class node_version,node_cve,node_risk,node_vuln_data toneRose
class node_target toneIndigo
```

## Components

### Web dashboard

- [Login and register](https://github.com/priyansh019/network-scanner/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Start scan](https://github.com/priyansh019/network-scanner/blob/main/frontend/src/pages/StartScan.jsx): `frontend/src/pages/StartScan.jsx`
- [Scan history](https://github.com/priyansh019/network-scanner/blob/main/frontend/src/pages/ScanHistory.jsx): `frontend/src/pages/ScanHistory.jsx`
- [Scan results](https://github.com/priyansh019/network-scanner/blob/main/frontend/src/pages/ScanResult.jsx): `frontend/src/pages/ScanResult.jsx`
- [API client](https://github.com/priyansh019/network-scanner/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Backend API

- [Auth routes](https://github.com/priyansh019/network-scanner/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [Scan routes](https://github.com/priyansh019/network-scanner/blob/main/backend/app/api/routes/scan.py): `backend/app/api/routes/scan.py`
- [Mock scanner routes](https://github.com/priyansh019/network-scanner/blob/main/backend/app/api/routes/mock_scanner.py): `backend/app/api/routes/mock_scanner.py`
- [FastAPI app](https://github.com/priyansh019/network-scanner/blob/main/backend/app/main.py): `backend/app/main.py`
- [JWT and passwords](https://github.com/priyansh019/network-scanner/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Scan records](https://github.com/priyansh019/network-scanner/blob/main/backend/app/model/db_model.py): `backend/app/model/db_model.py`
- [User records](https://github.com/priyansh019/network-scanner/blob/main/backend/app/model/db_user.py): `backend/app/model/db_user.py`
- [Database session](https://github.com/priyansh019/network-scanner/blob/main/backend/app/database.py): `backend/app/database.py`

### Scanner engine

- [Scan poller](https://github.com/priyansh019/network-scanner/blob/main/scanner/poller.py): `scanner/poller.py`
- [Scan orchestration](https://github.com/priyansh019/network-scanner/blob/main/scanner/integration.py): `scanner/integration.py`
- [Port and banner scan](https://github.com/priyansh019/network-scanner/blob/main/scanner/integration.py): `scanner/integration.py`

### Scan assessment

- [Version detection](https://github.com/priyansh019/network-scanner/blob/main/scanner/modules/version_detector.py): `scanner/modules/version_detector.py`
- [CVE matching](https://github.com/priyansh019/network-scanner/blob/main/scanner/modules/cve_matcher.py): `scanner/modules/cve_matcher.py`
- [Risk classification](https://github.com/priyansh019/network-scanner/blob/main/scanner/modules/risk_classifier.py): `scanner/modules/risk_classifier.py`
- [Vulnerability data](https://github.com/priyansh019/network-scanner/blob/main/scanner/databases/vulnerabilities.json): `scanner/databases/vulnerabilities.json`

### Other components

- **User**
- **Network target**

## Connections

- User → Login and register: authenticates (evidence: `README.md`)
- User → Start scan: requests scan (evidence: `README.md`)
- User → Scan history: views history (evidence: `README.md`)
- User → Scan results: views results (evidence: `README.md`)
- Login and register → API client: calls auth (evidence: `frontend/src/pages/Login.jsx`)
- Start scan → API client: starts scan (evidence: `frontend/src/pages/StartScan.jsx`)
- Scan history → API client: fetches history (evidence: `frontend/src/pages/ScanHistory.jsx`)
- Scan results → API client: fetches result (evidence: `frontend/src/pages/ScanResult.jsx`)
- API client → Auth routes: REST auth (evidence: `README.md`)
- API client → Scan routes: REST scans (evidence: `README.md`)
- FastAPI app → Auth routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Scan routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Mock scanner routes: registers routes (evidence: `backend/app/main.py`)
- Auth routes → JWT and passwords: uses credentials (evidence: `backend/app/api/routes/auth.py`)
- Auth routes → User records: reads and writes (evidence: `backend/app/api/routes/auth.py`)
- Scan routes → Scan records: reads and writes (evidence: `backend/app/api/routes/scan.py`)
- Auth routes → Database session: gets session (evidence: `backend/app/api/routes/auth.py`)
- Scan routes → Database session: gets session (evidence: `backend/app/api/routes/scan.py`)
- FastAPI app → Database session: creates tables (evidence: `backend/app/main.py`)
- Scan routes → Scan poller: offers pending scans (evidence: `README.md`)
- Scan poller → Scan orchestration: runs scan
- Scan orchestration → Port and banner scan: scans ports (evidence: `scanner/integration.py`)
- Port and banner scan → Network target: connects to
- Port and banner scan → Version detection: extracts version (evidence: `scanner/integration.py`)
- Port and banner scan → CVE matching: matches vulnerability
- Port and banner scan → Risk classification: classifies severity (evidence: `scanner/integration.py`)
- Scan orchestration → Vulnerability data: loads database (evidence: `README.md`)
- Scan orchestration → Scan routes: posts results (evidence: `README.md`)
- Scan results → Risk classification: displays risk
