# baranwal-47/web-pentest architecture

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

- Interactive diagram: https://gitdiagram.com/baranwal-47/web-pentest
- Repository: https://github.com/baranwal-47/web-pentest

## Overview

This is a FastAPI-based penetration-testing platform. A user submits a target and scan options through the web interface or API; the scan endpoint schedules execution, the service runs selected security tools, normalizes findings, persists results, and generates reports. Separate API routes expose scan history, vulnerabilities, and report downloads. Quick/deep modes, progress monitoring, risk scoring, and HTML/JSON/XML reporting are documented capabilities; several details are not visible in the sampled excerpts, so their connections are omitted rather than inferred.

Main entry points: [`app/services/scan_service.py`](https://github.com/baranwal-47/web-pentest/blob/main/app/services/scan_service.py) (Scan Orchestrator), [`app/api/v1/scans.py`](https://github.com/baranwal-47/web-pentest/blob/main/app/api/v1/scans.py) (Scan Routes), [`app/crud/scan.py`](https://github.com/baranwal-47/web-pentest/blob/main/app/crud/scan.py) (Scan Data Access), [`app/main.py`](https://github.com/baranwal-47/web-pentest/blob/main/app/main.py) (FastAPI App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Interface"]
  node_app["FastAPI App<br/>[main.py]"]
  node_pages["Scan Pages"]
end

subgraph group_api["API and Domain"]
  node_scan_api["Scan Routes<br/>[scans.py]"]
  node_vuln_api["Vulnerability Routes<br/>[vulnerabilities.py]"]
  node_report_api["Report Routes<br/>[reports.py]"]
  node_schemas["Request Schemas<br/>[scan.py]"]
end

subgraph group_execution["Scan Execution"]
  node_service["Scan Orchestrator<br/>[scan_service.py]"]
  node_nmap["Nmap Adapter"]
  node_nikto["Nikto Adapter"]
  node_zap["ZAP Adapter"]
  node_burp["Burp Adapter"]
end

subgraph group_persistence["Persistence and Reporting"]
  node_crud["Scan Data Access<br/>[scan.py]"]
  node_models["Scan Records<br/>[scan.py]"]
  node_database["DB Session Setup<br/>[database.py]"]
  node_db_store[("SQLite Database")]
  node_generator["Report Generator"]
end

node_user(("Tester"))
node_browser["Browser Client"]
node_tool_suite["Security Tools"]
node_report_files["Report Files"]

node_user -->|"uses"| node_browser
node_browser -->|"opens interface"| node_app
node_app -->|"renders"| node_pages
node_app -->|"mounts routes"| node_scan_api
node_browser -.->|"submits scans"| node_scan_api
node_scan_api -->|"validates with"| node_schemas
node_scan_api -->|"schedules"| node_service
node_service -->|"runs"| node_nmap
node_service -->|"runs"| node_nikto
node_service -->|"runs"| node_zap
node_service -->|"runs"| node_burp
node_nmap -.->|"invokes"| node_tool_suite
node_nikto -.->|"invokes"| node_tool_suite
node_zap -.->|"invokes"| node_tool_suite
node_burp -->|"calls API"| node_tool_suite
node_service -->|"persists findings"| node_crud
node_crud -->|"queries records"| node_models
node_app -->|"initializes"| node_database
node_database -->|"connects to"| node_db_store
node_database -->|"creates tables"| node_models
node_scan_api -->|"reads and updates"| node_crud
node_vuln_api -->|"queries findings"| node_crud
node_service -->|"generates reports"| node_generator
node_report_api -->|"regenerates reports"| node_generator
node_report_api -->|"loads report data"| node_crud
node_generator -.->|"writes reports"| node_report_files
node_report_api -->|"serves downloads"| node_report_files

click node_app "https://github.com/baranwal-47/web-pentest/blob/main/app/main.py"
click node_pages "https://github.com/baranwal-47/web-pentest/tree/main/app/templates"
click node_scan_api "https://github.com/baranwal-47/web-pentest/blob/main/app/api/v1/scans.py"
click node_vuln_api "https://github.com/baranwal-47/web-pentest/blob/main/app/api/v1/vulnerabilities.py"
click node_report_api "https://github.com/baranwal-47/web-pentest/blob/main/app/api/v1/reports.py"
click node_schemas "https://github.com/baranwal-47/web-pentest/blob/main/app/schemas/scan.py"
click node_service "https://github.com/baranwal-47/web-pentest/blob/main/app/services/scan_service.py"
click node_nmap "https://github.com/baranwal-47/web-pentest/blob/main/app/utils/basic_nmap_wrapper.py"
click node_nikto "https://github.com/baranwal-47/web-pentest/blob/main/app/utils/basic_nikto_wrapper.py"
click node_zap "https://github.com/baranwal-47/web-pentest/blob/main/app/utils/basic_zap_wrapper.py"
click node_burp "https://github.com/baranwal-47/web-pentest/blob/main/app/utils/burp_pro_wrapper_v01.py"
click node_crud "https://github.com/baranwal-47/web-pentest/blob/main/app/crud/scan.py"
click node_models "https://github.com/baranwal-47/web-pentest/blob/main/app/models/scan.py"
click node_database "https://github.com/baranwal-47/web-pentest/blob/main/app/database.py"
click node_generator "https://github.com/baranwal-47/web-pentest/blob/main/app/utils/basic_report_generator.py"
click node_report_files "https://github.com/baranwal-47/web-pentest/tree/main/reports"

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_app,node_pages,node_browser toneBlue
class node_scan_api,node_vuln_api,node_report_api,node_schemas toneAmber
class node_service,node_nmap,node_nikto,node_zap,node_burp toneMint
class node_crud,node_models,node_database,node_db_store,node_generator toneRose
class node_user,node_tool_suite toneIndigo
class node_report_files toneTeal
```

## Components

### Web Interface

- [FastAPI App](https://github.com/baranwal-47/web-pentest/blob/main/app/main.py): `app/main.py`
- [Scan Pages](https://github.com/baranwal-47/web-pentest/tree/main/app/templates): `app/templates`

### API and Domain

- [Scan Routes](https://github.com/baranwal-47/web-pentest/blob/main/app/api/v1/scans.py): `app/api/v1/scans.py`
- [Vulnerability Routes](https://github.com/baranwal-47/web-pentest/blob/main/app/api/v1/vulnerabilities.py): `app/api/v1/vulnerabilities.py`
- [Report Routes](https://github.com/baranwal-47/web-pentest/blob/main/app/api/v1/reports.py): `app/api/v1/reports.py`
- [Request Schemas](https://github.com/baranwal-47/web-pentest/blob/main/app/schemas/scan.py): `app/schemas/scan.py`

### Scan Execution

- [Scan Orchestrator](https://github.com/baranwal-47/web-pentest/blob/main/app/services/scan_service.py): `app/services/scan_service.py`
- [Nmap Adapter](https://github.com/baranwal-47/web-pentest/blob/main/app/utils/basic_nmap_wrapper.py): `app/utils/basic_nmap_wrapper.py`
- [Nikto Adapter](https://github.com/baranwal-47/web-pentest/blob/main/app/utils/basic_nikto_wrapper.py): `app/utils/basic_nikto_wrapper.py`
- [ZAP Adapter](https://github.com/baranwal-47/web-pentest/blob/main/app/utils/basic_zap_wrapper.py): `app/utils/basic_zap_wrapper.py`
- [Burp Adapter](https://github.com/baranwal-47/web-pentest/blob/main/app/utils/burp_pro_wrapper_v01.py): `app/utils/burp_pro_wrapper_v01.py`

### Persistence and Reporting

- [Scan Data Access](https://github.com/baranwal-47/web-pentest/blob/main/app/crud/scan.py): `app/crud/scan.py`
- [Scan Records](https://github.com/baranwal-47/web-pentest/blob/main/app/models/scan.py): `app/models/scan.py`
- [DB Session Setup](https://github.com/baranwal-47/web-pentest/blob/main/app/database.py): `app/database.py`
- **SQLite Database**
- [Report Generator](https://github.com/baranwal-47/web-pentest/blob/main/app/utils/basic_report_generator.py): `app/utils/basic_report_generator.py`

### Other components

- **Tester**
- **Browser Client**
- **Security Tools**
- [Report Files](https://github.com/baranwal-47/web-pentest/tree/main/reports): `reports`

## Connections

- Tester → Browser Client: uses (evidence: `README.md`)
- Browser Client → FastAPI App: opens interface (evidence: `README.md`)
- FastAPI App → Scan Pages: renders (evidence: `app/main.py`)
- FastAPI App → Scan Routes: mounts routes (evidence: `app/main.py`)
- Browser Client → Scan Routes: submits scans (evidence: `README.md`)
- Scan Routes → Request Schemas: validates with (evidence: `app/api/v1/scans.py`)
- Scan Routes → Scan Orchestrator: schedules (evidence: `app/api/v1/scans.py`)
- Scan Orchestrator → Nmap Adapter: runs (evidence: `app/services/scan_service.py`)
- Scan Orchestrator → Nikto Adapter: runs (evidence: `app/services/scan_service.py`)
- Scan Orchestrator → ZAP Adapter: runs (evidence: `app/services/scan_service.py`)
- Scan Orchestrator → Burp Adapter: runs (evidence: `app/services/scan_service.py`)
- Nmap Adapter → Security Tools: invokes
- Nikto Adapter → Security Tools: invokes
- ZAP Adapter → Security Tools: invokes
- Burp Adapter → Security Tools: calls API (evidence: `app/utils/burp_pro_wrapper_v01.py`)
- Scan Orchestrator → Scan Data Access: persists findings (evidence: `app/services/scan_service.py`)
- Scan Data Access → Scan Records: queries records (evidence: `app/crud/scan.py`)
- FastAPI App → DB Session Setup: initializes (evidence: `app/main.py`)
- DB Session Setup → SQLite Database: connects to (evidence: `app/database.py`)
- DB Session Setup → Scan Records: creates tables (evidence: `app/database.py`)
- Scan Routes → Scan Data Access: reads and updates (evidence: `app/api/v1/scans.py`)
- Vulnerability Routes → Scan Data Access: queries findings (evidence: `app/api/v1/vulnerabilities.py`)
- Scan Orchestrator → Report Generator: generates reports (evidence: `app/services/scan_service.py`)
- Report Routes → Report Generator: regenerates reports (evidence: `app/api/v1/reports.py`)
- Report Routes → Scan Data Access: loads report data (evidence: `app/api/v1/reports.py`)
- Report Generator → Report Files: writes reports
- Report Routes → Report Files: serves downloads (evidence: `app/api/v1/reports.py`)
