vulnerability-scan 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vulnerability_scan-0.1.0/LICENSE +21 -0
- vulnerability_scan-0.1.0/PKG-INFO +262 -0
- vulnerability_scan-0.1.0/pyproject.toml +62 -0
- vulnerability_scan-0.1.0/setup.cfg +4 -0
- vulnerability_scan-0.1.0/vul-scan/README.md +203 -0
- vulnerability_scan-0.1.0/vul-scan/__init__.py +1 -0
- vulnerability_scan-0.1.0/vul-scan/__main__.py +339 -0
- vulnerability_scan-0.1.0/vul-scan/agent.py +44 -0
- vulnerability_scan-0.1.0/vul-scan/chunks_splitter.py +190 -0
- vulnerability_scan-0.1.0/vul-scan/config.py +19 -0
- vulnerability_scan-0.1.0/vul-scan/models.py +123 -0
- vulnerability_scan-0.1.0/vul-scan/printer.py +189 -0
- vulnerability_scan-0.1.0/vul-scan/prompt.py +172 -0
- vulnerability_scan-0.1.0/vul-scan/report.md +208 -0
- vulnerability_scan-0.1.0/vul-scan/report_generator.py +191 -0
- vulnerability_scan-0.1.0/vul-scan/report_writer.py +342 -0
- vulnerability_scan-0.1.0/vul-scan/utils.py +46 -0
- vulnerability_scan-0.1.0/vulnerability_scan.egg-info/PKG-INFO +262 -0
- vulnerability_scan-0.1.0/vulnerability_scan.egg-info/SOURCES.txt +21 -0
- vulnerability_scan-0.1.0/vulnerability_scan.egg-info/dependency_links.txt +1 -0
- vulnerability_scan-0.1.0/vulnerability_scan.egg-info/entry_points.txt +2 -0
- vulnerability_scan-0.1.0/vulnerability_scan.egg-info/requires.txt +11 -0
- vulnerability_scan-0.1.0/vulnerability_scan.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CBRS-503
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vulnerability-scan
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI-powered multi-agent OWASP vulnerability scanner using LangChain and Groq
|
|
5
|
+
Author: CBRS-503
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 CBRS-503
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/alinoureldin707/vulnerability-scan
|
|
29
|
+
Project-URL: Repository, https://github.com/alinoureldin707/vulnerability-scan
|
|
30
|
+
Project-URL: Bug Tracker, https://github.com/alinoureldin707/vulnerability-scan/issues
|
|
31
|
+
Project-URL: Changelog, https://github.com/alinoureldin707/vulnerability-scan/releases
|
|
32
|
+
Keywords: security,owasp,vulnerability,scanner,langchain,groq,sast,ai
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: Intended Audience :: Information Technology
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Topic :: Security
|
|
42
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
43
|
+
Classifier: Topic :: Software Development :: Testing
|
|
44
|
+
Classifier: Natural Language :: English
|
|
45
|
+
Requires-Python: >=3.11
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
License-File: LICENSE
|
|
48
|
+
Requires-Dist: langchain>=0.3
|
|
49
|
+
Requires-Dist: langchain-groq>=0.2
|
|
50
|
+
Requires-Dist: pydantic>=2.0
|
|
51
|
+
Requires-Dist: python-dotenv>=1.0
|
|
52
|
+
Requires-Dist: rich>=13.0
|
|
53
|
+
Requires-Dist: python-docx>=1.1
|
|
54
|
+
Requires-Dist: matplotlib>=3.8
|
|
55
|
+
Provides-Extra: dev
|
|
56
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
57
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
58
|
+
Dynamic: license-file
|
|
59
|
+
|
|
60
|
+
# OWASP Security Scanner
|
|
61
|
+
|
|
62
|
+
[](https://pypi.org/project/vulnerability-scan/)
|
|
63
|
+
[](https://pypi.org/project/vulnerability-scan/)
|
|
64
|
+
[](https://opensource.org/licenses/MIT)
|
|
65
|
+
|
|
66
|
+
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`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install vulnerability-scan
|
|
74
|
+
export GROQ_API_KEY=gsk_... # or add to a .env file
|
|
75
|
+
vulnerability-scan ./your-project
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Pipeline Overview
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Source files
|
|
86
|
+
│
|
|
87
|
+
▼
|
|
88
|
+
[agent_splitter] ── LLM splits each file into logical chunks (functions / classes / routes)
|
|
89
|
+
│
|
|
90
|
+
▼
|
|
91
|
+
[agent_finder] ── identifies OWASP Top-10 vulnerabilities per chunk
|
|
92
|
+
│
|
|
93
|
+
▼
|
|
94
|
+
[agent_mitigator] ── produces fix recommendation + corrected code per finding
|
|
95
|
+
│
|
|
96
|
+
▼
|
|
97
|
+
[agent_verifier] ── drops false positives, adjusts confidence scores
|
|
98
|
+
│
|
|
99
|
+
▼
|
|
100
|
+
[aggregator] ── deduplicates by (file, OWASP ID, line)
|
|
101
|
+
│
|
|
102
|
+
▼
|
|
103
|
+
report.json + report.md
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Prerequisites
|
|
109
|
+
|
|
110
|
+
| Requirement | Version |
|
|
111
|
+
| ------------ | -------------------------------------------- |
|
|
112
|
+
| Python | ≥ 3.11 |
|
|
113
|
+
| Groq API key | [console.groq.com](https://console.groq.com) |
|
|
114
|
+
|
|
115
|
+
### Install from PyPI
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pip install vulnerability-scan
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Install from source
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
git clone https://github.com/alinoureldin707/vulnerability-scan.git
|
|
125
|
+
cd vulnerability-scan
|
|
126
|
+
pip install .
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Configuration
|
|
132
|
+
|
|
133
|
+
Create a `.env` file in the project root:
|
|
134
|
+
|
|
135
|
+
```env
|
|
136
|
+
GROQ_API_KEY=gsk_...
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The model and temperature are set in `config.py`:
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
MODEL_NAME = "openai/gpt-oss-20b" # any Groq-hosted model
|
|
143
|
+
TEMPERATURE = 0.0
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Usage
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Scan a directory (all supported source files)
|
|
152
|
+
vulnerability-scan ./project
|
|
153
|
+
|
|
154
|
+
# Scan a single file
|
|
155
|
+
vulnerability-scan ./project/vulnerable_app.py
|
|
156
|
+
|
|
157
|
+
# Also generate a .docx professional report
|
|
158
|
+
vulnerability-scan ./project --report
|
|
159
|
+
|
|
160
|
+
# Default (scans ./project if no argument given)
|
|
161
|
+
vulnerability-scan
|
|
162
|
+
|
|
163
|
+
# Alternatively, run as a module
|
|
164
|
+
python -m vul_scan ./project
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Outputs are written to the current working directory:
|
|
168
|
+
|
|
169
|
+
| File | Description |
|
|
170
|
+
| ------------- | -------------------------------------------------------------------- |
|
|
171
|
+
| `report.json` | Machine-readable findings with risk analysis |
|
|
172
|
+
| `report.md` | Human-readable report with severity tables, evidence, and fixed code |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Output Format
|
|
177
|
+
|
|
178
|
+
### `report.json` structure
|
|
179
|
+
|
|
180
|
+
```jsonc
|
|
181
|
+
{
|
|
182
|
+
"generated_at": "2026-02-20T19:22:13Z",
|
|
183
|
+
"scanned_path": "...",
|
|
184
|
+
"total_files": 5,
|
|
185
|
+
"total_chunks": 7,
|
|
186
|
+
"total_findings": 2,
|
|
187
|
+
"risk_analysis": {
|
|
188
|
+
// aggregate across all findings
|
|
189
|
+
"overall_risk": "HIGH",
|
|
190
|
+
"severity_breakdown": { "high": 2, "medium": 0, "low": 0 },
|
|
191
|
+
"owasp_category_breakdown": { "A03:2021": 1 },
|
|
192
|
+
"most_affected_files": [{ "file": "...", "findings": 2 }],
|
|
193
|
+
},
|
|
194
|
+
"findings": [
|
|
195
|
+
{
|
|
196
|
+
"file": "...",
|
|
197
|
+
"owasp_id": "A03:2021",
|
|
198
|
+
"name": "SQL Injection",
|
|
199
|
+
"risk_summary": "...",
|
|
200
|
+
"description": "...",
|
|
201
|
+
"evidence": "...",
|
|
202
|
+
"line_start": 10,
|
|
203
|
+
"line_end": 14,
|
|
204
|
+
"exploitation_steps": ["..."],
|
|
205
|
+
"impact": "...",
|
|
206
|
+
"confidence": 0.97,
|
|
207
|
+
"mitigation": "...",
|
|
208
|
+
"fix_line_start": 10,
|
|
209
|
+
"fix_line_end": 14,
|
|
210
|
+
"fixed_code": "...",
|
|
211
|
+
"risk_analysis": {
|
|
212
|
+
// per-finding risk analysis
|
|
213
|
+
"severity": "HIGH",
|
|
214
|
+
"likelihood": "HIGH",
|
|
215
|
+
"risk_score": 9.7,
|
|
216
|
+
"remediation_priority": "P1 — Immediate",
|
|
217
|
+
"attack_vector": "Injection",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Exit codes
|
|
225
|
+
|
|
226
|
+
| Code | Meaning |
|
|
227
|
+
| ---- | ------------------------------------ |
|
|
228
|
+
| `0` | No verified vulnerabilities found |
|
|
229
|
+
| `1` | One or more vulnerabilities detected |
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Project Structure
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
.
|
|
237
|
+
├── __main__.py # Orchestration entry point
|
|
238
|
+
├── agent.py # LLM agent definitions (finder, mitigator, verifier)
|
|
239
|
+
├── chuncks_splitter.py # agent_splitter (LLM) file → CodeChunk splitting
|
|
240
|
+
├── config.py # Model name, temperature, API key loading
|
|
241
|
+
├── models.py # Pydantic data models for all pipeline stages
|
|
242
|
+
├── printer.py # Rich terminal output helpers
|
|
243
|
+
├── prompt.py # System prompts for all agents
|
|
244
|
+
├── report_writer.py # report.json + report.md generation
|
|
245
|
+
├── .env # GROQ_API_KEY (not committed)
|
|
246
|
+
└── project/ # Example target code
|
|
247
|
+
├── vulnerable_app.py
|
|
248
|
+
├── no_vulnerable.py
|
|
249
|
+
├── test.py
|
|
250
|
+
├── test.js
|
|
251
|
+
└── test.ts
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Supported Languages
|
|
257
|
+
|
|
258
|
+
| Language | Extensions |
|
|
259
|
+
| ---------- | ------------- |
|
|
260
|
+
| Python | `.py` |
|
|
261
|
+
| JavaScript | `.js`, `.jsx` |
|
|
262
|
+
| TypeScript | `.ts`, `.tsx` |
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vulnerability-scan"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "AI-powered multi-agent OWASP vulnerability scanner using LangChain and Groq"
|
|
9
|
+
readme = "vul-scan/README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "CBRS-503" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["security", "owasp", "vulnerability", "scanner", "langchain", "groq", "sast", "ai"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Information Technology",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Topic :: Security",
|
|
26
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
27
|
+
"Topic :: Software Development :: Testing",
|
|
28
|
+
"Natural Language :: English",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"langchain>=0.3",
|
|
32
|
+
"langchain-groq>=0.2",
|
|
33
|
+
"pydantic>=2.0",
|
|
34
|
+
"python-dotenv>=1.0",
|
|
35
|
+
"rich>=13.0",
|
|
36
|
+
"python-docx>=1.1",
|
|
37
|
+
"matplotlib>=3.8",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/alinoureldin707/vulnerability-scan"
|
|
42
|
+
Repository = "https://github.com/alinoureldin707/vulnerability-scan"
|
|
43
|
+
"Bug Tracker" = "https://github.com/alinoureldin707/vulnerability-scan/issues"
|
|
44
|
+
Changelog = "https://github.com/alinoureldin707/vulnerability-scan/releases"
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
vulnerability-scan = "vul_scan.__main__:main"
|
|
48
|
+
|
|
49
|
+
[project.optional-dependencies]
|
|
50
|
+
dev = [
|
|
51
|
+
"build>=1.0",
|
|
52
|
+
"twine>=5.0",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools]
|
|
56
|
+
packages = ["vul_scan"]
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.package-dir]
|
|
59
|
+
"vul_scan" = "vul-scan"
|
|
60
|
+
|
|
61
|
+
[tool.setuptools.package-data]
|
|
62
|
+
"vul_scan" = ["*.md"]
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# OWASP Security Scanner
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/vulnerability-scan/)
|
|
4
|
+
[](https://pypi.org/project/vulnerability-scan/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
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`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install vulnerability-scan
|
|
15
|
+
export GROQ_API_KEY=gsk_... # or add to a .env file
|
|
16
|
+
vulnerability-scan ./your-project
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Pipeline Overview
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Source files
|
|
27
|
+
│
|
|
28
|
+
▼
|
|
29
|
+
[agent_splitter] ── LLM splits each file into logical chunks (functions / classes / routes)
|
|
30
|
+
│
|
|
31
|
+
▼
|
|
32
|
+
[agent_finder] ── identifies OWASP Top-10 vulnerabilities per chunk
|
|
33
|
+
│
|
|
34
|
+
▼
|
|
35
|
+
[agent_mitigator] ── produces fix recommendation + corrected code per finding
|
|
36
|
+
│
|
|
37
|
+
▼
|
|
38
|
+
[agent_verifier] ── drops false positives, adjusts confidence scores
|
|
39
|
+
│
|
|
40
|
+
▼
|
|
41
|
+
[aggregator] ── deduplicates by (file, OWASP ID, line)
|
|
42
|
+
│
|
|
43
|
+
▼
|
|
44
|
+
report.json + report.md
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Prerequisites
|
|
50
|
+
|
|
51
|
+
| Requirement | Version |
|
|
52
|
+
| ------------ | -------------------------------------------- |
|
|
53
|
+
| Python | ≥ 3.11 |
|
|
54
|
+
| Groq API key | [console.groq.com](https://console.groq.com) |
|
|
55
|
+
|
|
56
|
+
### Install from PyPI
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install vulnerability-scan
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Install from source
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/alinoureldin707/vulnerability-scan.git
|
|
66
|
+
cd vulnerability-scan
|
|
67
|
+
pip install .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
Create a `.env` file in the project root:
|
|
75
|
+
|
|
76
|
+
```env
|
|
77
|
+
GROQ_API_KEY=gsk_...
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The model and temperature are set in `config.py`:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
MODEL_NAME = "openai/gpt-oss-20b" # any Groq-hosted model
|
|
84
|
+
TEMPERATURE = 0.0
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Scan a directory (all supported source files)
|
|
93
|
+
vulnerability-scan ./project
|
|
94
|
+
|
|
95
|
+
# Scan a single file
|
|
96
|
+
vulnerability-scan ./project/vulnerable_app.py
|
|
97
|
+
|
|
98
|
+
# Also generate a .docx professional report
|
|
99
|
+
vulnerability-scan ./project --report
|
|
100
|
+
|
|
101
|
+
# Default (scans ./project if no argument given)
|
|
102
|
+
vulnerability-scan
|
|
103
|
+
|
|
104
|
+
# Alternatively, run as a module
|
|
105
|
+
python -m vul_scan ./project
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Outputs are written to the current working directory:
|
|
109
|
+
|
|
110
|
+
| File | Description |
|
|
111
|
+
| ------------- | -------------------------------------------------------------------- |
|
|
112
|
+
| `report.json` | Machine-readable findings with risk analysis |
|
|
113
|
+
| `report.md` | Human-readable report with severity tables, evidence, and fixed code |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Output Format
|
|
118
|
+
|
|
119
|
+
### `report.json` structure
|
|
120
|
+
|
|
121
|
+
```jsonc
|
|
122
|
+
{
|
|
123
|
+
"generated_at": "2026-02-20T19:22:13Z",
|
|
124
|
+
"scanned_path": "...",
|
|
125
|
+
"total_files": 5,
|
|
126
|
+
"total_chunks": 7,
|
|
127
|
+
"total_findings": 2,
|
|
128
|
+
"risk_analysis": {
|
|
129
|
+
// aggregate across all findings
|
|
130
|
+
"overall_risk": "HIGH",
|
|
131
|
+
"severity_breakdown": { "high": 2, "medium": 0, "low": 0 },
|
|
132
|
+
"owasp_category_breakdown": { "A03:2021": 1 },
|
|
133
|
+
"most_affected_files": [{ "file": "...", "findings": 2 }],
|
|
134
|
+
},
|
|
135
|
+
"findings": [
|
|
136
|
+
{
|
|
137
|
+
"file": "...",
|
|
138
|
+
"owasp_id": "A03:2021",
|
|
139
|
+
"name": "SQL Injection",
|
|
140
|
+
"risk_summary": "...",
|
|
141
|
+
"description": "...",
|
|
142
|
+
"evidence": "...",
|
|
143
|
+
"line_start": 10,
|
|
144
|
+
"line_end": 14,
|
|
145
|
+
"exploitation_steps": ["..."],
|
|
146
|
+
"impact": "...",
|
|
147
|
+
"confidence": 0.97,
|
|
148
|
+
"mitigation": "...",
|
|
149
|
+
"fix_line_start": 10,
|
|
150
|
+
"fix_line_end": 14,
|
|
151
|
+
"fixed_code": "...",
|
|
152
|
+
"risk_analysis": {
|
|
153
|
+
// per-finding risk analysis
|
|
154
|
+
"severity": "HIGH",
|
|
155
|
+
"likelihood": "HIGH",
|
|
156
|
+
"risk_score": 9.7,
|
|
157
|
+
"remediation_priority": "P1 — Immediate",
|
|
158
|
+
"attack_vector": "Injection",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Exit codes
|
|
166
|
+
|
|
167
|
+
| Code | Meaning |
|
|
168
|
+
| ---- | ------------------------------------ |
|
|
169
|
+
| `0` | No verified vulnerabilities found |
|
|
170
|
+
| `1` | One or more vulnerabilities detected |
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Project Structure
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
.
|
|
178
|
+
├── __main__.py # Orchestration entry point
|
|
179
|
+
├── agent.py # LLM agent definitions (finder, mitigator, verifier)
|
|
180
|
+
├── chuncks_splitter.py # agent_splitter (LLM) file → CodeChunk splitting
|
|
181
|
+
├── config.py # Model name, temperature, API key loading
|
|
182
|
+
├── models.py # Pydantic data models for all pipeline stages
|
|
183
|
+
├── printer.py # Rich terminal output helpers
|
|
184
|
+
├── prompt.py # System prompts for all agents
|
|
185
|
+
├── report_writer.py # report.json + report.md generation
|
|
186
|
+
├── .env # GROQ_API_KEY (not committed)
|
|
187
|
+
└── project/ # Example target code
|
|
188
|
+
├── vulnerable_app.py
|
|
189
|
+
├── no_vulnerable.py
|
|
190
|
+
├── test.py
|
|
191
|
+
├── test.js
|
|
192
|
+
└── test.ts
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Supported Languages
|
|
198
|
+
|
|
199
|
+
| Language | Extensions |
|
|
200
|
+
| ---------- | ------------- |
|
|
201
|
+
| Python | `.py` |
|
|
202
|
+
| JavaScript | `.js`, `.jsx` |
|
|
203
|
+
| TypeScript | `.ts`, `.tsx` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# vul_scan package
|