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 CHANGED
@@ -3,298 +3,160 @@
3
3
 
4
4
  <h3 align="center">AI-Powered Web Application Security Testing CLI</h3>
5
5
 
6
- <br />
7
-
6
+ [![CI](https://img.shields.io/github/actions/workflow/status/shaikhakramshakil/kramscan/ci.yml?branch=main&style=for-the-badge&logo=github-actions&logoColor=white&label=CI)](https://github.com/shaikhakramshakil/kramscan/actions)
8
7
  [![npm version](https://img.shields.io/npm/v/kramscan?style=for-the-badge&logo=npm&logoColor=white&color=cb3837)](https://www.npmjs.com/package/kramscan)
9
8
  [![npm downloads](https://img.shields.io/npm/dm/kramscan?style=for-the-badge&logo=npm&logoColor=white&color=blue)](https://www.npmjs.com/package/kramscan)
10
9
  [![License](https://img.shields.io/github/license/shaikhakramshakil/kramscan?style=for-the-badge&logo=github&logoColor=white&color=green)](https://github.com/shaikhakramshakil/kramscan/blob/main/LICENSE)
11
- [![Stars](https://img.shields.io/github/stars/shaikhakramshakil/kramscan?style=for-the-badge&logo=github&logoColor=white&color=yellow)](https://github.com/shaikhakramshakil/kramscan)
12
10
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.4-3178c6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org)
13
11
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-brightgreen?style=for-the-badge&logo=nodedotjs&logoColor=white)](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
- <br />
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
- ## πŸš€ The Problem We Solve
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
- <br />
41
-
42
- ## ✨ Key Features
43
- | Feature | Description |
44
- | :--- | :--- |
45
- | πŸ” **Automated Vulnerability Engine** | Detects XSS, SQL Injection, CSRF, insecure headers, CORS misconfigs, open redirects, and more. |
46
- | πŸ”Œ **10 Built-in Security Plugins** | CORS, debug endpoints, directory traversal, cookie auditing, open redirects, sensitive data, and more. |
47
- | πŸ› οΈ **Dev Mode (Watch Scanner)** | Watch your localhost for file changes and auto re-scan with diff reports (new vs resolved vulns). |
48
- | 🚧 **CI/CD Security Gate** | `kramscan gate` exits with code 1 if vulnerabilities exceed your threshold. Plug into any pipeline. |
49
- | πŸ€– **Interactive AI Agent** | A conversational security assistant with **Autonomous Verification** skills to confirm findings live. |
50
- | 🧠 **Multi-Provider AI Analysis** | Supports OpenAI, Anthropic, Google Gemini, Mistral, OpenRouter, and more for results auditing. |
51
- | πŸ“ **AI Executive Summaries** | Automatically generates business-oriented summaries for Word, JSON, and TXT reports. |
52
- | πŸ“Š **Event-Driven Feedback** | Real-time progress updates with dynamic spinners and live vulnerability alerts during scanning. |
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
- <br />
39
+ ## Quick Start
63
40
 
64
- ## πŸ—οΈ Architecture & Workflow
41
+ ### Installation
65
42
 
66
- ```mermaid
67
- graph LR
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
- <br />
84
-
85
- ### Plugin Architecture
47
+ Or run directly without installing:
86
48
 
87
- KramScan is built on a modular plugin system that makes extending vulnerability detection effortless:
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
- **Creating a custom plugin:**
108
-
109
- ```typescript
110
- import { BaseVulnerabilityPlugin, PluginContext } from 'kramscan/plugins';
53
+ ### First-Time Setup
111
54
 
112
- export class MyCustomPlugin extends BaseVulnerabilityPlugin {
113
- readonly name = "Custom Detector";
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
- <br />
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
- | Provider | Env Var |
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
- npm install -g kramscan
64
+ kramscan scan https://example.com
211
65
  ```
212
66
 
213
- ### 2. First-Time Setup
214
- Initialize the configuration wizard to set up your AI provider and API keys:
67
+ ### View Results
215
68
 
216
69
  ```bash
217
- kramscan onboard
70
+ kramscan scans list # List recent scans
71
+ kramscan scans latest # View the latest scan
218
72
  ```
219
73
 
220
- ### 3. Run a Scan
221
- Execute a full security scan on a target URL:
74
+ ---
222
75
 
223
- ```bash
224
- kramscan scan https://example.com
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
- <br />
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
- <br />
232
-
233
- ## πŸ“– Usage & Commands
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
- | Command | Description |
236
- | :--- | :--- |
237
- | `kramscan` | Launch the interactive dashboard menu with smart argument prompting. |
238
- | `kramscan scan <url>` | Run a comprehensive vulnerability scan with post-scan prompts. |
239
- | `kramscan dev [url]` | Watch-mode localhost scanner with diff reports and desktop notifications. |
240
- | `kramscan gate <url>` | CI/CD security quality gate β€” exits with code 1 on threshold breach. |
241
- | `kramscan agent` | Start the AI security assistant with autonomous verification skills. |
242
- | `kramscan analyze` | AI-powered analysis with proactive onboarding redirection. |
243
- | `kramscan report` | Generate professional reports with optional AI executive summaries. |
244
- | `kramscan onboard` | Smart setup wizard with environment key detection. |
245
- | `kramscan doctor` | Verify environment health and check for Docker dependencies. |
246
- | `kramscan config` | View and edit current configuration with robust schema defaults. |
247
- | `kramscan scans` | List and inspect recent scans from the persistent index. |
248
- | `kramscan ai` | AI helpers (model listing and connectivity test). |
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
- <br />
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
- ### πŸ› οΈ Dev Mode β€” Localhost Watch Scanner
130
+ ### Dev Mode
253
131
 
254
- Scan your local dev server continuously. KramScan watches for file changes and **auto re-scans**, showing a diff of new vs. resolved vulnerabilities:
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
- **How it works:**
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
- ### 🚧 CI/CD Security Gate
142
+ ### CI/CD Security Gate
274
143
 
275
- Block deployments with vulnerabilities above your threshold:
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
- **Pipeline example (GitHub Actions):**
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
- <br />
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
- You can also control crawl limits and URL scope:
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 Report After Scan
314
- After each scan, KramScan automatically generates a PDF report (no separate command required).
175
+ ### Automatic PDF Reports
315
176
 
316
- The file is saved to:
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
- You can disable it with:
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
- Every scan is indexed in `~/.kramscan/scans/index.json`.
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
- ### Example Agent Session
367
- ```bash
368
- $ kramscan agent
369
- > scan https://example.com
370
-
371
- Agent: I'll perform a comprehensive security scan of https://example.com.
372
- Checking for XSS, SQLi, and missing headers...
373
- [Scanning...]
374
-
375
- Agent: Scan complete! Found 2 High severity issues.
376
- Would you like me to generate a report?
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
- <br />
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
- ## πŸ”’ Security & Privacy
386
- - **Local Execution:** All scanning logic runs locally on your machine.
387
- - **API Key Safety:** AI provider API keys are stored securely in your local home directory and are never sent to our servers.
388
- - **Data Privacy:** Scan data is sent only to your chosen AI provider for analysis and is not stored by KramScan.
389
- - **Error Tracking:** Failed scan attempts are logged locally for debugging but never transmitted.
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
- <br />
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
- <br />
290
+ ## Tech Stack
396
291
 
397
- ## πŸ‘€ Author
398
- <div align="center">
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
- **Akram Shaikh**
302
+ ---
401
303
 
402
- [![Website](https://img.shields.io/badge/Website-akramshaikh.me-blue?style=for-the-badge&logo=google-chrome&logoColor=white)](https://akramshaikh.me)
403
- [![GitHub](https://img.shields.io/badge/GitHub-shaikhakramshakil-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/shaikhakramshakil)
404
- [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/shaikhakramshakil/)
304
+ ## Security & Privacy
405
305
 
406
- </div>
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
- <br />
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
- <br />
331
+ ## Author
413
332
 
414
- ## πŸ“„ License
415
- This project is licensed under the **MIT License** β€” see the [LICENSE](LICENSE) file for details.
333
+ **Akram Shaikh**
416
334
 
417
- <div align="center">
418
- <sub>Made with ❀️ by Akram Shaikh</sub>
419
- </div>
335
+ [![Website](https://img.shields.io/badge/Website-akramshaikh.me-blue?style=for-the-badge&logo=google-chrome&logoColor=white)](https://akramshaikh.me)
336
+ [![GitHub](https://img.shields.io/badge/GitHub-shaikhakramshakil-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/shaikhakramshakil)
337
+ [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](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, Table, TableCell, TableRow, WidthType, BorderStyle, } = docx;
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(params: Record<string, unknown>): {
15
+ validateParameters(_params: Record<string, unknown>): {
16
16
  valid: boolean;
17
17
  errors: string[];
18
18
  };
19
- execute(params: Record<string, unknown>, context: AgentContext): Promise<SkillResult>;
19
+ execute(params: Record<string, unknown>, _context: AgentContext): Promise<SkillResult>;
20
20
  private checkNodeVersion;
21
21
  private checkConfiguration;
22
22
  private checkAIProvider;