penthera 1.1.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 (74) hide show
  1. package/CHANGELOG.md +168 -0
  2. package/LICENSE +21 -0
  3. package/README.md +561 -0
  4. package/SECURITY.md +31 -0
  5. package/bin/penthera.js +3 -0
  6. package/bin/scan.js +11 -0
  7. package/docs/index.md +60 -0
  8. package/docs/owasp-wstg-coverage.md +79 -0
  9. package/lib/adaptive-probes.js +334 -0
  10. package/lib/attack-surface.js +149 -0
  11. package/lib/audit-loop.js +170 -0
  12. package/lib/blackbox/adaptive-scan.js +137 -0
  13. package/lib/blackbox/client-auth.js +60 -0
  14. package/lib/blackbox/email-dns.js +135 -0
  15. package/lib/blackbox/headers.js +91 -0
  16. package/lib/blackbox/idor.js +113 -0
  17. package/lib/blackbox/jwt.js +73 -0
  18. package/lib/blackbox/oauth.js +50 -0
  19. package/lib/blackbox/openapi.js +227 -0
  20. package/lib/compliance/incident.js +169 -0
  21. package/lib/compliance/index.js +163 -0
  22. package/lib/compliance/policy-pack.js +293 -0
  23. package/lib/compliance/questionnaire.js +113 -0
  24. package/lib/compliance/readiness.js +229 -0
  25. package/lib/compliance/self-assessment.js +66 -0
  26. package/lib/crawler.js +257 -0
  27. package/lib/fuzzer.js +233 -0
  28. package/lib/injections.js +676 -0
  29. package/lib/jurisdictions/nl.json +48 -0
  30. package/lib/knowledge-graph.js +232 -0
  31. package/lib/machine.js +814 -0
  32. package/lib/nuclei-loader.js +283 -0
  33. package/lib/owasp-wstg.js +204 -0
  34. package/lib/params.js +235 -0
  35. package/lib/plugins.js +70 -0
  36. package/lib/provenance.js +82 -0
  37. package/lib/recon.js +193 -0
  38. package/lib/remediation/index.js +219 -0
  39. package/lib/retirejs.js +239 -0
  40. package/lib/supply-chain.js +131 -0
  41. package/lib/templates.js +364 -0
  42. package/lib/tls.js +145 -0
  43. package/lib/whitebox/frameworks.js +139 -0
  44. package/lib/whitebox/sbom.js +144 -0
  45. package/lib/whitebox/secrets.js +111 -0
  46. package/package.json +76 -0
  47. package/pentest.config.example.js +82 -0
  48. package/scripts/package-skill.sh +16 -0
  49. package/skills/penthera/SKILL.md +272 -0
  50. package/skills/penthera/references/authorization.md +36 -0
  51. package/skills/penthera/references/output-and-ci.md +109 -0
  52. package/skills/penthera/references/profiles-and-flags.md +74 -0
  53. package/skills/penthera/references/remediation.md +267 -0
  54. package/skills/penthera/references/reporting.md +113 -0
  55. package/skills/penthera/references/secure-defaults.md +41 -0
  56. package/skills/penthera/references/troubleshooting.md +100 -0
  57. package/skills/penthera/scripts/preflight.sh +66 -0
  58. package/skills/penthera/scripts/validate-report.mjs +53 -0
  59. package/skills/penthera/scripts/validate-report.sh +8 -0
  60. package/src/cli/ansi.js +70 -0
  61. package/src/cli/baseline.js +37 -0
  62. package/src/cli/merge-results.js +71 -0
  63. package/src/cli/onboarding.js +216 -0
  64. package/src/cli/profiles.js +53 -0
  65. package/src/cli/prompt.js +64 -0
  66. package/src/cli/run-scan.js +152 -0
  67. package/src/cli.js +536 -0
  68. package/src/report/markdown.js +182 -0
  69. package/src/reporter.js +512 -0
  70. package/src/scan-repo.js +205 -0
  71. package/src/scan-url.js +563 -0
  72. package/src/utils/auth.js +13 -0
  73. package/src/utils/http.js +38 -0
  74. package/src/utils/url.js +54 -0
package/README.md ADDED
@@ -0,0 +1,561 @@
1
+ <div align="center">
2
+
3
+ <img src="assets/penthera-social.jpg" alt="Penthera, a security scanner for Claude, Cursor and CLI" width="840">
4
+
5
+ <br/><br/>
6
+
7
+ ![version](https://img.shields.io/badge/version-1.1.0-0000ed)
8
+ ![node](https://img.shields.io/badge/node-%E2%89%A518-0000ed)
9
+ ![license](https://img.shields.io/badge/license-MIT-0000ed)
10
+ [![CI](https://github.com/danoszz/penthera/actions/workflows/ci.yml/badge.svg)](https://github.com/danoszz/penthera/actions/workflows/ci.yml)
11
+
12
+ <br/>
13
+
14
+ <img src="assets/demo.gif" alt="Penthera running an interactive security scan in the terminal" width="760">
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## Two ways to use it
21
+
22
+ **As an Agent Skill (recommended).** Most people start here. Let Cursor or Claude
23
+ Code drive it: [install once](#run-it), then ask it to "scan my app for security
24
+ issues." The agent picks the scan, runs it, and gives you the fixes.
25
+
26
+ **As a CLI.** Prefer the terminal? Run `penthera https://myapp.com`, or just
27
+ `penthera` for the guided wizard. See the [quick start](#quick-start).
28
+
29
+ ---
30
+
31
+ ## Why Penthera
32
+
33
+ You shipped something fast: vibecoded, AI-assisted, already live. The same models
34
+ that helped you build it also make it easy for someone to probe it. Exposed API
35
+ routes, missing security headers, weak auth, a hardcoded key in the repo. These
36
+ are the common mistakes that get apps broken into.
37
+
38
+ Penthera is the check you run before you launch. Ask your agent to "scan my app
39
+ for security issues" and it runs an authorized, non-destructive scan, then lists
40
+ the top fixes in priority order. You do not need a DAST suite or a security
41
+ background to use it.
42
+
43
+ Penthera is for hardening systems you own. It is powerful, so please use it
44
+ carefully. See [Ethical use](#ethical-use--authorization) and the [Disclaimer](#disclaimer).
45
+
46
+ ---
47
+
48
+ ## Run it
49
+
50
+ **One-line install** (clones the repo, links the CLI, and installs the skill into
51
+ Cursor and Claude Code if it finds them):
52
+
53
+ ```bash
54
+ curl -fsSL https://raw.githubusercontent.com/danoszz/penthera/main/install.sh | bash
55
+ ```
56
+
57
+ **Or via the Agent Skills CLI** (Cursor, Claude Code, and [40+ agents](https://agentskills.io/clients)):
58
+
59
+ ```bash
60
+ npx skills add danoszz/penthera
61
+ ```
62
+
63
+ Then talk to your agent:
64
+
65
+ ```
66
+ "Scan my localhost:3000 for security issues"
67
+ "Run a pre-deploy security audit on staging.myapp.com"
68
+ "Find hardcoded secrets in this repo before I push"
69
+ ```
70
+
71
+ Prefer the terminal? Run `penthera` with no arguments for a guided wizard.
72
+
73
+ > The skill adds an authorization gate: it instructs your agent to refuse targets
74
+ > you do not own or are not authorized to test.
75
+
76
+ ---
77
+
78
+ ## What it does
79
+
80
+ | Mode | Command | Coverage |
81
+ |------|---------|----------|
82
+ | **URL scan** | `penthera https://example.com` | TLS, fingerprinting, endpoint discovery, templates, CORS, cookies, JS CVEs, param discovery, OpenAPI/FastAPI probes, security headers, auth hardening |
83
+ | **Repo scan** | `penthera --repo ./my-app` | API route discovery (Next.js, Express, Hono, Fastify), trust-boundary mapping, hardcoded-secret scanning |
84
+ | **Combined** | `penthera https://staging.app --repo .` | Black-box and white-box in one run |
85
+ | **Interactive** | `penthera` *(no args)* | Guided wizard (URL plus optional repo scan, Markdown report) |
86
+ | **Machine audit** | `penthera --machine` | macOS checks (keyloggers, persistence, rootkits) |
87
+
88
+ Pick a profile, or add individual flags for more depth:
89
+
90
+ | Profile | Command | What runs |
91
+ |---------|---------|-----------|
92
+ | **quick** | `--profile quick` | Headers, OpenAPI, auth smoke tests (about 10s) |
93
+ | **standard** | *(default)* | Full non-destructive scan |
94
+ | **deep** | `--profile deep` | recon, injection probes, and API fuzzing |
95
+
96
+ Individual flags: `--recon`, `--deep`, `--fuzz`, `--adaptive`, `--nuclei <path>`, `--templates <dirs>`, `--all`
97
+
98
+ ---
99
+
100
+ ## How it works
101
+
102
+ ```mermaid
103
+ flowchart LR
104
+ U["You / your AI agent"] -->|scan request| P((Penthera))
105
+
106
+ P --> BB["Black-box<br/>TLS, headers, CORS<br/>endpoint + OpenAPI discovery<br/>JWT, auth, IDOR/OAuth<br/>injection, fuzzing"]
107
+ P --> WB["White-box<br/>API routes<br/>secret scanning<br/>trust boundaries"]
108
+ P --> MA["Machine audit<br/>(macOS)"]
109
+
110
+ BB --> F[["Findings<br/>scored by severity"]]
111
+ WB --> F
112
+ MA --> F
113
+
114
+ F --> T["Terminal summary<br/>+ top 3 fixes"]
115
+ F --> MD["Markdown report"]
116
+ F --> J["JSON"]
117
+ F --> S["SARIF to GitHub Security"]
118
+ ```
119
+
120
+ Findings map to the [OWASP Web Security Testing Guide](docs/owasp-wstg-coverage.md)
121
+ (WSTG v4.2). The default scan is non-destructive. Payload-based testing is opt-in
122
+ (`--deep`, `--fuzz`, `--all`) and gated behind explicit confirmation.
123
+
124
+ ---
125
+
126
+ ## Compliance: NIS2 and the cyberwetgeving
127
+
128
+ The EU NIS2 directive and its national transpositions (the Cyberbeveiligingswet
129
+ in the Netherlands, the NIS2-wet in Belgium) put a duty of care, the *zorgplicht*,
130
+ on in-scope organisations. That duty is the set of risk-management measures in
131
+ Article 21(2) of the directive. Most of them are organisational. Some are
132
+ technical and testable, and that is the part Penthera helps with.
133
+
134
+ Penthera does not make you compliant and does not certify anything. What it gives
135
+ you is automated, repeatable technical evidence for the measures a scanner can
136
+ honestly verify: the kind of artefact you can attach to a risk file, show an
137
+ auditor, or run in CI so a regression shows up before it ships.
138
+
139
+ | Art. 21(2) measure | What Penthera does | Coverage |
140
+ |--------------------|--------------------|----------|
141
+ | **(a)** Risk analysis & information-security policy | Findings, severity, and baseline history feed your risk analysis | Evidence |
142
+ | **(b)** Incident handling | Report scaffolding (on the roadmap) | Planned |
143
+ | **(c)** Business continuity, backup, crisis management | Organisational; outside a scanner's reach | Out of scope |
144
+ | **(d)** Supply-chain security | Known-CVE checks on JS dependencies (Retire.js); leaked third-party credentials (secret scan) | Partial |
145
+ | **(e)** Security in acquisition, development & maintenance; **vulnerability handling** | The core: black- + white-box scanning mapped to OWASP WSTG, SARIF → GitHub, baseline regression, scan-and-fix loop | **Strong** |
146
+ | **(f)** Assessing the effectiveness of measures | Baseline diff + re-scan-to-verify is a repeatable effectiveness check | Partial |
147
+ | **(g)** Cyber hygiene & training | Remediation playbook + secure-defaults guidance (guidance, not a training programme) | Partial |
148
+ | **(h)** Cryptography & encryption | TLS protocol/cipher/certificate audit, HSTS, cookie `Secure` (transport layer only) | Partial |
149
+ | **(i)** HR security, **access control**, asset management | Access control tested: JWT, IDOR/BOLA, OAuth redirect, client-side-auth, trust-boundary mapping | Partial |
150
+ | **(j)** Multi-factor authentication & secure communications | MFA probe (on the roadmap) | Planned |
151
+
152
+ **Coverage key:** *Strong* = automated technical testing · *Partial* = part of the
153
+ measure · *Evidence* = output feeds the measure, no direct test · *Planned* = on the
154
+ roadmap · *Out of scope* = organisational or physical.
155
+
156
+ In practice, Penthera today gives you solid automated evidence for the
157
+ secure-development and vulnerability-handling duty (e), which is the technical
158
+ heart of the zorgplicht, plus meaningful coverage of supply chain (d),
159
+ cryptography in transit (h), access control (i), and effectiveness testing (f).
160
+ That is not the whole duty of care, but it is a real, defensible start you can run
161
+ today and re-run on every deploy.
162
+
163
+ > **Not legal advice, not a certification, not a guarantee of compliance.**
164
+ > Penthera automates the technical-testing part of the duty of care. The
165
+ > directive's organisational duties (governance, risk-management policy,
166
+ > incident-notification processes, supply-chain contracts, staff training) need
167
+ > human process and, where it matters, review by a qualified advisor. For an
168
+ > authoritative reading, consult your national authority (the NCSC in the
169
+ > Netherlands, the CCB and its CyFun framework in Belgium) or a specialised jurist.
170
+
171
+ Generate this mapping for your own scan with `--framework nis2`. It adds a
172
+ per-run coverage table (which measures *this* scan actually exercised, driven by
173
+ the probes that ran) to the terminal, Markdown, and JSON reports:
174
+
175
+ ```bash
176
+ penthera https://myapp.com --framework nis2 -o reports/scan.json
177
+ ```
178
+
179
+ ### Readiness report (clone → report in two commands)
180
+
181
+ Go further than the mapping: combine the scan with a short offline
182
+ self-assessment (the organisational measures a scanner can't test, like policies,
183
+ backups, training, and MFA) into a full NIS2 readiness report. Every Article 21
184
+ measure is marked `met / partial / gap / n-a`, with proportionality notes, your
185
+ incident-reporting deadlines, and provenance on every piece of evidence.
186
+
187
+ ```bash
188
+ # 1. Create your self-assessment (offline, one-time). Fill in yes | partial | no | na.
189
+ penthera --assessment-init assessment.json
190
+
191
+ # 2. Scan + self-assessment → readiness report (writes reports/scan-readiness.md)
192
+ penthera https://myapp.com --repo . --readiness --assessment assessment.json -o reports/scan.json
193
+ ```
194
+
195
+ The readiness report is **evidence and self-assessment tooling, not a
196
+ certification**. It is provenance-linked (`source, method, collected_at,
197
+ confidence`) and reproducible, and it lists exactly what only you can attest to.
198
+ Jurisdiction specifics live in `lib/jurisdictions/nl.json` (NL today; BE and
199
+ others are just added config).
200
+
201
+ ### Answer a customer's security questionnaire
202
+
203
+ The questionnaire blocking your deal, drafted from evidence you already have:
204
+
205
+ ```bash
206
+ # one question per line, pasted from the customer's form
207
+ penthera https://myapp.com --readiness --assessment assessment.json --questionnaire questions.txt
208
+ ```
209
+
210
+ Each question is mapped to the Article 21 measure it belongs to and answered
211
+ from the scan and your self-assessment, with the backing evidence cited.
212
+ Anything Penthera can't map is marked `NEEDS HUMAN INPUT` instead of guessed.
213
+ Review every answer before you send it.
214
+
215
+ ### Policy pack
216
+
217
+ Generate the proportionate written policies NIS2 expects, pre-filled from your
218
+ readiness gaps and the NL incident deadlines:
219
+
220
+ ```bash
221
+ penthera --policy-pack ./policies --org "Your Company" --readiness --assessment assessment.json
222
+ ```
223
+
224
+ Writes editable Markdown starting points: information security, access control,
225
+ incident response, backup/continuity, acceptable use, supplier security, and
226
+ vulnerability management. **Templates, not legal advice.** Keep them short and
227
+ used. A two-page policy that genuinely exists is what "proportionate" means.
228
+
229
+ ### Incident-report helper
230
+
231
+ NIS2 has hard reporting deadlines (24h early warning, 72h notification, 1-month
232
+ final report). If something happens, get the timeline and draft reports:
233
+
234
+ ```bash
235
+ penthera --incident-init incident.json # fill in what happened (set aware_at)
236
+ penthera --incident incident.json # writes incident-reports.md
237
+ ```
238
+
239
+ It computes your three deadlines from when you became aware, flags anything
240
+ overdue, and drafts the early-warning, notification, and final report against
241
+ the required content, with `NEEDS INPUT` where you still have to fill in facts.
242
+ **These are drafts to help you meet the deadlines, not a substitute for your
243
+ authority's official form.**
244
+
245
+ ### Software bill of materials (SBOM)
246
+
247
+ Emit a standard CycloneDX SBOM of your dependencies. It's what enterprises
248
+ increasingly require of suppliers, and direct evidence for supply-chain security
249
+ (measure d):
250
+
251
+ ```bash
252
+ penthera --repo . --sbom sbom.cdx.json
253
+ ```
254
+
255
+ Parses `package-lock.json` / `package.json` / `requirements.txt` offline (no
256
+ network), with resolved versions and package URLs (purls).
257
+
258
+ ### Remediation tracking (the audit loop)
259
+
260
+ Closing findings matters more than finding them. Track them over time:
261
+ time-to-fix, ageing of open items, and what changed since the last scan (evidence
262
+ for measure f, effectiveness):
263
+
264
+ ```bash
265
+ penthera https://myapp.com --history reports/history.json -o reports/scan.json
266
+ ```
267
+
268
+ Each run folds the current findings into a small history keyed by a **stable
269
+ fingerprint** (so a re-worded or re-counted finding isn't mistaken for a new
270
+ one), then reports open vs resolved, median time-to-fix, and ageing buckets.
271
+ Re-run on a cadence to watch the trend.
272
+
273
+ ### Supplier rating (passive)
274
+
275
+ Assess your suppliers' public security posture for supply-chain risk (measure d):
276
+
277
+ ```bash
278
+ printf 'supplier1.com\nsupplier2.com\n' > suppliers.txt
279
+ penthera --suppliers suppliers.txt
280
+ ```
281
+
282
+ **Strictly passive and public-data-only.** One homepage GET (security headers),
283
+ a TLS handshake (certificate), and public DNS lookups (SPF/DMARC/MX) per domain.
284
+ No endpoint discovery, no auth probes, no intrusive testing. You get a
285
+ red/amber/green rating per supplier. It's a screening aid for your own vendor
286
+ risk assessment, **not** an authorised penetration test of the supplier.
287
+
288
+ Because the mapping targets the NIS2 directive itself, it applies across the
289
+ national transpositions; jurisdiction-specific profiles (NL, BE) are on the roadmap.
290
+
291
+ ---
292
+
293
+ ## Ethical use & authorization
294
+
295
+ Penthera sends HTTP requests to the targets you give it. Some modes (`--deep`,
296
+ `--fuzz`, `--all`) send attack payloads designed to find vulnerabilities. Use it
297
+ responsibly.
298
+
299
+ **You may use Penthera when:**
300
+
301
+ - You **own** the target (your app, your server, your project).
302
+ - You have **written authorization** from the system owner (email, ticket, signed scope).
303
+ - You scan **localhost** or private lab environments you control.
304
+ - You use it for **defensive security**: research, coursework, CI hardening, pre-release audits.
305
+
306
+ **You must not use Penthera to:**
307
+
308
+ - Scan systems you do not own or lack explicit permission to test.
309
+ - Probe government, healthcare, financial, or third-party production systems without authorization.
310
+ - Exfiltrate data, disrupt services, or bypass access controls.
311
+ - Use findings to attack, extort, or harm anyone.
312
+
313
+ > Before scanning any URL that is not localhost, confirm you have permission.
314
+ > **When in doubt, do not scan.**
315
+
316
+ Unauthorized security testing may violate computer-misuse laws (for example the US
317
+ CFAA, the UK Computer Misuse Act, and EU national equivalents) and can result in
318
+ criminal prosecution, civil liability, IP blocking, account termination, and
319
+ academic or professional penalties.
320
+
321
+ ---
322
+
323
+ ## Disclaimer
324
+
325
+ Penthera is provided for legitimate security research and defensive testing of
326
+ systems you own or are authorized to test, and for that purpose only.
327
+
328
+ - It is a research and self-assessment tool. Scan your own apps to find and fix
329
+ weaknesses before attackers do.
330
+ - The same capabilities that harden a system can cause harm if pointed at someone
331
+ else's. Use it carefully and lawfully.
332
+ - The author does not condone unauthorized or malicious use, and accepts no
333
+ liability for any damage, loss, or legal consequence arising from use or misuse
334
+ of this software.
335
+ - The software is provided "as is", without warranty of any kind. See [LICENSE](LICENSE) (MIT).
336
+ - You are solely responsible for ensuring every scan you run is authorized and
337
+ legal in your jurisdiction.
338
+
339
+ By using Penthera you accept these terms.
340
+
341
+ ---
342
+
343
+ ## Install
344
+
345
+ The [one-line installer](#run-it) is the fastest path. To set it up manually:
346
+
347
+ ```bash
348
+ git clone https://github.com/danoszz/penthera.git
349
+ cd penthera
350
+ npm install
351
+ npm link # exposes `penthera` and `penthera-scan` globally
352
+ penthera --version
353
+ ```
354
+
355
+ Requirements: Node.js 18+ and npm. Optional: nuclei-templates for `--nuclei`, and
356
+ Docker. To run it in a container:
357
+
358
+ ```bash
359
+ docker build -t penthera .
360
+ docker run --rm penthera https://your-app.example
361
+ ```
362
+
363
+ ---
364
+
365
+ ## Quick start
366
+
367
+ ```bash
368
+ # First time? Run with no args for guided setup
369
+ penthera
370
+
371
+ # Safe default scan (non-destructive)
372
+ penthera https://myapp.com
373
+
374
+ # Staging plus source code, full report set
375
+ penthera https://staging.myapp.com --repo . --all -o reports/scan.json --sarif reports/scan.sarif
376
+
377
+ # Baseline diff: show only new findings since the last scan
378
+ penthera https://myapp.com -o reports/scan.json --baseline reports/previous.json
379
+
380
+ # Authenticated scan (session cookie or bearer token)
381
+ PENTHERA_BEARER=eyJ... penthera https://myapp.com --profile standard
382
+ penthera https://myapp.com --auth-cookie "session=abc123"
383
+ ```
384
+
385
+ Writing to `-o reports/scan.json` also drops a human-readable `reports/scan.md`
386
+ next to it. Reports are gitignored by default.
387
+
388
+ ### Exit codes
389
+
390
+ | Code | Meaning |
391
+ |------|---------|
392
+ | `0` | No critical or high findings |
393
+ | `1` | Critical or high findings detected |
394
+ | `2` | Scan failed (unreachable target, bad config) |
395
+
396
+ ---
397
+
398
+ ## Output
399
+
400
+ | Format | Flag | Use |
401
+ |--------|------|-----|
402
+ | Terminal | *(default)* | Colored summary plus top 3 fixes |
403
+ | **Markdown** | `--markdown file.md` or `-o file.json` | Human-readable report (exec summary, findings tables, fixes). Written next to `-o` automatically |
404
+ | JSON | `--json` or `-o file.json` | CI pipelines, baseline diffs, custom tooling |
405
+ | SARIF | `--sarif file.sarif` | GitHub Security / Code Scanning tab |
406
+
407
+ ---
408
+
409
+ ## For your AI coding agent
410
+
411
+ Penthera ships as an [Agent Skill](https://agentskills.io), the open format used
412
+ by Cursor, Claude Code, Claude.ai, and [40+ agent tools](https://agentskills.io/clients).
413
+ The skill teaches an agent to run authorized scans, pick the right profile, and
414
+ summarize findings, so you can just describe what you want.
415
+
416
+ **Install** (any of these):
417
+
418
+ ```bash
419
+ # Cross-agent, frictionless
420
+ npx skills add danoszz/penthera
421
+
422
+ # Or the one-line installer (also links the CLI)
423
+ curl -fsSL https://raw.githubusercontent.com/danoszz/penthera/main/install.sh | bash
424
+
425
+ # Or copy into a single project for team sharing
426
+ cp -r skills/penthera .cursor/skills/penthera # Cursor
427
+ cp -r skills/penthera .claude/skills/penthera # Claude Code
428
+ ```
429
+
430
+ Or as a Claude Code plugin (installs the skill):
431
+
432
+ ```bash
433
+ /plugin marketplace add danoszz/penthera
434
+ /plugin install penthera@penthera
435
+ ```
436
+
437
+ For Claude.ai (web), zip and upload the skill:
438
+
439
+ ```bash
440
+ npm run package:skill # produces penthera-skill.zip; upload in Settings > Capabilities > Skills
441
+ ```
442
+
443
+ **Prompts that trigger it:**
444
+
445
+ - "Scan my localhost app on port 3000 for security issues"
446
+ - "Run a pre-deploy audit on staging.myapp.com and summarize critical findings"
447
+ - "Scan this repo for hardcoded secrets and exposed API routes"
448
+ - "Compare today's scan to last week's baseline and show only new findings"
449
+ - "Generate a SARIF report for GitHub code scanning"
450
+
451
+ The skill adds an authorization gate: it instructs the agent to refuse targets you
452
+ do not own or are not authorized to test, and the wizard asks you to confirm before
453
+ scanning a remote host. It is an agent-level and interactive safeguard, not something
454
+ the raw CLI enforces. You are responsible for every target you pass it. Run preflight
455
+ before the first scan:
456
+
457
+ ```bash
458
+ bash skills/penthera/scripts/preflight.sh http://localhost:3000
459
+ ```
460
+
461
+ Skill source and workflows live in [`skills/penthera/SKILL.md`](skills/penthera/SKILL.md).
462
+
463
+ ---
464
+
465
+ ## Scan and fix
466
+
467
+ Penthera does not just report problems. It closes the loop: ask your agent to fix what it finds, and it detects the issue, applies a framework-aware fix to your code (shown as a diff for you to approve), and re-scans to prove it is resolved.
468
+
469
+ ```
470
+ "Scan my app and fix what you find"
471
+ "Fix the security headers on my Next.js app and re-scan to confirm"
472
+ "Find and fix hardcoded secrets in this repo"
473
+ ```
474
+
475
+ Fixes come from a [remediation playbook](skills/penthera/references/remediation.md) covering Next.js, Express, Fastify, Hono, and FastAPI. They are always shown as diffs for your approval and verified by a re-scan; nothing is applied blindly, and nothing touches production. To build secure-by-default in the first place, see [secure defaults](skills/penthera/references/secure-defaults.md).
476
+
477
+ ---
478
+
479
+ ## CI integration
480
+
481
+ ```yaml
482
+ # Scan a staging URL on a schedule and upload results to GitHub Security.
483
+ # Set the PENTEST_STAGING_URL secret to enable. Full example: .github/workflows/scan.yml
484
+ - run: npx penthera "$PENTEST_URL" --profile standard --sarif reports/scan.sarif
485
+ - uses: github/codeql-action/upload-sarif@v3
486
+ with:
487
+ sarif_file: reports/scan.sarif
488
+ ```
489
+
490
+ The repo's own CI (`.github/workflows/ci.yml`) runs the offline suites on Node 18,
491
+ 20, and 22, and self-scans a mock vulnerable API on every push.
492
+
493
+ ---
494
+
495
+ ## Configuration
496
+
497
+ For live integration tests against your own routes:
498
+
499
+ ```bash
500
+ cp pentest.config.example.js pentest.config.js # gitignored
501
+ ```
502
+
503
+ Edit the route groups, then run `npm run pentest:live`. Set `PENTEST_BASE_URL` to
504
+ point at staging without editing the file.
505
+
506
+ ---
507
+
508
+ ## Testing & contributing
509
+
510
+ ```bash
511
+ npm test # full suite (live integration tests skip without a running target)
512
+ npm run pentest:mock # offline tests against a local mock vuln API
513
+ npm run mock-server # start the mock API on port 8765
514
+ ```
515
+
516
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the project layout, how to add a probe
517
+ or template, the test matrix, and the release and publishing checklist.
518
+
519
+ ---
520
+
521
+ ## Status
522
+
523
+ **v1.0, production-ready.** URL, repo, and machine scanning, scan profiles,
524
+ Markdown, JSON, and SARIF reports, session-aware auth, JWT, IDOR, OAuth, and
525
+ header probes, adaptive knowledge-graph probing, a plugins and templates API,
526
+ Docker, CI, and the Agent Skill are all shipped. See the [CHANGELOG](CHANGELOG.md)
527
+ for the full history.
528
+
529
+ Penthera is actively maintained. Issues and PRs welcome.
530
+
531
+ ---
532
+
533
+ ## Support Penthera
534
+
535
+ Penthera is free and MIT-licensed. If it caught something before you shipped it,
536
+ you can help keep it maintained:
537
+
538
+ [![Sponsor on GitHub](https://img.shields.io/badge/Sponsor-GitHub-db61a2?logo=githubsponsors)](https://github.com/sponsors/danoszz)
539
+
540
+ Sponsorship funds new probes, broader framework coverage, and keeping the suite
541
+ current with new attack patterns. Thank you.
542
+
543
+ ---
544
+
545
+ ## Privacy
546
+
547
+ Penthera has no telemetry. It does not collect, store, or transmit any usage data, analytics, or personal information to the author or any third party. It does not phone home.
548
+
549
+ - **Scan traffic goes only to the target you specify.** Auth tokens passed via `--auth-bearer`, `--auth-cookie`, or `PENTHERA_*` env vars are sent only to that target.
550
+ - **Reports stay local.** Output is written to `reports/` (gitignored) on your machine.
551
+ - **JS vulnerability checks** download a public database (Retire.js) from GitHub to compare your app's libraries against known CVEs locally. No details about your target are sent.
552
+ - **Recon mode** (`--recon`) queries public OSINT sources (crt.sh, web.archive.org, AlienVault OTX) with the target domain to find subdomains and historical URLs. This shares the target domain with those third-party services. Omit `--recon` to avoid it.
553
+
554
+ You are responsible for ensuring you are authorized to scan any target. See [Ethical use](#ethical-use--authorization).
555
+
556
+ ---
557
+
558
+ ## License & disclosure
559
+
560
+ MIT. See [LICENSE](LICENSE). Report vulnerabilities in Penthera itself via
561
+ [SECURITY.md](SECURITY.md). Only scan systems you own or are authorized to test.
package/SECURITY.md ADDED
@@ -0,0 +1,31 @@
1
+ # Security Policy
2
+
3
+ ## Supported versions
4
+
5
+ | Version | Supported |
6
+ | ------- | --------- |
7
+ | 1.0.x | Yes |
8
+ | < 1.0 | No |
9
+
10
+ ## Reporting a vulnerability
11
+
12
+ If you find a security issue in **Penthera itself** (not a finding produced by
13
+ scanning a target), please report it privately:
14
+
15
+ 1. Open a [GitHub Security Advisory](https://github.com/danoszz/penthera/security/advisories/new), or
16
+ 2. Email the repository owner with a clear description and reproduction steps.
17
+
18
+ Please do **not** open public issues for undisclosed vulnerabilities. We aim to
19
+ acknowledge reports within a few days.
20
+
21
+ ## Responsible use
22
+
23
+ Penthera sends HTTP requests to targets you specify. Some modes (`--deep`,
24
+ `--fuzz`, `--all`, `--profile deep`) send **attack payloads** (SQLi, SSTI, SSRF,
25
+ XSS, command injection, API fuzzing).
26
+
27
+ **Only scan systems you own or have explicit written permission to test.**
28
+ Unauthorized scanning may be illegal in your jurisdiction. Penthera is built for
29
+ defensive research and hardening your own applications — see the full
30
+ [ethical-use policy](README.md#ethical-use--authorization) and
31
+ [disclaimer](README.md#disclaimer) in the README.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { run } from "../src/cli.js";
3
+ run();
package/bin/scan.js ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Interactive scan — delegates to PostHog-style onboarding wizard.
4
+ * Alias: penthera-scan
5
+ */
6
+ import { runOnboarding } from "../src/cli/onboarding.js";
7
+
8
+ runOnboarding().catch((e) => {
9
+ console.error(e.message);
10
+ process.exit(2);
11
+ });
package/docs/index.md ADDED
@@ -0,0 +1,60 @@
1
+ # Penthera documentation
2
+
3
+ Lightweight security scanner for developers, scan live URLs, local repos, or macOS machines from the CLI.
4
+
5
+ ## Getting started
6
+
7
+ | Guide | Description |
8
+ |-------|-------------|
9
+ | [README](../README.md) | Install, quick start, ethical use |
10
+ | [Run it](../README.md#run-it) | Install + first-time wizard (`penthera` with no args) |
11
+ | [CHANGELOG](../CHANGELOG.md) | Version history |
12
+
13
+ ## Scanning
14
+
15
+ | Topic | Link |
16
+ |-------|------|
17
+ | Scan profiles | `quick` · `standard` · `deep`, see `--profile` in `penthera --help` |
18
+ | Authenticated scans | `--auth-cookie`, `--auth-bearer`, `PENTHERA_BEARER` env |
19
+ | Adaptive probes | `--adaptive`, knowledge-graph-driven escalation on live routes |
20
+ | Custom templates | `--templates ./my-templates`, Nuclei-compatible YAML dirs |
21
+ | Baseline diff | `--baseline reports/previous.json` |
22
+
23
+ ## Reports
24
+
25
+ | Format | Flag |
26
+ |--------|------|
27
+ | Markdown | `-o report.json` (auto `.md`) or `--markdown report.md` |
28
+ | JSON | `-o report.json` or `--json` |
29
+ | SARIF | `--sarif results.sarif`, GitHub Security tab |
30
+
31
+ ## Standards & CI
32
+
33
+ | Topic | Link |
34
+ |-------|------|
35
+ | OWASP WSTG mapping | [owasp-wstg-coverage.md](./owasp-wstg-coverage.md) |
36
+ | GitHub Actions CI | `.github/workflows/ci.yml` (mock scan + SARIF) |
37
+ | Staging scans | `.github/workflows/scan.yml`, set `PENTEST_STAGING_URL` secret |
38
+ | Docker | `docker build -t penthera . && docker run penthera https://localhost:3000` |
39
+
40
+ ## Agent skill
41
+
42
+ | Topic | Location |
43
+ |-------|----------|
44
+ | Skill files | `skills/penthera/SKILL.md` |
45
+ | Preflight | `bash skills/penthera/scripts/preflight.sh [URL]` |
46
+ | Validate report | `npm run validate:report -- reports/scan.json` |
47
+ | Release zip | `npm run package:skill` |
48
+
49
+ ## Programmatic API
50
+
51
+ ```javascript
52
+ import { loadTemplatesFromPaths, runTemplateScan } from "penthera/plugins";
53
+ import { runAdaptiveProbes } from "penthera/adaptive";
54
+ ```
55
+
56
+ See `lib/plugins.js` and `lib/blackbox/adaptive-scan.js` for exports shipped in the npm package.
57
+
58
+ ## Security
59
+
60
+ Report vulnerabilities in Penthera via [SECURITY.md](../SECURITY.md). Only scan systems you own or have authorization to test.