Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ VulnScope

A Full-Stack Network Vulnerability Scanning Platform

Scan. Score. Report. β€” Built with Flask, Nmap, and SQLAlchemy.

Python Flask SQLAlchemy Nmap License: MIT


πŸ“– Overview

VulnScope is a self-hosted web application that turns raw Nmap scan output into an authenticated, per-user vulnerability management dashboard. Users register an account, launch scans against a target (host, IP, or CIDR range) with configurable probes (TCP/UDP, OS detection, service/version detection, aggressive mode), and VulnScope parses the results into structured host, port, service, and vulnerability records β€” cross-referencing detected services against a local CVE knowledge base to produce a security score and risk rating for every scan.

Every scan is stored in a SQL database, browsable through a searchable/filterable history page, and exportable as a PDF, HTML, or JSON report. The UI is a hand-built dark/light glassmorphism theme (no CSS framework) with a live-progress scan console and a Chart.js-powered dashboard.

This project was built as a final-year BCA project to demonstrate applied, hands-on security engineering: safe use of an OS-level scanning tool from a web backend, input validation against command-injection, session/CSRF hardening, and a clean service-layer architecture β€” rather than just a CRUD app with security features bolted on.


✨ Key Features

  • πŸ” Real network scanning β€” wraps the actual nmap binary via python-nmap, not a simulated/mocked scanner
  • βš™οΈ Configurable scan profiles β€” toggle TCP connect scan, UDP scan, OS fingerprinting, service/version detection, and aggressive (-A) mode per scan
  • 🧠 Local vulnerability knowledge base β€” detected services (Apache, SSH, FTP, MySQL, Redis, HTTP/S, SMTP) are mapped to known CVEs with CVSS scores, severity, and remediation advice
  • πŸ“Š Automated risk scoring β€” every scan is reduced to a 0–100 security score and a Low/Medium/High/Critical risk level based on open ports, vulnerability count, OS exposure, and critical service presence
  • πŸ“ˆ Interactive dashboard β€” Chart.js visualization of severity distribution across recent scans, plus recent activity and recent vulnerability feeds
  • πŸ•˜ Scan history with filtering β€” search by target/hostname/IP, and filter by severity, date, or protocol
  • πŸ“„ Multi-format reporting β€” generate and download PDF (ReportLab), HTML, or JSON reports per scan, with ownership-checked downloads
  • πŸŒ— Persisted dark/light theme β€” theme choice is saved per user account and rendered server-side on first paint (no flash of unstyled theme)
  • πŸ” Authenticated, per-user data isolation β€” every scan, report, and setting is scoped to the signed-in account via Flask-Login
  • πŸ›‘οΈ Security-conscious by design β€” see Security Disclaimer below for the specifics

🧰 Technology Stack

Layer Technology
Backend Framework Flask 3 (application-factory pattern, Blueprints)
ORM / Database SQLAlchemy 2 Β· SQLite (default, swappable via DATABASE_URL)
Authentication Flask-Login (session-based), Werkzeug password hashing
Security Middleware Flask-WTF (CSRF protection), Flask-Cors (origin allow-listing), limits (rate limiting)
Scan Engine python-nmap (wraps the system nmap binary)
Report Generation ReportLab (PDF), native HTML/JSON writers
Frontend Jinja2 templates, hand-written CSS (custom dark/light glassmorphism design system), vanilla JavaScript
Data Visualization Chart.js (loaded via CDN)
Configuration python-dotenv (.env-based config)

πŸ—οΈ Project Architecture

VulnScope follows a layered Flask application-factory architecture that separates HTTP routing, business logic, and data access:

                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚   Browser (Jinja2 UI)   β”‚
                β”‚  templates + CSS + JS   β”‚
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚ HTTP / fetch (CSRF-protected)
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚   Blueprints (Routes)   β”‚
                β”‚  main Β· auth Β· api      β”‚
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β”‚     Service Layer       β”‚
                β”‚  ScanEngine Β· rate_limitβ”‚
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚              β”‚              β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
     β”‚  nmap binary   β”‚ β”‚ SQLAlchemy β”‚ β”‚  ReportLab  β”‚
     β”‚ (subprocess)   β”‚ β”‚  (SQLite)  β”‚ β”‚ (PDF/HTML)  β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Design highlights:

  • create_app() factory (app/__init__.py) wires up config, CSRF, CORS, the SQLAlchemy engine, and blueprint registration in one place, and self-heals the SQLite schema (ensure_schema) so existing databases pick up new columns without a manual migration step.
  • ScanEngine (app/services/scan_engine.py) is the single point of contact with nmap. It validates the scan target against an allow-list regex before it ever reaches a subprocess call, builds the correct nmap argument set from the requested options, gracefully falls back to a safer scan if the primary one fails, and normalizes raw nmap XML output into Port, Service, and Vulnerability rows.
  • Blueprints (main, auth, api) keep page rendering, authentication, and the JSON API cleanly separated.
  • rate_limit.py wraps the limits package into a one-line is_rate_limited() helper used to throttle login/register attempts.

πŸ“ Folder Structure

VulnScope/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ __init__.py            # Application factory, config, schema bootstrap
β”‚   β”œβ”€β”€ database/
β”‚   β”‚   └── models.py          # SQLAlchemy models: User, Scan, Port, Service,
β”‚   β”‚                           #   Vulnerability, Report, Setting
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ main.py            # Page routes: dashboard, history, reports, settings
β”‚   β”‚   β”œβ”€β”€ auth.py            # Login, register, logout (rate-limited)
β”‚   β”‚   └── api.py             # JSON API: /api/scan, /api/history, /api/report, ...
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ scan_engine.py     # Nmap orchestration, parsing, scoring, exports
β”‚   β”‚   └── rate_limit.py      # Login/register brute-force throttling
β”‚   β”œβ”€β”€ static/
β”‚   β”‚   β”œβ”€β”€ css/style.css      # Dark/light design system
β”‚   β”‚   └── js/app.js          # Scan console, dashboard charts, settings sync
β”‚   └── templates/             # Jinja2 templates (landing, dashboard, new_scan,
β”‚                                #   history, reports, settings, about, 404, ...)
β”œβ”€β”€ screenshots/                # App screenshots used in this README
β”œβ”€β”€ reports/                    # Generated PDF/HTML/JSON reports (per scan)
β”œβ”€β”€ instance/                   # SQLite database (created at runtime)
β”œβ”€β”€ app.py                      # Entry point
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env.example
└── README.md

πŸš€ Installation Guide

Prerequisites

  • Python 3.10+
  • The nmap command-line tool installed on the host OS. python-nmap is a wrapper around the real nmap binary β€” it does not bundle it.
    • Debian/Ubuntu: sudo apt install nmap
    • macOS (Homebrew): brew install nmap
    • Windows: install from nmap.org/download.html and ensure nmap.exe is on your PATH. Also install Npcap alongside it β€” the official Windows installer offers this by default; without it, nmap can exit "successfully" while returning no scan data.
  • Some scan options (OS detection, aggressive -A mode) need raw-socket access and may require elevated/administrator privileges β€” otherwise VulnScope automatically falls back to a safer TCP-connect scan.

Setup

# 1. Clone the repository
git clone https://github.com/gokulkrishnan-s/VulnScope.git
cd VulnScope

# 2. (Recommended) create a virtual environment
python -m venv venv
source venv/bin/activate      # Windows: venv\Scripts\activate

# 3. Install Python dependencies
pip install -r requirements.txt

# 4. Configure environment variables
cp .env.example .env
# then open .env and set SECRET_KEY, e.g.:
python -c "import secrets; print(secrets.token_hex(32))"

# 5. Run the app
python app.py

The app starts at http://127.0.0.1:5000 by default (configurable via FLASK_HOST / FLASK_PORT in .env).


πŸ–₯️ Usage Instructions

  1. Register an account from the landing page, then log in.
  2. Start a scan β€” go to New Scan, enter a target (IP, hostname, or CIDR), choose which probes to run (TCP, UDP, OS detection, version/service detection, aggressive mode), and hit Start. The scan console shows a live progress bar and timeline while the scan runs server-side.
  3. Review results β€” open ports, detected services, and any matched CVEs (with CVSS score and remediation advice) appear in the results panel as soon as the scan completes.
  4. Check the Dashboard β€” see your total scan count, severity distribution chart, recent activity, and recently discovered vulnerabilities at a glance.
  5. Browse History β€” search past scans by target/hostname/IP, or filter by severity, date, or protocol; delete scans you no longer need.
  6. Generate Reports β€” from History or the Reports page, export any scan as a PDF, HTML, or JSON file and download it directly.
  7. Adjust Settings β€” switch between dark/light theme, set your default export format, and toggle notifications. Preferences are saved per account.

πŸ“Έ Screenshots

Screenshots live in the /screenshots folder. Add your own PNGs there with the file names below and they'll render automatically on GitHub.

Dashboard New Scan
Dashboard New Scan
Scan History Reports
History Reports

πŸ”­ Future Improvements

  • Integrate a live CVE feed (e.g. the NVD API) instead of the static local knowledge base
  • Move scan execution to a background task queue (Celery/RQ) for long-running or scheduled scans
  • Real-time scan progress via WebSockets instead of a client-side estimated progress bar
  • Redis-backed rate limiting for multi-worker/production deployments (the current in-memory limiter is per-process, by design, for single-instance use)
  • Role-based access control for team/multi-analyst usage
  • Dockerfile and docker-compose setup for one-command deployment
  • Automated test suite and CI pipeline

⚠️ Security & Disclaimer

VulnScope is built with security-conscious defaults, including:

  • Command-injection-safe target validation β€” scan targets are checked against a strict allow-list pattern before ever being passed to nmap, rejecting flag-injection and shell metacharacters.
  • CSRF protection on all state-changing requests (Flask-WTF).
  • Rate-limited authentication β€” login and registration are throttled per client IP to slow brute-force attempts.
  • Hardened sessions β€” HttpOnly and SameSite=Lax cookies by default, with Secure cookies configurable for production over HTTPS.
  • No hardcoded secret key β€” if SECRET_KEY isn't set, a random ephemeral key is generated per process (with a warning) rather than falling back to a static default.
  • Explicit CORS origin allow-listing for the /api/* routes instead of a wildcard origin.
  • Per-user data isolation β€” scans, reports, and settings are always scoped to current_user, and report downloads verify ownership before serving a file.

That said: this tool actively probes network hosts using Nmap. Only scan systems and networks you own or have explicit, written authorization to test. Unauthorized scanning of third-party systems may violate the law (e.g. the U.S. Computer Fraud and Abuse Act, the UK Computer Misuse Act, and equivalent laws elsewhere) and the acceptable-use policies of most networks and cloud providers. This project is intended for educational use, personal lab environments, and authorized security assessments only. The author assumes no liability for misuse.


πŸ‘€ Author

Gokul Krishnan S Final-year BCA student focused on offensive security & web application security


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

About

Professional Vulnerability Scanner Dashboard built using Flask, Python, SQLite and Nmap.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages