Fast, lightweight Python/Flask scanner that crawls a target, probes for reflected XSS and basic SQL injection, checks missing security headers, and produces JSON + rich HTML reports.
- Deployed app: https://web-vuln-scanner-5yqr.onrender.com
- Reflected XSS detection for GET parameters and HTML forms (GET/POST)
- Basic and errorβbased SQLi detection via payloads and signature matching
- Missing security header checks: CSP, XβFrameβOptions, XβContentβTypeβOptions, ReferrerβPolicy, PermissionsβPolicy, and HSTS (HTTPS)
- Sameβorigin BFS crawler with auto depth and page cap
- Form discovery and testing with payload injection
- Parallel requests using
ThreadPoolExecutorand Requests connection pooling - JSON report generation plus a filterable HTML report UI
- Flask web UI to start scans and view/download reports
- Minimal REST endpoint to poll scan status
Technologies: Python, Flask, Requests, BeautifulSoup.
- The Flask UI queues a background thread per scan and exposes pages for task status and report viewing/downloading.
- The scanner core crawls sameβorigin pages, tests forms and GET params with SQLi/XSS payloads, and performs baseline header analysis.
- Results are aggregated and written to
report.json; the HTML report view enriches and summarizes findings.
ββββββββββββ HTTP βββββββββββββββ orchestrates βββββββββββββββββββββββββββββββββ
β Browser β ββββββββββββββΆ β Flask UI β ββββββββββββββββββββββββββΆ β Scanner Core (crawler, tests) β
ββββββββββββ β webapp/app β β injector/analyzer/requester β
βββββββ¬ββββββββ βββββββββββββββββ¬ββββββββββββββββ
β JSON file HTTP to target
βΌ
βββββββββββββββ
β report.json β βββΆ HTML report view (templates/report.html)
βββββββββββββββ
- Python 3.x
- Flask (web UI)
- Requests (HTTP client with retry/connection pooling)
- BeautifulSoup4 (HTML parsing)
- Standard library:
concurrent.futures,urllib.parse,threading,json
Windows PowerShell commands shown; adapt for your OS if needed.
- Clone and enter the project
git clone https://github.com/AniketBansod/web-vuln-scanner.git
cd web-vuln-scanner\vuln_scanner- Create a virtual environment and install dependencies
python -m venv .venv
\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt- (Optional) PowerShell policy if activation is blocked:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
\.venv\Scripts\Activate.ps1python .\webapp\app.pyOpen http://127.0.0.1:5001 and submit a target URL you are authorized to test.
# From the vuln_scanner directory
python -m scanner.main "http://example.test/path?param=value" 2 50Arguments:
target_url(required) β starting URLdepth(optional, default auto=2) β crawl depth (0 = only the given page)max_pages(optional, default=50) β page crawl cap
- For production, run via Gunicorn (already configured in the Docker image) or another WSGI server.
- Start a scan from the UIβs home page by entering a URL.
- Youβll be redirected to a task page that polls status; when complete, open the HTML report or download the JSON.
Example JSON report (trimmed):
{
"target": "http://example.test",
"timestamp": "2025-01-01 12:00:00",
"findings": [
{
"type": "XSS-reflected",
"param": "q",
"payload": "<script>alert(1)</script>",
"url": "http://example.test/?q=%3Cscript%3Ealert(1)%3C/script%3E",
"evidence": "payload reflected in response body"
}
]
}Screenshots are illustrative; findings and counts vary per target. Only scan systems you are authorized to test.
- No required environment variables for local development.
- Defaults you can tune in code:
- Crawl depth (UI):
depth = 2inwebapp/app.py(POST handler on/). - Concurrency and limits: see
scan_targetinscanner/main.py(workers,max_pages). - Port:
webapp/app.pyruns on5001. - Secret key:
app.secret_keyis set inwebapp/app.py; change before deploying.
- Crawl depth (UI):
GET /β Home page; form to start a scan.POST /β Submittarget_url; enqueues a background scan and redirects to task page.GET /task/<task_id>β Task status page.GET /task/<task_id>/status.jsonβ JSON status for polling:{ status: queued|running|done|error, target, reportView, reportDownload }
GET /report/<task_id>/viewβ HTML report view.GET /report/<task_id>/downloadβ Download the JSON report.
- Parallel perβpage scanning via
ThreadPoolExecutor. - Requests session with retry and pooled connections for better throughput.
- Simple heuristics (e.g., response length change) to flag suspected SQLi when no explicit error signature is found.
vuln_scanner/
scanner/ # Core scanning library
main.py # Orchestrates crawl β scan β report (CLI entry)
crawler.py # Sameβorigin BFS crawler
form_tester.py # Parse and test forms (GET/POST)
injector.py # Generate parameterized test cases
analyzer.py # Header checks, SQL error & XSS reflection helpers
requester.py # Session with retries + connection pooling
signatures.py # Payloads and regex signatures
reporter.py # JSON report writer + console prettyβprint
webapp/ # Flask UI
app.py # Routes, background task, recent reports, status JSON
templates/ # index.html, task.html, report.html
static/ # style.css
reports/ # Saved JSON reports
requirements.txt
README.md
- Use only on systems you own or are explicitly authorized to test.
- Sameβorigin scoping in the crawler limits traversal to the target host.
- Heuristic detection only; results can contain false positives/negatives.
- Not implemented: JWT/OAuth flows, rate limiting, roleβbased access, CSRFβaware sequences.
This project is already deployed. See the Live Demo link above. If you need to selfβhost later, you can build and run the Docker image locally or on any container platform.
- DOMβbased XSS and clientβside sink detection
- Timeβbased/blind SQLi strategies and more DB error signatures
- Auth/session handling and scripted form/login flows
- Smarter crawl (robots.txt, sitemap.xml, rate control, exclusions)
- Enhanced report UI: perβpage grouping, diffing across runs, export formats
- Configurable payload sets and perβhost tuning
- Proxy support and request throttling
- Headless browser integration for JSβheavy apps
- Optional
.envbased configuration and logging levels
Released under the MIT License. See LICENSE for the full text.
Copyright (c) 2025 Aniket Bansod. Permission is granted to use this project for educational or commercial purposes under the terms above. The software is provided "AS IS" without warranty; always obtain proper authorization before scanning any target.
- Built with Flask, Requests, and BeautifulSoup.
- Informed by common OWASP testing techniques and public test targets.

