AI-powered multi-agent OWASP vulnerability scanner using LangChain and Groq
Project description
OWASP Security Scanner
A multi-agent static analysis pipeline that scans source files in any programming language for OWASP Top-10 vulnerabilities. It produces a structured report.json and a human-readable report.md.
Quick Start
pip install vulnerability-scan
export GROQ_API_KEY=gsk_... # or add to a .env file
vulnerability-scan ./your-project
Pipeline Overview
Source files
│
▼
[agent_splitter] ── LLM splits each file into logical chunks (functions / classes / routes)
│
▼
[agent_finder] ── identifies OWASP Top-10 vulnerabilities per chunk
│
▼
[agent_mitigator] ── produces fix recommendation + corrected code per finding
│
▼
[agent_verifier] ── drops false positives, adjusts confidence scores
│
▼
[aggregator] ── deduplicates by (file, OWASP ID, line)
│
▼
report.json + report.md
Prerequisites
| Requirement | Version |
|---|---|
| Python | ≥ 3.11 |
| Groq API key | console.groq.com |
Install from PyPI
pip install vulnerability-scan
Install from source
git clone https://github.com/alinoureldin707/vulnerability-scan.git
cd vulnerability-scan
pip install .
Configuration
Create a .env file in the project root:
GROQ_API_KEY=gsk_...
The model and temperature are set in config.py:
MODEL_NAME = "openai/gpt-oss-20b" # any Groq-hosted model
TEMPERATURE = 0.0
Usage
# Scan a directory (all supported source files)
vulnerability-scan ./project
# Scan a single file
vulnerability-scan ./project/vulnerable_app.py
# Also generate a .docx professional report
vulnerability-scan ./project --report
# Default (scans ./project if no argument given)
vulnerability-scan
# Alternatively, run as a module
python -m vul_scan ./project
Outputs are written to the current working directory:
| File | Description |
|---|---|
report.json |
Machine-readable findings with risk analysis |
report.md |
Human-readable report with severity tables, evidence, and fixed code |
Output Format
report.json structure
{
"generated_at": "2026-02-20T19:22:13Z",
"scanned_path": "...",
"total_files": 5,
"total_chunks": 7,
"total_findings": 2,
"risk_analysis": {
// aggregate across all findings
"overall_risk": "HIGH",
"severity_breakdown": { "high": 2, "medium": 0, "low": 0 },
"owasp_category_breakdown": { "A03:2021": 1 },
"most_affected_files": [{ "file": "...", "findings": 2 }],
},
"findings": [
{
"file": "...",
"owasp_id": "A03:2021",
"name": "SQL Injection",
"risk_summary": "...",
"description": "...",
"evidence": "...",
"line_start": 10,
"line_end": 14,
"exploitation_steps": ["..."],
"impact": "...",
"confidence": 0.97,
"mitigation": "...",
"fix_line_start": 10,
"fix_line_end": 14,
"fixed_code": "...",
"risk_analysis": {
// per-finding risk analysis
"severity": "HIGH",
"likelihood": "HIGH",
"risk_score": 9.7,
"remediation_priority": "P1 — Immediate",
"attack_vector": "Injection",
},
},
],
}
Exit codes
| Code | Meaning |
|---|---|
0 |
No verified vulnerabilities found |
1 |
One or more vulnerabilities detected |
Project Structure
.
├── __main__.py # Orchestration entry point
├── agent.py # LLM agent definitions (finder, mitigator, verifier)
├── chuncks_splitter.py # agent_splitter (LLM) file → CodeChunk splitting
├── config.py # Model name, temperature, API key loading
├── models.py # Pydantic data models for all pipeline stages
├── printer.py # Rich terminal output helpers
├── prompt.py # System prompts for all agents
├── report_writer.py # report.json + report.md generation
├── .env # GROQ_API_KEY (not committed)
└── project/ # Example target code
├── vulnerable_app.py
├── no_vulnerable.py
├── test.py
├── test.js
└── test.ts
Supported Languages
| Language | Extensions |
|---|---|
| Python | .py |
| JavaScript | .js, .jsx |
| TypeScript | .ts, .tsx |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vulnerability_scan-0.3.0.tar.gz.
File metadata
- Download URL: vulnerability_scan-0.3.0.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3543f2e4a8febdd5b335f4015ee86ba922aed33e344fcf8759436cb628e1bec8
|
|
| MD5 |
0fc440379e6678235e5ef07d853f7481
|
|
| BLAKE2b-256 |
c6636be5d7aab4de3b934d9e22c53c05e81367db1c0d615961b21063f249602d
|
File details
Details for the file vulnerability_scan-0.3.0-py3-none-any.whl.
File metadata
- Download URL: vulnerability_scan-0.3.0-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fcdf063c771ff5b5802b079f6d20ffaad6b43a5f5488703ac64a5f2aa2207d9
|
|
| MD5 |
4f3b05626f665c7b12acb218de9faa91
|
|
| BLAKE2b-256 |
907d303eea8d77e2aed81ee49708a408dfd33e78dbd53b7d47a18db979e7b7be
|