kramscan 0.1.1 β†’ 0.2.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.
Files changed (72) hide show
  1. package/README.md +392 -236
  2. package/dist/agent/confirmation.d.ts +5 -1
  3. package/dist/agent/confirmation.js +29 -9
  4. package/dist/agent/context.js +2 -3
  5. package/dist/agent/orchestrator.d.ts +2 -0
  6. package/dist/agent/orchestrator.js +50 -8
  7. package/dist/agent/prompts/system.d.ts +1 -1
  8. package/dist/agent/prompts/system.js +5 -7
  9. package/dist/agent/skills/health-check.js +22 -2
  10. package/dist/agent/skills/index.d.ts +1 -0
  11. package/dist/agent/skills/index.js +3 -1
  12. package/dist/agent/skills/verify-finding.d.ts +17 -0
  13. package/dist/agent/skills/verify-finding.js +91 -0
  14. package/dist/agent/skills/web-scan.js +46 -0
  15. package/dist/cli.js +150 -149
  16. package/dist/commands/agent.js +38 -38
  17. package/dist/commands/ai.d.ts +2 -0
  18. package/dist/commands/ai.js +112 -0
  19. package/dist/commands/analyze.js +103 -54
  20. package/dist/commands/config.js +55 -29
  21. package/dist/commands/doctor.js +20 -15
  22. package/dist/commands/onboard.js +188 -141
  23. package/dist/commands/report.js +68 -76
  24. package/dist/commands/scan.js +261 -81
  25. package/dist/commands/scans.d.ts +2 -0
  26. package/dist/commands/scans.js +51 -0
  27. package/dist/core/ai-client.d.ts +6 -1
  28. package/dist/core/ai-client.js +80 -12
  29. package/dist/core/ai-payloads.d.ts +17 -0
  30. package/dist/core/ai-payloads.js +54 -0
  31. package/dist/core/config-schema.d.ts +197 -0
  32. package/dist/core/config-schema.js +68 -0
  33. package/dist/core/config-schema.test.d.ts +1 -0
  34. package/dist/core/config-schema.test.js +151 -0
  35. package/dist/core/config.d.ts +8 -31
  36. package/dist/core/config.js +68 -11
  37. package/dist/core/errors.d.ts +71 -0
  38. package/dist/core/errors.js +162 -0
  39. package/dist/core/scan-index.d.ts +19 -0
  40. package/dist/core/scan-index.js +52 -0
  41. package/dist/core/scan-storage.d.ts +11 -0
  42. package/dist/core/scan-storage.js +69 -0
  43. package/dist/core/scanner.d.ts +95 -13
  44. package/dist/core/scanner.js +336 -248
  45. package/dist/core/vulnerability-detector.d.ts +3 -0
  46. package/dist/core/vulnerability-detector.js +25 -15
  47. package/dist/core/vulnerability-detector.test.d.ts +1 -0
  48. package/dist/core/vulnerability-detector.test.js +210 -0
  49. package/dist/index.js +3 -0
  50. package/dist/plugins/PluginManager.d.ts +27 -0
  51. package/dist/plugins/PluginManager.js +166 -0
  52. package/dist/plugins/index.d.ts +7 -0
  53. package/dist/plugins/index.js +19 -0
  54. package/dist/plugins/types.d.ts +55 -0
  55. package/dist/plugins/types.js +25 -0
  56. package/dist/plugins/vulnerabilities/CSRFPlugin.d.ts +8 -0
  57. package/dist/plugins/vulnerabilities/CSRFPlugin.js +34 -0
  58. package/dist/plugins/vulnerabilities/SQLInjectionPlugin.d.ts +11 -0
  59. package/dist/plugins/vulnerabilities/SQLInjectionPlugin.js +109 -0
  60. package/dist/plugins/vulnerabilities/SecurityHeadersPlugin.d.ts +11 -0
  61. package/dist/plugins/vulnerabilities/SecurityHeadersPlugin.js +63 -0
  62. package/dist/plugins/vulnerabilities/SensitiveDataPlugin.d.ts +9 -0
  63. package/dist/plugins/vulnerabilities/SensitiveDataPlugin.js +32 -0
  64. package/dist/plugins/vulnerabilities/XSSPlugin.d.ts +15 -0
  65. package/dist/plugins/vulnerabilities/XSSPlugin.js +81 -0
  66. package/dist/reports/PdfGenerator.d.ts +36 -0
  67. package/dist/reports/PdfGenerator.js +379 -0
  68. package/dist/utils/logger.d.ts +33 -1
  69. package/dist/utils/logger.js +127 -8
  70. package/dist/utils/theme.d.ts +55 -0
  71. package/dist/utils/theme.js +195 -0
  72. package/package.json +1 -1
package/README.md CHANGED
@@ -1,236 +1,392 @@
1
- <div align="center">
2
- <img src="https://github.com/user-attachments/assets/6439c670-8d73-4bdd-b8fa-c74de949a31e" width="500" alt="KramScan Logo" />
3
-
4
- <h3 align="center">AI-Powered Web Application Security Testing CLI</h3>
5
-
6
- <br />
7
-
8
- [![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
- [![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
- [![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
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.4-3178c6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org)
13
- [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-brightgreen?style=for-the-badge&logo=nodedotjs&logoColor=white)](https://nodejs.org)
14
-
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 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
- </div>
26
-
27
- ---
28
-
29
- <br />
30
-
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, and leverages **Generative AI** (OpenAI, Gemini, Anthropic) to analyze findings. It delivers actionable, human-readable insights alongside raw vulnerability dataβ€”all in seconds.
35
-
36
- <br />
37
-
38
- ---
39
-
40
- <br />
41
-
42
- ## ✨ Key Features
43
- | Feature | Description |
44
- | :--- | :--- |
45
- | πŸ” **Automated Vulnerability Engine** | Detects XSS, SQL Injection, CSRF, and insecure headers using Puppeteer-powered crawling. |
46
- | πŸ€– **Interactive AI Agent** | A conversational security assistant that understands natural language commands like "scan example.com". |
47
- | 🧠 **Multi-Provider AI Analysis** | Supports OpenAI, Anthropic, Google Gemini, Mistral, OpenRouter, and Kimi (Moonshot). |
48
- | πŸ“„ **Professional Reporting** | Generates detailed DOCX, TXT, and JSON reports with executive summaries and remediation steps. |
49
- | 🌐 **Headless Browser Testing** | Renders modern SPAs (Single Page Applications) to find vulnerabilities in dynamic content. |
50
- | ⚑ **CLI-First Architecture** | Optimized for speed, scriptability, and seamless integration into CI/CD pipelines. |
51
-
52
- <br />
53
-
54
- ---
55
-
56
- <br />
57
-
58
- ## πŸ—οΈ Architecture & Workflow
59
-
60
- ```mermaid
61
- graph LR
62
- A[User Command] --> B{CLI Controller};
63
- B --> C[Scanner Module<br/>Puppeteer / Cheerio];
64
- B --> D[AI Agent<br/>NLP Processing];
65
-
66
- C --> E[Vulnerability Detection<br/>XSS / SQLi / Headers];
67
- C --> F[Data Aggregation];
68
-
69
- E & F --> G[AI Analysis Engine<br/>LLM Provider];
70
-
71
- G --> H[Risk Assessment<br/>Confidence Scoring];
72
- H --> I[Report Generator<br/>DOCX / JSON / TXT];
73
- I --> J((Final Output));
74
- ```
75
-
76
- <br />
77
-
78
- ---
79
-
80
- <br />
81
-
82
- ## πŸ§ͺ Tech Stack
83
- <div align="center">
84
-
85
- | Component | Technology |
86
- | :--- | :--- |
87
- | **Runtime** | Node.js β‰₯ 18 |
88
- | **Language** | TypeScript 5.4 |
89
- | **CLI Framework** | Commander.js, Inquirer.js |
90
- | **Browser Automation** | Puppeteer (Headless Chrome) |
91
- | **AI Integration** | OpenAI SDK, Google Generative AI, Anthropic SDK |
92
- | **Reporting** | Docx, Chalk|
93
- | **Package Manager** | NPM / Yarn / PNPM |
94
-
95
- </div>
96
-
97
- <br />
98
-
99
- ---
100
-
101
- <br />
102
-
103
- ## 🧠 Supported AI Providers
104
-
105
- | Provider | SDK / Integration | Default Model |
106
- | :--- | :--- | :--- |
107
- | **OpenAI** | `openai` | `gpt-4` |
108
- | **Anthropic** | `@anthropic-ai/sdk` | `claude-3-5-sonnet-20241022` |
109
- | **Google Gemini** | `@google/generative-ai` | `gemini-2.0-flash-exp` |
110
- | **Mistral** | `@mistralai/mistralai` | `mistral-large-latest` |
111
- | **OpenRouter** | OpenAI-compatible | `anthropic/claude-3.5-sonnet` |
112
- | **Kimi** | OpenAI-compatible | `moonshot-v1-8k` |
113
-
114
- > Switch providers instantly with `kramscan onboard` or by editing `~/.kramscan/config.json`.
115
-
116
- <br />
117
-
118
- ---
119
-
120
- <br />
121
-
122
- ## πŸš€ Quick Start
123
-
124
- ### 1. Installation
125
- Install KramScan globally using npm:
126
-
127
- ```bash
128
- npm install -g kramscan
129
- ```
130
-
131
- ### 2. First-Time Setup
132
- Initialize the configuration wizard to set up your AI provider and API keys:
133
-
134
- ```bash
135
- kramscan onboard
136
- ```
137
-
138
- ### 3. Run a Scan
139
- Execute a full security scan on a target URL:
140
-
141
- ```bash
142
- kramscan scan https://example.com
143
- ```
144
-
145
- <br />
146
-
147
- ---
148
-
149
- <br />
150
-
151
- ## πŸ“– Usage & Commands
152
-
153
- | Command | Description | Status |
154
- | :--- | :--- | :---: |
155
- | `kramscan` | Launch the interactive dashboard menu. | βœ… Stable |
156
- | `kramscan scan <url>` | Run a comprehensive vulnerability scan. | βœ… Stable |
157
- | `kramscan agent` | Start the conversational AI security assistant. | βœ… Stable |
158
- | `kramscan analyze` | Analyze previous scan results using the configured AI. | βœ… Stable |
159
- | `kramscan report` | Generate a professional report from scan data. | βœ… Stable |
160
- | `kramscan onboard` | Run the configuration and setup wizard. | βœ… Stable |
161
- | `kramscan doctor` | Verify environment health and dependencies. | βœ… Stable |
162
- | `kramscan config` | View and edit current configuration settings. | βœ… Stable |
163
-
164
- <br />
165
-
166
- ### Example Agent Session
167
- ```bash
168
- $ kramscan agent
169
- > scan https://example.com
170
-
171
- Agent: I'll perform a comprehensive security scan of https://example.com.
172
- Checking for XSS, SQLi, and missing headers...
173
- [Scanning...]
174
-
175
- Agent: Scan complete! Found 2 High severity issues.
176
- Would you like me to generate a report?
177
- ```
178
-
179
- <br />
180
-
181
- ---
182
-
183
- <br />
184
-
185
- ## πŸ—ΊοΈ Roadmap
186
-
187
- - [x] Core vulnerability scanner (XSS, SQLi, CSRF, headers)
188
- - [x] Multi-provider AI analysis engine
189
- - [x] Interactive AI agent mode
190
- - [x] Professional report generation (DOCX, TXT, JSON)
191
- - [x] Configuration wizard & management
192
- - [ ] Plugin system for custom scan modules
193
- - [ ] CI/CD integration (GitHub Actions, GitLab CI)
194
- - [ ] PDF report generation
195
- - [ ] Web-based dashboard UI
196
-
197
- <br />
198
-
199
- ---
200
-
201
- <br />
202
-
203
- ## πŸ”’ Security & Privacy
204
- - **Local Execution:** All scanning logic runs locally on your machine.
205
- - **API Key Safety:** AI provider API keys are stored securely in your local home directory and are never sent to our servers.
206
- - **Data Privacy:** Scan data is sent only to your chosen AI provider for analysis and is not stored by KramScan.
207
-
208
- <br />
209
-
210
- ---
211
-
212
- <br />
213
-
214
- ## πŸ‘€ Author
215
- <div align="center">
216
-
217
- **Akram Shaikh**
218
-
219
- [![Website](https://img.shields.io/badge/Website-akramshaikh.me-blue?style=for-the-badge&logo=google-chrome&logoColor=white)](https://akramshaikh.me)
220
- [![GitHub](https://img.shields.io/badge/GitHub-shaikhakramshakil-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/shaikhakramshakil)
221
- [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/shaikhakramshakil/)
222
-
223
- </div>
224
-
225
- <br />
226
-
227
- ---
228
-
229
- <br />
230
-
231
- ## πŸ“„ License
232
- This project is licensed under the **MIT License** β€” see the [LICENSE](LICENSE) file for details.
233
-
234
- <div align="center">
235
- <sub>Made with ❀️ by Akram Shaikh</sub>
236
- </div>
1
+ <div align="center">
2
+ <img src="https://github.com/user-attachments/assets/6439c670-8d73-4bdd-b8fa-c74de949a31e" width="500" alt="KramScan Logo" />
3
+
4
+ <h3 align="center">AI-Powered Web Application Security Testing CLI</h3>
5
+
6
+ <br />
7
+
8
+ [![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
+ [![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
+ [![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
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.4-3178c6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org)
13
+ [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-brightgreen?style=for-the-badge&logo=nodedotjs&logoColor=white)](https://nodejs.org)
14
+
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
+ </div>
26
+
27
+ ---
28
+
29
+ <br />
30
+
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 />
37
+
38
+ ---
39
+
40
+ <br />
41
+
42
+ ## ✨ Key Features
43
+ | Feature | Description |
44
+ | :--- | :--- |
45
+ | πŸ” **Automated Vulnerability Engine** | Detects XSS, SQL Injection, CSRF, insecure headers, and more using Puppeteer-powered crawling. |
46
+ | πŸ”Œ **Modular Plugin System** | Extensible architecture for custom vulnerability detection plugins. Built-in plugins for common vulnerabilities. |
47
+ | πŸ€– **Interactive AI Agent** | A conversational security assistant with **Autonomous Verification** skills to confirm findings live. |
48
+ | 🧠 **Multi-Provider AI Analysis** | Supports OpenAI, Anthropic, Google Gemini, Mistral, OpenRouter, and more for results auditing. |
49
+ | πŸ“ **AI Executive Summaries** | Automatically generates business-oriented summaries for Word, JSON, and TXT reports. |
50
+ | πŸ“Š **Event-Driven Feedback** | Real-time progress updates with dynamic spinners and live vulnerability alerts during scanning. |
51
+ | πŸ“„ **Professional Reporting** | Generates detailed PDF, DOCX, TXT, and JSON reports with remediation steps and error tracking. |
52
+ | 🌐 **Headless Browser Testing** | Renders modern SPAs (Single Page Applications) to find vulnerabilities in dynamic content. |
53
+ | ⚑ **Smarter User Flow** | Revamped interactive menu and post-scan "Golden Path" prompts for a guided experience. |
54
+ | πŸ›‘οΈ **Error Resilience** | Robust configuration defaults and graceful recovery if individual URLs or plugins fail. |
55
+
56
+ <br />
57
+
58
+ ---
59
+
60
+ <br />
61
+
62
+ ## πŸ—οΈ Architecture & Workflow
63
+
64
+ ```mermaid
65
+ graph LR
66
+ A[User Command] --> B{CLI Controller};
67
+ B --> C[Scanner Module<br/>Puppeteer / Plugin System];
68
+ B --> D[AI Agent<br/>NLP Processing];
69
+
70
+ C --> E[Plugin Manager<br/>XSS / SQLi / Headers / CSRF];
71
+ E --> F[Vulnerability Detection];
72
+ C --> G[Event System<br/>Progress / Results];
73
+
74
+ F & G --> H[AI Analysis Engine<br/>LLM Provider];
75
+
76
+ H --> I[Risk Assessment<br/>Confidence Scoring];
77
+ I --> J[Report Generator<br/>PDF / DOCX / JSON / TXT];
78
+ J --> K((Final Output<br/>+ Error Report));
79
+ ```
80
+
81
+ <br />
82
+
83
+ ### Plugin Architecture
84
+
85
+ KramScan now features a modular plugin system that makes extending vulnerability detection effortless:
86
+
87
+ ```
88
+ src/plugins/
89
+ β”œβ”€β”€ types.ts # Base interfaces and types
90
+ β”œβ”€β”€ PluginManager.ts # Plugin orchestration
91
+ β”œβ”€β”€ index.ts # Plugin exports
92
+ └── vulnerabilities/ # Built-in plugins
93
+ β”œβ”€β”€ XSSPlugin.ts
94
+ β”œβ”€β”€ SQLInjectionPlugin.ts
95
+ β”œβ”€β”€ SecurityHeadersPlugin.ts
96
+ β”œβ”€β”€ SensitiveDataPlugin.ts
97
+ └── CSRFPlugin.ts
98
+ ```
99
+
100
+ **Creating a custom plugin:**
101
+
102
+ ```typescript
103
+ import { BaseVulnerabilityPlugin, PluginContext } from 'kramscan/plugins';
104
+
105
+ export class MyCustomPlugin extends BaseVulnerabilityPlugin {
106
+ readonly name = "Custom Detector";
107
+ readonly type = "custom";
108
+ readonly description = "Detects custom vulnerability";
109
+
110
+ async testParameter(context: PluginContext, param: string, value: string) {
111
+ // Your detection logic here
112
+ if (/* vulnerability found */) {
113
+ return this.success(this.createVulnerability(
114
+ "Custom Vulnerability",
115
+ "Description...",
116
+ context.url,
117
+ "high",
118
+ "Evidence...",
119
+ "Remediation..."
120
+ ));
121
+ }
122
+ return this.failure();
123
+ }
124
+ }
125
+ ```
126
+
127
+ <br />
128
+
129
+ ---
130
+
131
+ <br />
132
+
133
+ ## πŸ§ͺ Tech Stack
134
+ <div align="center">
135
+
136
+ | Component | Technology |
137
+ | :--- | :--- |
138
+ | **Runtime** | Node.js β‰₯ 18 |
139
+ | **Language** | TypeScript 5.4 |
140
+ | **CLI Framework** | Commander.js, Inquirer.js |
141
+ | **Browser Automation** | Puppeteer (Headless Chrome) |
142
+ | **AI Integration** | OpenAI SDK, Google Generative AI, Anthropic SDK |
143
+ | **Schema Validation** | Zod |
144
+ | **Reporting** | Docx, Puppeteer (PDF), Chalk |
145
+ | **Package Manager** | NPM / Yarn / PNPM |
146
+
147
+ </div>
148
+
149
+ <br />
150
+
151
+ ---
152
+
153
+ <br />
154
+
155
+ ## 🧠 Supported AI Providers
156
+
157
+ | Provider | SDK / Integration | Default Model |
158
+ | :--- | :--- | :--- |
159
+ | **OpenAI** | `openai` | `gpt-4` |
160
+ | **Anthropic** | `@anthropic-ai/sdk` | `claude-3-5-sonnet-20241022` |
161
+ | **Google Gemini** | `@google/generative-ai` | `gemini-2.0-flash` |
162
+ | **Mistral** | `@mistralai/mistralai` | `mistral-large-latest` |
163
+ | **OpenRouter** | OpenAI-compatible | `anthropic/claude-3.5-sonnet` |
164
+ | **Kimi** | OpenAI-compatible | `moonshot-v1-8k` |
165
+ | **Groq** | OpenAI-compatible | `llama-3.1-8b-instant` |
166
+
167
+ > Switch providers instantly with `kramscan onboard` or by editing `~/.kramscan/config.json`.
168
+
169
+ ### API Key Environment Variables
170
+ You can provide API keys via environment variables (useful for CI/CD) instead of saving them locally:
171
+
172
+ | Provider | Env Var |
173
+ | :--- | :--- |
174
+ | OpenAI | `OPENAI_API_KEY` |
175
+ | Anthropic | `ANTHROPIC_API_KEY` |
176
+ | Gemini | `GEMINI_API_KEY` |
177
+ | Mistral | `MISTRAL_API_KEY` |
178
+ | OpenRouter | `OPENROUTER_API_KEY` |
179
+ | Kimi | `KIMI_API_KEY` |
180
+ | Groq | `GROQ_API_KEY` |
181
+
182
+ ### Smart Environment Detection
183
+ 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.
184
+
185
+ ### AI-Powered Context-Aware Payloads
186
+ The scanning engine now utilizes AI to generate payloads tailored to the specific context of your application, significantly increasing detection rates against filtered inputs and complex WAFs.
187
+
188
+ ### Autonomous Finding Verification
189
+ The `kramscan agent` can now independently verify reported vulnerabilities using non-destructive, context-aware payloads to differentiate between theoretical findings and exploitable risks.
190
+
191
+ <br />
192
+
193
+ ---
194
+
195
+ <br />
196
+
197
+ ## πŸš€ Quick Start
198
+
199
+ ### 1. Installation
200
+ Install KramScan globally using npm:
201
+
202
+ ```bash
203
+ npm install -g kramscan
204
+ ```
205
+
206
+ ### 2. First-Time Setup
207
+ Initialize the configuration wizard to set up your AI provider and API keys:
208
+
209
+ ```bash
210
+ kramscan onboard
211
+ ```
212
+
213
+ ### 3. Run a Scan
214
+ Execute a full security scan on a target URL:
215
+
216
+ ```bash
217
+ kramscan scan https://example.com
218
+ ```
219
+
220
+ <br />
221
+
222
+ ---
223
+
224
+ <br />
225
+
226
+ ## πŸ“– Usage & Commands
227
+
228
+ | Command | Description | Status |
229
+ | :--- | :--- | :---: |
230
+ | `kramscan` | Launch the interactive dashboard menu with smart argument prompting. | βœ… Stable |
231
+ | `kramscan scan <url>` | Run a comprehensive vulnerability scan with post-scan prompts. | βœ… Stable |
232
+ | `kramscan agent` | Start the AI security assistant with autonomous verification skills. | βœ… Stable |
233
+ | `kramscan analyze` | AI-powered analysis with proactive onboarding redirection. | βœ… Stable |
234
+ | `kramscan report` | Generate professional reports with optional AI executive summaries. | βœ… Stable |
235
+ | `kramscan onboard` | Smart setup wizard with environment key detection. | βœ… Stable |
236
+ | `kramscan doctor` | Verify environment health and check for Docker dependencies. | βœ… Stable |
237
+ | `kramscan config` | View and edit current configuration with robust schema defaults. | βœ… Stable |
238
+ | `kramscan scans` | List and inspect recent scans from the persistent index. | βœ… Stable |
239
+ | `kramscan ai` | AI helpers (model listing and connectivity test). | βœ… Stable |
240
+
241
+ <br />
242
+
243
+ ### Scan Profiles and Limits
244
+ KramScan supports profiles for quick tuning:
245
+
246
+ ```bash
247
+ kramscan scan https://example.com --profile quick
248
+ kramscan scan https://example.com --profile balanced
249
+ kramscan scan https://example.com --profile deep
250
+ ```
251
+
252
+ You can also control crawl limits and URL scope:
253
+
254
+ ```bash
255
+ kramscan scan https://example.com --max-pages 30 --max-links-per-page 50
256
+ kramscan scan https://example.com --exclude "logout|signout"
257
+ kramscan scan https://example.com --include "^https://example\.com/docs"
258
+ ```
259
+
260
+ ### Automatic PDF Report After Scan
261
+ After each scan, KramScan automatically generates a PDF report (no separate command required).
262
+
263
+ The file is saved to:
264
+
265
+ - JSON: `~/.kramscan/scans/scan-<timestamp>.json`
266
+ - PDF: `~/.kramscan/reports/scanreport_<hostname>_<timestamp>.pdf`
267
+
268
+ You can disable it with:
269
+
270
+ ```bash
271
+ kramscan scan https://example.com --no-pdf
272
+ ```
273
+
274
+ ### Error Tracking and Recovery
275
+ KramScan now features comprehensive error handling:
276
+
277
+ - **Continue on Failure**: Scan continues even if individual URLs fail to load
278
+ - **Plugin Error Isolation**: If one vulnerability plugin fails, others continue working
279
+ - **Error Reports**: PDF reports include a "⚠️ Scan Errors & Skipped Items" section
280
+ - **CLI Feedback**: Real-time error messages during scanning
281
+
282
+ ### Event-Driven Progress Feedback
283
+ Watch your scan progress in real-time:
284
+
285
+ ```
286
+ πŸ” Starting Security Scan
287
+ ──────────────────────────────────────────────────
288
+
289
+ βœ” Initializing scanner...
290
+ β ΄ Crawling: https://example.com (5/30)
291
+ ⚠️ Found high vulnerability: Reflected Cross-Site Scripting (XSS)
292
+ β ΄ Continuing scan (1 vulns found)...
293
+ β ΄ Testing forms on https://example.com/login (3 forms)...
294
+ βœ” Scan complete!
295
+ ```
296
+
297
+ ### Scan History
298
+ Every scan is indexed in `~/.kramscan/scans/index.json`.
299
+
300
+ ```bash
301
+ kramscan scans list -n 10
302
+ kramscan scans latest
303
+ ```
304
+
305
+ ### AI Diagnostics
306
+ List models and test your configured provider/model:
307
+
308
+ ```bash
309
+ kramscan ai models -n 10
310
+ kramscan ai test
311
+ ```
312
+
313
+ ### Example Agent Session
314
+ ```bash
315
+ $ kramscan agent
316
+ > scan https://example.com
317
+
318
+ Agent: I'll perform a comprehensive security scan of https://example.com.
319
+ Checking for XSS, SQLi, and missing headers...
320
+ [Scanning...]
321
+
322
+ Agent: Scan complete! Found 2 High severity issues.
323
+ Would you like me to generate a report?
324
+ ```
325
+
326
+ <br />
327
+
328
+ ---
329
+
330
+ <br />
331
+
332
+ ## πŸ—ΊοΈ Roadmap
333
+
334
+ - [x] Core vulnerability scanner (XSS, SQLi, CSRF, headers)
335
+ - [x] Multi-provider AI analysis engine
336
+ - [x] Interactive AI agent mode
337
+ - [x] Professional report generation (DOCX, TXT, JSON)
338
+ - [x] Configuration wizard & management
339
+ - [x] **Plugin system for custom scan modules** βœ…
340
+ - [x] **PDF report generation** βœ…
341
+ - [x] **Event-driven progress feedback** βœ…
342
+ - [x] **Error resilience and recovery** βœ…
343
+ - [x] **Zod schema validation** βœ…
344
+ - [x] **AI Executive Summaries** βœ…
345
+ - [x] **Autonomous Verification Agent** βœ…
346
+ - [x] **Smarter Interactive Flows** βœ…
347
+ - [ ] CI/CD integration (GitHub Actions, GitLab CI)
348
+ - [ ] Web-based dashboard UI
349
+ - [ ] SARIF export format
350
+ - [ ] OWASP ZAP integration
351
+
352
+ <br />
353
+
354
+ ---
355
+
356
+ <br />
357
+
358
+ ## πŸ”’ Security & Privacy
359
+ - **Local Execution:** All scanning logic runs locally on your machine.
360
+ - **API Key Safety:** AI provider API keys are stored securely in your local home directory and are never sent to our servers.
361
+ - **Data Privacy:** Scan data is sent only to your chosen AI provider for analysis and is not stored by KramScan.
362
+ - **Error Tracking:** Failed scan attempts are logged locally for debugging but never transmitted.
363
+
364
+ <br />
365
+
366
+ ---
367
+
368
+ <br />
369
+
370
+ ## πŸ‘€ Author
371
+ <div align="center">
372
+
373
+ **Akram Shaikh**
374
+
375
+ [![Website](https://img.shields.io/badge/Website-akramshaikh.me-blue?style=for-the-badge&logo=google-chrome&logoColor=white)](https://akramshaikh.me)
376
+ [![GitHub](https://img.shields.io/badge/GitHub-shaikhakramshakil-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/shaikhakramshakil)
377
+ [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/shaikhakramshakil/)
378
+
379
+ </div>
380
+
381
+ <br />
382
+
383
+ ---
384
+
385
+ <br />
386
+
387
+ ## πŸ“„ License
388
+ This project is licensed under the **MIT License** β€” see the [LICENSE](LICENSE) file for details.
389
+
390
+ <div align="center">
391
+ <sub>Made with ❀️ by Akram Shaikh</sub>
392
+ </div>
@@ -2,6 +2,7 @@
2
2
  * Confirmation Prompt System
3
3
  * Handles user confirmation for skill execution with detailed risk assessment
4
4
  */
5
+ import * as readline from "readline";
5
6
  import { ConfirmationPrompt } from "./types";
6
7
  export interface ConfirmationResult {
7
8
  confirmed: boolean;
@@ -10,7 +11,10 @@ export interface ConfirmationResult {
10
11
  }
11
12
  export declare class ConfirmationHandler {
12
13
  private rl;
13
- constructor();
14
+ private ownsRl;
15
+ constructor(rl?: readline.Interface);
16
+ setInterface(rl: readline.Interface): void;
17
+ private getInterface;
14
18
  /**
15
19
  * Display confirmation prompt and get user response
16
20
  */