Scan. Score. Report. β Built with Flask, Nmap, and SQLAlchemy.
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.
- π Real network scanning β wraps the actual
nmapbinary viapython-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
| 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) |
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 withnmap. It validates the scan target against an allow-list regex before it ever reaches a subprocess call, builds the correctnmapargument set from the requested options, gracefully falls back to a safer scan if the primary one fails, and normalizes rawnmapXML output intoPort,Service, andVulnerabilityrows.- Blueprints (
main,auth,api) keep page rendering, authentication, and the JSON API cleanly separated. rate_limit.pywraps thelimitspackage into a one-lineis_rate_limited()helper used to throttle login/register attempts.
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
- Python 3.10+
- The
nmapcommand-line tool installed on the host OS.python-nmapis a wrapper around the realnmapbinary β 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.exeis on yourPATH. Also install Npcap alongside it β the official Windows installer offers this by default; without it,nmapcan exit "successfully" while returning no scan data.
- Debian/Ubuntu:
- Some scan options (OS detection, aggressive
-Amode) need raw-socket access and may require elevated/administrator privileges β otherwise VulnScope automatically falls back to a safer TCP-connect scan.
# 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.pyThe app starts at http://127.0.0.1:5000 by default (configurable via FLASK_HOST / FLASK_PORT in .env).
- Register an account from the landing page, then log in.
- 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.
- 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.
- Check the Dashboard β see your total scan count, severity distribution chart, recent activity, and recently discovered vulnerabilities at a glance.
- Browse History β search past scans by target/hostname/IP, or filter by severity, date, or protocol; delete scans you no longer need.
- Generate Reports β from History or the Reports page, export any scan as a PDF, HTML, or JSON file and download it directly.
- Adjust Settings β switch between dark/light theme, set your default export format, and toggle notifications. Preferences are saved per account.
Screenshots live in the
/screenshotsfolder. Add your own PNGs there with the file names below and they'll render automatically on GitHub.
| Dashboard | New Scan |
|---|---|
![]() |
![]() |
| Scan History | Reports |
|---|---|
![]() |
![]() |
- 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
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 β
HttpOnlyandSameSite=Laxcookies by default, withSecurecookies configurable for production over HTTPS. - No hardcoded secret key β if
SECRET_KEYisn'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.
Gokul Krishnan S Final-year BCA student focused on offensive security & web application security
- GitHub: @gokulkrishnan-s
This project is licensed under the MIT License β see the LICENSE file for details.



