kramscan 0.3.0 β 0.4.0
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.
- package/README.md +215 -293
- package/dist/agent/skills/generate-report.js +1 -1
- package/dist/agent/skills/health-check.d.ts +2 -2
- package/dist/agent/skills/health-check.js +2 -2
- package/dist/agent/skills/verify-finding.js +1 -1
- package/dist/agent/skills/web-scan.d.ts +1 -1
- package/dist/agent/skills/web-scan.js +1 -1
- package/dist/cli.js +7 -2
- package/dist/commands/config.js +2 -2
- package/dist/commands/dev.js +4 -1
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/gate.js +3 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.js +191 -0
- package/dist/commands/onboard.js +2 -2
- package/dist/commands/report.js +89 -11
- package/dist/commands/scan.js +10 -5
- package/dist/core/config.js +8 -1
- package/dist/core/project-config.d.ts +59 -0
- package/dist/core/project-config.js +104 -0
- package/dist/core/server-probe.js +1 -3
- package/dist/index.js +14 -0
- package/dist/plugins/vulnerabilities/CORSAnalyzerPlugin.js +0 -1
- package/dist/plugins/vulnerabilities/DebugEndpointPlugin.d.ts +1 -1
- package/dist/plugins/vulnerabilities/DebugEndpointPlugin.js +1 -1
- package/dist/plugins/vulnerabilities/DirectoryTraversalPlugin.d.ts +1 -1
- package/dist/plugins/vulnerabilities/DirectoryTraversalPlugin.js +1 -1
- package/dist/plugins/vulnerabilities/OpenRedirectPlugin.d.ts +1 -1
- package/dist/plugins/vulnerabilities/OpenRedirectPlugin.js +1 -1
- package/dist/reports/PdfGenerator.js +1 -0
- package/dist/utils/logger.js +3 -3
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -3,298 +3,160 @@
|
|
|
3
3
|
|
|
4
4
|
<h3 align="center">AI-Powered Web Application Security Testing CLI</h3>
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
[](https://github.com/shaikhakramshakil/kramscan/actions)
|
|
8
7
|
[](https://www.npmjs.com/package/kramscan)
|
|
9
8
|
[](https://www.npmjs.com/package/kramscan)
|
|
10
9
|
[](https://github.com/shaikhakramshakil/kramscan/blob/main/LICENSE)
|
|
11
|
-
[](https://github.com/shaikhakramshakil/kramscan)
|
|
12
10
|
[](https://www.typescriptlang.org)
|
|
13
11
|
[](https://nodejs.org)
|
|
14
12
|
|
|
15
|
-
<br />
|
|
16
|
-
|
|
17
|
-
π¬ **A next-generation security auditing tool that combines automated vulnerability scanning with multi-provider AI analysis.**
|
|
18
|
-
|
|
19
|
-
*Empowering developers and security researchers with institutional-grade insights, modular plugin architecture, and an interactive AI agent.*
|
|
20
|
-
|
|
21
|
-
<br />
|
|
22
|
-
|
|
23
|
-
[π NPM Package](https://www.npmjs.com/package/kramscan) Β· [π Documentation](#-usage) Β· [π Report Bug](https://github.com/shaikhakramshakil/kramscan/issues)
|
|
24
|
-
|
|
25
13
|
</div>
|
|
26
14
|
|
|
27
15
|
---
|
|
28
16
|
|
|
29
|
-
|
|
17
|
+
KramScan is a command-line security auditing tool that combines automated vulnerability scanning with multi-provider AI analysis. It orchestrates headless browser crawling, runs a modular plugin system against discovered pages, and passes findings through a generative AI layer (OpenAI, Gemini, Anthropic, and others) to produce actionable, context-aware reports.
|
|
30
18
|
|
|
31
|
-
|
|
32
|
-
Web security is complex and often fragmented. Developers rely on multiple disjointed tools for scanning, manual testing, and reporting. Traditional automated scanners generate noise without context, and manual pentesting is time-consuming and expensive.
|
|
33
|
-
|
|
34
|
-
**KramScan bridges this gap.** We provide a unified command-line interface that orchestrates headless browser scanning, scrapes critical security headers, leverages **Generative AI** (OpenAI, Gemini, Anthropic) for analysis, and features a **modular plugin system** for extensibility. It delivers actionable, human-readable insights alongside raw vulnerability dataβall in seconds.
|
|
35
|
-
|
|
36
|
-
<br />
|
|
19
|
+
[NPM Package](https://www.npmjs.com/package/kramscan) Β· [Documentation](#usage--commands) Β· [Report Bug](https://github.com/shaikhakramshakil/kramscan/issues) Β· [Request Feature](https://github.com/shaikhakramshakil/kramscan/issues)
|
|
37
20
|
|
|
38
21
|
---
|
|
39
22
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
| π **Professional Reporting** | Generates detailed PDF, DOCX, TXT, and JSON reports with remediation steps and error tracking. |
|
|
54
|
-
| π **Headless Browser Testing** | Renders modern SPAs (Single Page Applications) to find vulnerabilities in dynamic content. |
|
|
55
|
-
| β‘ **Smarter User Flow** | Interactive menu and post-scan "Golden Path" prompts for a guided experience. |
|
|
56
|
-
| π‘οΈ **Error Resilience** | Robust configuration defaults and graceful recovery if individual URLs or plugins fail. |
|
|
57
|
-
|
|
58
|
-
<br />
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **Automated vulnerability detection** β XSS, SQL injection, CSRF, insecure headers, CORS misconfigurations, open redirects, and more.
|
|
26
|
+
- **10 built-in security plugins** β CORS, debug endpoints, directory traversal, cookie auditing, open redirects, sensitive data exposure, and others. Easily extensible.
|
|
27
|
+
- **Dev mode (watch scanner)** β Watches your localhost for file changes and auto re-scans, showing a diff of new vs. resolved findings.
|
|
28
|
+
- **CI/CD security gate** β `kramscan gate` exits with code 1 when vulnerabilities exceed a configurable threshold.
|
|
29
|
+
- **Interactive AI agent** β Conversational security assistant with autonomous verification capabilities to confirm findings live.
|
|
30
|
+
- **Multi-provider AI analysis** β Supports OpenAI, Anthropic, Google Gemini, Mistral, OpenRouter, Groq, and Kimi.
|
|
31
|
+
- **AI executive summaries** β Generates business-oriented summaries included in Word, JSON, and TXT reports.
|
|
32
|
+
- **Professional reporting** β PDF, DOCX, Markdown, TXT, and JSON output with remediation steps and error tracking.
|
|
33
|
+
- **Headless browser testing** β Renders SPAs via Puppeteer to find vulnerabilities in dynamically generated content.
|
|
34
|
+
- **Real-time feedback** β Event-driven progress with live spinners and vulnerability alerts during scanning.
|
|
35
|
+
- **Error resilience** β Graceful recovery when individual URLs or plugins fail; errors are logged but never halt a scan.
|
|
59
36
|
|
|
60
37
|
---
|
|
61
38
|
|
|
62
|
-
|
|
39
|
+
## Quick Start
|
|
63
40
|
|
|
64
|
-
|
|
41
|
+
### Installation
|
|
65
42
|
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
A[User Command] --> B{CLI Controller};
|
|
69
|
-
B --> C[Scanner Module<br/>Puppeteer / Plugin System];
|
|
70
|
-
B --> D[AI Agent<br/>NLP Processing];
|
|
71
|
-
|
|
72
|
-
C --> E[Plugin Manager<br/>XSS / SQLi / Headers / CSRF];
|
|
73
|
-
E --> F[Vulnerability Detection];
|
|
74
|
-
C --> G[Event System<br/>Progress / Results];
|
|
75
|
-
|
|
76
|
-
F & G --> H[AI Analysis Engine<br/>LLM Provider];
|
|
77
|
-
|
|
78
|
-
H --> I[Risk Assessment<br/>Confidence Scoring];
|
|
79
|
-
I --> J[Report Generator<br/>PDF / DOCX / JSON / TXT];
|
|
80
|
-
J --> K((Final Output<br/>+ Error Report));
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g kramscan
|
|
81
45
|
```
|
|
82
46
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
### Plugin Architecture
|
|
47
|
+
Or run directly without installing:
|
|
86
48
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
src/plugins/
|
|
91
|
-
βββ types.ts # Base interfaces and types
|
|
92
|
-
βββ PluginManager.ts # Plugin orchestration
|
|
93
|
-
βββ index.ts # Plugin exports
|
|
94
|
-
βββ vulnerabilities/ # Built-in plugins
|
|
95
|
-
βββ XSSPlugin.ts # Cross-Site Scripting
|
|
96
|
-
βββ SQLInjectionPlugin.ts # SQL Injection
|
|
97
|
-
βββ SecurityHeadersPlugin.ts # Missing security headers
|
|
98
|
-
βββ SensitiveDataPlugin.ts # Exposed secrets & API keys
|
|
99
|
-
βββ CSRFPlugin.ts # Cross-Site Request Forgery
|
|
100
|
-
βββ CORSAnalyzerPlugin.ts # CORS misconfiguration
|
|
101
|
-
βββ DebugEndpointPlugin.ts # Exposed debug/dev endpoints
|
|
102
|
-
βββ DirectoryTraversalPlugin.ts # Path traversal / LFI
|
|
103
|
-
βββ CookieSecurityPlugin.ts # Insecure cookie flags
|
|
104
|
-
βββ OpenRedirectPlugin.ts # Open redirect detection
|
|
49
|
+
```bash
|
|
50
|
+
npx kramscan scan https://example.com
|
|
105
51
|
```
|
|
106
52
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
import { BaseVulnerabilityPlugin, PluginContext } from 'kramscan/plugins';
|
|
53
|
+
### First-Time Setup
|
|
111
54
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
readonly type = "custom";
|
|
115
|
-
readonly description = "Detects custom vulnerability";
|
|
116
|
-
|
|
117
|
-
async testParameter(context: PluginContext, param: string, value: string) {
|
|
118
|
-
// Your detection logic here
|
|
119
|
-
if (/* vulnerability found */) {
|
|
120
|
-
return this.success(this.createVulnerability(
|
|
121
|
-
"Custom Vulnerability",
|
|
122
|
-
"Description...",
|
|
123
|
-
context.url,
|
|
124
|
-
"high",
|
|
125
|
-
"Evidence...",
|
|
126
|
-
"Remediation..."
|
|
127
|
-
));
|
|
128
|
-
}
|
|
129
|
-
return this.failure();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
55
|
+
```bash
|
|
56
|
+
kramscan onboard
|
|
132
57
|
```
|
|
133
58
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
<br />
|
|
139
|
-
|
|
140
|
-
## π§ͺ Tech Stack
|
|
141
|
-
<div align="center">
|
|
142
|
-
|
|
143
|
-
| Component | Technology |
|
|
144
|
-
| :--- | :--- |
|
|
145
|
-
| **Runtime** | Node.js β₯ 18 |
|
|
146
|
-
| **Language** | TypeScript 5.4 |
|
|
147
|
-
| **CLI Framework** | Commander.js, Inquirer.js |
|
|
148
|
-
| **Browser Automation** | Puppeteer (Headless Chrome) |
|
|
149
|
-
| **AI Integration** | OpenAI SDK, Google Generative AI, Anthropic SDK |
|
|
150
|
-
| **Schema Validation** | Zod |
|
|
151
|
-
| **Reporting** | Docx, Puppeteer (PDF), Chalk |
|
|
152
|
-
| **Package Manager** | NPM / Yarn / PNPM |
|
|
153
|
-
|
|
154
|
-
</div>
|
|
155
|
-
|
|
156
|
-
<br />
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
<br />
|
|
161
|
-
|
|
162
|
-
## π§ Supported AI Providers
|
|
163
|
-
|
|
164
|
-
| Provider | SDK / Integration | Default Model |
|
|
165
|
-
| :--- | :--- | :--- |
|
|
166
|
-
| **OpenAI** | `openai` | `gpt-4` |
|
|
167
|
-
| **Anthropic** | `@anthropic-ai/sdk` | `claude-3-5-sonnet-20241022` |
|
|
168
|
-
| **Google Gemini** | `@google/generative-ai` | `gemini-2.0-flash` |
|
|
169
|
-
| **Mistral** | `@mistralai/mistralai` | `mistral-large-latest` |
|
|
170
|
-
| **OpenRouter** | OpenAI-compatible | `anthropic/claude-3.5-sonnet` |
|
|
171
|
-
| **Kimi** | OpenAI-compatible | `moonshot-v1-8k` |
|
|
172
|
-
| **Groq** | OpenAI-compatible | `llama-3.1-8b-instant` |
|
|
173
|
-
|
|
174
|
-
> Switch providers instantly with `kramscan onboard` or by editing `~/.kramscan/config.json`.
|
|
175
|
-
|
|
176
|
-
### API Key Environment Variables
|
|
177
|
-
You can provide API keys via environment variables (useful for CI/CD) instead of saving them locally:
|
|
59
|
+
This runs the configuration wizard to set up your AI provider and API keys. KramScan auto-detects keys already present in your environment variables.
|
|
178
60
|
|
|
179
|
-
|
|
180
|
-
| :--- | :--- |
|
|
181
|
-
| OpenAI | `OPENAI_API_KEY` |
|
|
182
|
-
| Anthropic | `ANTHROPIC_API_KEY` |
|
|
183
|
-
| Gemini | `GEMINI_API_KEY` |
|
|
184
|
-
| Mistral | `MISTRAL_API_KEY` |
|
|
185
|
-
| OpenRouter | `OPENROUTER_API_KEY` |
|
|
186
|
-
| Kimi | `KIMI_API_KEY` |
|
|
187
|
-
| Groq | `GROQ_API_KEY` |
|
|
188
|
-
|
|
189
|
-
### Smart Environment Detection
|
|
190
|
-
KramScan automatically detects API keys in your environment variables. During `kramscan onboard`, the tool will identify and pre-configure providers like OpenAI, Anthropic, and Gemini if their keys are found in your session.
|
|
191
|
-
|
|
192
|
-
### AI-Powered Context-Aware Payloads
|
|
193
|
-
The scanning engine utilizes AI to generate payloads tailored to the specific context of your application, significantly increasing detection rates against filtered inputs and complex WAFs.
|
|
194
|
-
|
|
195
|
-
### Autonomous Finding Verification
|
|
196
|
-
The `kramscan agent` independently verifies reported vulnerabilities using non-destructive, context-aware payloads to differentiate between theoretical findings and exploitable risks.
|
|
197
|
-
|
|
198
|
-
<br />
|
|
199
|
-
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
<br />
|
|
203
|
-
|
|
204
|
-
## π Quick Start
|
|
205
|
-
|
|
206
|
-
### 1. Installation
|
|
207
|
-
Install KramScan globally using npm:
|
|
61
|
+
### Run a Scan
|
|
208
62
|
|
|
209
63
|
```bash
|
|
210
|
-
|
|
64
|
+
kramscan scan https://example.com
|
|
211
65
|
```
|
|
212
66
|
|
|
213
|
-
###
|
|
214
|
-
Initialize the configuration wizard to set up your AI provider and API keys:
|
|
67
|
+
### View Results
|
|
215
68
|
|
|
216
69
|
```bash
|
|
217
|
-
kramscan
|
|
70
|
+
kramscan scans list # List recent scans
|
|
71
|
+
kramscan scans latest # View the latest scan
|
|
218
72
|
```
|
|
219
73
|
|
|
220
|
-
|
|
221
|
-
Execute a full security scan on a target URL:
|
|
74
|
+
---
|
|
222
75
|
|
|
223
|
-
|
|
224
|
-
|
|
76
|
+
## Usage & Commands
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
kramscan Interactive dashboard menu
|
|
80
|
+
kramscan scan <url> Full vulnerability scan with post-scan prompts
|
|
81
|
+
kramscan dev [url] Watch-mode localhost scanner with diff reports
|
|
82
|
+
kramscan gate <url> CI/CD security gate (exits 1 on threshold breach)
|
|
83
|
+
kramscan agent AI security assistant with autonomous verification
|
|
84
|
+
kramscan analyze AI-powered analysis of scan results
|
|
85
|
+
kramscan report Generate reports with optional AI executive summaries
|
|
86
|
+
kramscan onboard Setup wizard with environment key detection
|
|
87
|
+
kramscan doctor Verify environment health and dependencies
|
|
88
|
+
kramscan config View and edit configuration
|
|
89
|
+
kramscan scans List and inspect recent scans
|
|
90
|
+
kramscan init Generate a .kramscanrc config for this project
|
|
91
|
+
kramscan ai AI helpers (model listing, connectivity test)
|
|
225
92
|
```
|
|
226
93
|
|
|
227
|
-
|
|
94
|
+
### Project Configuration
|
|
228
95
|
|
|
229
|
-
|
|
96
|
+
Run `kramscan init` in your project root to generate a `.kramscanrc` file with team-shareable defaults:
|
|
230
97
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
98
|
+
```bash
|
|
99
|
+
kramscan init # interactive setup
|
|
100
|
+
kramscan init -y # generate with defaults
|
|
101
|
+
kramscan init --force # overwrite an existing .kramscanrc
|
|
102
|
+
```
|
|
234
103
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
104
|
+
The generated file looks like this:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"scan": {
|
|
109
|
+
"defaultProfile": "balanced",
|
|
110
|
+
"defaultTimeout": 30000,
|
|
111
|
+
"strictScope": true,
|
|
112
|
+
"exclude": ["logout", "signout", "delete"]
|
|
113
|
+
},
|
|
114
|
+
"report": {
|
|
115
|
+
"defaultFormat": "markdown",
|
|
116
|
+
"companyName": "Your Company"
|
|
117
|
+
},
|
|
118
|
+
"gate": {
|
|
119
|
+
"failOn": "high",
|
|
120
|
+
"maxVulns": 0
|
|
121
|
+
},
|
|
122
|
+
"plugins": {
|
|
123
|
+
"disabled": []
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
249
127
|
|
|
250
|
-
|
|
128
|
+
Project-level settings override the global config (`~/.kramscan/config.json`). API keys are never stored in `.kramscanrc` β use `kramscan onboard` or environment variables for credentials. Commit the file to version control so your team shares the same scan settings.
|
|
251
129
|
|
|
252
|
-
###
|
|
130
|
+
### Dev Mode
|
|
253
131
|
|
|
254
|
-
Scan your local dev server continuously. KramScan watches for file changes and
|
|
132
|
+
Scan your local dev server continuously. KramScan watches for file changes and auto re-scans, showing a diff of new vs. resolved vulnerabilities:
|
|
255
133
|
|
|
256
134
|
```bash
|
|
257
|
-
# Watch-mode with port shorthand
|
|
258
135
|
kramscan dev --port 3000
|
|
259
|
-
|
|
260
|
-
# Full URL with notifications
|
|
261
136
|
kramscan dev http://localhost:3000 --watch-dir ./src --notify
|
|
262
|
-
|
|
263
|
-
# Single scan (no watching)
|
|
264
137
|
kramscan dev http://localhost:8080 --no-watch --fail-on high
|
|
265
138
|
```
|
|
266
139
|
|
|
267
|
-
|
|
268
|
-
1. Probes your server until it's ready (auto-detects Express, Next.js, Django, etc.)
|
|
269
|
-
2. Runs an initial security scan
|
|
270
|
-
3. Watches `--watch-dir` for file changes (debounced)
|
|
271
|
-
4. Re-scans and shows only **new** and **resolved** vulnerabilities
|
|
140
|
+
It probes your server until it's ready (auto-detects Express, Next.js, Django, etc.), runs an initial scan, then watches the specified directory for changes and re-scans on each update.
|
|
272
141
|
|
|
273
|
-
###
|
|
142
|
+
### CI/CD Security Gate
|
|
274
143
|
|
|
275
|
-
Block deployments
|
|
144
|
+
Block deployments when vulnerabilities exceed your threshold:
|
|
276
145
|
|
|
277
146
|
```bash
|
|
278
|
-
# Fail if any high+ vulnerabilities found
|
|
279
147
|
kramscan gate http://localhost:3000 --fail-on high
|
|
280
|
-
|
|
281
|
-
# JSON output for pipeline processing
|
|
282
148
|
kramscan gate $APP_URL --fail-on medium --json
|
|
283
|
-
|
|
284
|
-
# Allow up to 3 low-severity findings
|
|
285
149
|
kramscan gate http://staging.example.com --fail-on low --max-vulns 3
|
|
286
150
|
```
|
|
287
151
|
|
|
288
|
-
|
|
152
|
+
GitHub Actions example:
|
|
153
|
+
|
|
289
154
|
```yaml
|
|
290
155
|
- name: Security Gate
|
|
291
156
|
run: npx kramscan gate http://localhost:3000 --fail-on high
|
|
292
157
|
```
|
|
293
158
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
### Scan Profiles and Limits
|
|
297
|
-
KramScan supports profiles for quick tuning:
|
|
159
|
+
### Scan Profiles
|
|
298
160
|
|
|
299
161
|
```bash
|
|
300
162
|
kramscan scan https://example.com --profile quick
|
|
@@ -302,7 +164,7 @@ kramscan scan https://example.com --profile balanced
|
|
|
302
164
|
kramscan scan https://example.com --profile deep
|
|
303
165
|
```
|
|
304
166
|
|
|
305
|
-
|
|
167
|
+
Control crawl limits and URL scope:
|
|
306
168
|
|
|
307
169
|
```bash
|
|
308
170
|
kramscan scan https://example.com --max-pages 30 --max-links-per-page 50
|
|
@@ -310,45 +172,18 @@ kramscan scan https://example.com --exclude "logout|signout"
|
|
|
310
172
|
kramscan scan https://example.com --include "^https://example\.com/docs"
|
|
311
173
|
```
|
|
312
174
|
|
|
313
|
-
### Automatic PDF
|
|
314
|
-
After each scan, KramScan automatically generates a PDF report (no separate command required).
|
|
175
|
+
### Automatic PDF Reports
|
|
315
176
|
|
|
316
|
-
|
|
177
|
+
After each scan, a PDF report is generated automatically:
|
|
317
178
|
|
|
318
179
|
- JSON: `~/.kramscan/scans/scan-<timestamp>.json`
|
|
319
180
|
- PDF: `~/.kramscan/reports/scanreport_<hostname>_<timestamp>.pdf`
|
|
320
181
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
```bash
|
|
324
|
-
kramscan scan https://example.com --no-pdf
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Error Tracking and Recovery
|
|
328
|
-
KramScan features comprehensive error handling:
|
|
329
|
-
|
|
330
|
-
- **Continue on Failure**: Scan continues even if individual URLs fail to load
|
|
331
|
-
- **Plugin Error Isolation**: If one vulnerability plugin fails, others continue working
|
|
332
|
-
- **Error Reports**: PDF reports include a "β οΈ Scan Errors & Skipped Items" section
|
|
333
|
-
- **CLI Feedback**: Real-time error messages during scanning
|
|
334
|
-
|
|
335
|
-
### Event-Driven Progress Feedback
|
|
336
|
-
Watch your scan progress in real-time:
|
|
337
|
-
|
|
338
|
-
```
|
|
339
|
-
π Starting Security Scan
|
|
340
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
341
|
-
|
|
342
|
-
β Initializing scanner...
|
|
343
|
-
β ΄ Crawling: https://example.com (5/30)
|
|
344
|
-
β οΈ Found high vulnerability: Reflected Cross-Site Scripting (XSS)
|
|
345
|
-
β ΄ Continuing scan (1 vulns found)...
|
|
346
|
-
β ΄ Testing forms on https://example.com/login (3 forms)...
|
|
347
|
-
β Scan complete!
|
|
348
|
-
```
|
|
182
|
+
Disable with `--no-pdf`.
|
|
349
183
|
|
|
350
184
|
### Scan History
|
|
351
|
-
|
|
185
|
+
|
|
186
|
+
Every scan is indexed in `~/.kramscan/scans/index.json`:
|
|
352
187
|
|
|
353
188
|
```bash
|
|
354
189
|
kramscan scans list -n 10
|
|
@@ -356,64 +191,151 @@ kramscan scans latest
|
|
|
356
191
|
```
|
|
357
192
|
|
|
358
193
|
### AI Diagnostics
|
|
359
|
-
List models and test your configured provider/model:
|
|
360
194
|
|
|
361
195
|
```bash
|
|
362
196
|
kramscan ai models -n 10
|
|
363
197
|
kramscan ai test
|
|
364
198
|
```
|
|
365
199
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Architecture
|
|
203
|
+
|
|
204
|
+
```mermaid
|
|
205
|
+
graph LR
|
|
206
|
+
A[User Command] --> B{CLI Controller};
|
|
207
|
+
B --> C[Scanner Module<br/>Puppeteer / Plugin System];
|
|
208
|
+
B --> D[AI Agent<br/>NLP Processing];
|
|
209
|
+
|
|
210
|
+
C --> E[Plugin Manager<br/>XSS / SQLi / Headers / CSRF];
|
|
211
|
+
E --> F[Vulnerability Detection];
|
|
212
|
+
C --> G[Event System<br/>Progress / Results];
|
|
213
|
+
|
|
214
|
+
F & G --> H[AI Analysis Engine<br/>LLM Provider];
|
|
215
|
+
|
|
216
|
+
H --> I[Risk Assessment<br/>Confidence Scoring];
|
|
217
|
+
I --> J[Report Generator<br/>PDF / DOCX / JSON / TXT];
|
|
218
|
+
J --> K((Final Output<br/>+ Error Report));
|
|
377
219
|
```
|
|
378
220
|
|
|
379
|
-
|
|
221
|
+
### Plugin System
|
|
222
|
+
|
|
223
|
+
KramScan's detection layer is built on a modular plugin architecture:
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
src/plugins/
|
|
227
|
+
βββ types.ts # Base interfaces and types
|
|
228
|
+
βββ PluginManager.ts # Plugin orchestration
|
|
229
|
+
βββ index.ts # Plugin exports
|
|
230
|
+
βββ vulnerabilities/
|
|
231
|
+
βββ XSSPlugin.ts
|
|
232
|
+
βββ SQLInjectionPlugin.ts
|
|
233
|
+
βββ SecurityHeadersPlugin.ts
|
|
234
|
+
βββ SensitiveDataPlugin.ts
|
|
235
|
+
βββ CSRFPlugin.ts
|
|
236
|
+
βββ CORSAnalyzerPlugin.ts
|
|
237
|
+
βββ DebugEndpointPlugin.ts
|
|
238
|
+
βββ DirectoryTraversalPlugin.ts
|
|
239
|
+
βββ CookieSecurityPlugin.ts
|
|
240
|
+
βββ OpenRedirectPlugin.ts
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
To add a custom plugin:
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
import { BaseVulnerabilityPlugin, PluginContext } from 'kramscan/plugins';
|
|
247
|
+
|
|
248
|
+
export class MyCustomPlugin extends BaseVulnerabilityPlugin {
|
|
249
|
+
readonly name = "Custom Detector";
|
|
250
|
+
readonly type = "custom";
|
|
251
|
+
readonly description = "Detects custom vulnerability";
|
|
252
|
+
|
|
253
|
+
async testParameter(context: PluginContext, param: string, value: string) {
|
|
254
|
+
// Your detection logic here
|
|
255
|
+
if (/* vulnerability found */) {
|
|
256
|
+
return this.success(this.createVulnerability(
|
|
257
|
+
"Custom Vulnerability",
|
|
258
|
+
"Description...",
|
|
259
|
+
context.url,
|
|
260
|
+
"high",
|
|
261
|
+
"Evidence...",
|
|
262
|
+
"Remediation..."
|
|
263
|
+
));
|
|
264
|
+
}
|
|
265
|
+
return this.failure();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
380
269
|
|
|
381
270
|
---
|
|
382
271
|
|
|
272
|
+
## Supported AI Providers
|
|
383
273
|
|
|
274
|
+
KramScan supports the following AI providers out of the box. Switch providers with `kramscan onboard` or by editing `~/.kramscan/config.json`.
|
|
384
275
|
|
|
385
|
-
|
|
386
|
-
- **
|
|
387
|
-
- **
|
|
388
|
-
- **
|
|
389
|
-
- **
|
|
276
|
+
- **OpenAI** β `gpt-4` (env: `OPENAI_API_KEY`)
|
|
277
|
+
- **Anthropic** β `claude-3-5-sonnet-20241022` (env: `ANTHROPIC_API_KEY`)
|
|
278
|
+
- **Google Gemini** β `gemini-2.0-flash` (env: `GEMINI_API_KEY`)
|
|
279
|
+
- **Mistral** β `mistral-large-latest` (env: `MISTRAL_API_KEY`)
|
|
280
|
+
- **OpenRouter** β `anthropic/claude-3.5-sonnet` (env: `OPENROUTER_API_KEY`)
|
|
281
|
+
- **Kimi** β `moonshot-v1-8k` (env: `KIMI_API_KEY`)
|
|
282
|
+
- **Groq** β `llama-3.1-8b-instant` (env: `GROQ_API_KEY`)
|
|
390
283
|
|
|
391
|
-
|
|
284
|
+
API keys can be provided via environment variables (useful for CI/CD) or saved locally during onboarding. KramScan auto-detects keys present in your environment.
|
|
285
|
+
|
|
286
|
+
The scanning engine can also use AI to generate context-aware payloads, improving detection rates against filtered inputs and WAFs. The `kramscan agent` independently verifies reported vulnerabilities using non-destructive payloads to separate theoretical findings from exploitable risks.
|
|
392
287
|
|
|
393
288
|
---
|
|
394
289
|
|
|
395
|
-
|
|
290
|
+
## Tech Stack
|
|
396
291
|
|
|
397
|
-
|
|
398
|
-
|
|
292
|
+
- **Runtime:** Node.js >= 18
|
|
293
|
+
- **Language:** TypeScript 5.4
|
|
294
|
+
- **CLI Framework:** Commander.js, Inquirer.js
|
|
295
|
+
- **Browser Automation:** Puppeteer (Headless Chrome)
|
|
296
|
+
- **AI Integration:** OpenAI SDK, Google Generative AI, Anthropic SDK
|
|
297
|
+
- **Schema Validation:** Zod
|
|
298
|
+
- **Reporting:** Docx, Puppeteer (PDF), Chalk
|
|
299
|
+
- **Testing:** Jest, ts-jest
|
|
300
|
+
- **CI/CD:** GitHub Actions (lint, build, test on Node 18/20/22, security audit)
|
|
399
301
|
|
|
400
|
-
|
|
302
|
+
---
|
|
401
303
|
|
|
402
|
-
|
|
403
|
-
[](https://github.com/shaikhakramshakil)
|
|
404
|
-
[](https://www.linkedin.com/in/shaikhakramshakil/)
|
|
304
|
+
## Security & Privacy
|
|
405
305
|
|
|
406
|
-
|
|
306
|
+
- All scanning logic runs locally on your machine.
|
|
307
|
+
- API keys are stored in your local home directory and are never sent to our servers.
|
|
308
|
+
- Scan data is sent only to your chosen AI provider for analysis and is not stored by KramScan.
|
|
309
|
+
- Failed scan attempts are logged locally for debugging but never transmitted.
|
|
310
|
+
|
|
311
|
+
---
|
|
407
312
|
|
|
408
|
-
|
|
313
|
+
## Contributing
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
git clone https://github.com/shaikhakramshakil/kramscan.git
|
|
317
|
+
cd kramscan
|
|
318
|
+
npm install
|
|
319
|
+
npm run build
|
|
320
|
+
npm test
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Before submitting a PR:
|
|
324
|
+
|
|
325
|
+
1. Run `npm run lint` β ensure zero ESLint errors.
|
|
326
|
+
2. Run `npm test` β ensure all tests pass.
|
|
327
|
+
3. Add tests for new features when possible.
|
|
409
328
|
|
|
410
329
|
---
|
|
411
330
|
|
|
412
|
-
|
|
331
|
+
## Author
|
|
413
332
|
|
|
414
|
-
|
|
415
|
-
This project is licensed under the **MIT License** β see the [LICENSE](LICENSE) file for details.
|
|
333
|
+
**Akram Shaikh**
|
|
416
334
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
335
|
+
[](https://akramshaikh.me)
|
|
336
|
+
[](https://github.com/shaikhakramshakil)
|
|
337
|
+
[](https://www.linkedin.com/in/shaikhakramshakil/)
|
|
338
|
+
|
|
339
|
+
## License
|
|
340
|
+
|
|
341
|
+
This project is licensed under the MIT License β see the [LICENSE](LICENSE) file for details.
|
|
@@ -199,7 +199,7 @@ class GenerateReportSkill {
|
|
|
199
199
|
if (!docx) {
|
|
200
200
|
throw new Error("DOCX generation requires the 'docx' package. Please install it: npm install docx");
|
|
201
201
|
}
|
|
202
|
-
const { Document, Paragraph, TextRun, HeadingLevel,
|
|
202
|
+
const { Document, Paragraph, TextRun, HeadingLevel, } = docx;
|
|
203
203
|
const findings = scanData.findings || [];
|
|
204
204
|
const analysisFinding = includeAnalysis
|
|
205
205
|
? findings.find((f) => f.skillId === "analyze_findings")
|
|
@@ -12,11 +12,11 @@ export declare class HealthCheckSkill implements AgentSkill {
|
|
|
12
12
|
riskLevel: "low";
|
|
13
13
|
estimatedDuration: number;
|
|
14
14
|
toolDefinition: ToolDefinition;
|
|
15
|
-
validateParameters(
|
|
15
|
+
validateParameters(_params: Record<string, unknown>): {
|
|
16
16
|
valid: boolean;
|
|
17
17
|
errors: string[];
|
|
18
18
|
};
|
|
19
|
-
execute(params: Record<string, unknown>,
|
|
19
|
+
execute(params: Record<string, unknown>, _context: AgentContext): Promise<SkillResult>;
|
|
20
20
|
private checkNodeVersion;
|
|
21
21
|
private checkConfiguration;
|
|
22
22
|
private checkAIProvider;
|