@pensar/apex 0.0.115-canary.3bd03ff8 → 0.0.115-canary.3dff7f8d

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 (45) hide show
  1. package/README.md +43 -0
  2. package/build/agent-8n4fh36j.js +17 -0
  3. package/build/{agent-z4ajdp3s.js → agent-t4r3pbb8.js} +15 -13
  4. package/build/{auth-g0mfaeem.js → auth-k056m637.js} +4 -4
  5. package/build/{authentication-abnqr8dq.js → authentication-ssk385g3.js} +22 -20
  6. package/build/blackboxAgent-181b9qak.js +18 -0
  7. package/build/blackboxPentest-mw112zdg.js +36 -0
  8. package/build/{cli-3tdnqq4n.js → cli-02b1whj6.js} +1 -1
  9. package/build/{cli-k7n1erh2.js → cli-2qa6mdgp.js} +4 -3
  10. package/build/{cli-jz1em323.js → cli-54e201hd.js} +214 -84
  11. package/build/{cli-xcq92gq3.js → cli-6bhe5b0c.js} +1 -1
  12. package/build/{cli-7jxmjptj.js → cli-8wy5b9jj.js} +5 -3
  13. package/build/{cli-n8r79tnh.js → cli-a8ba6n6t.js} +1 -1
  14. package/build/{cli-b5ntxjsa.js → cli-avwxy3m0.js} +1 -1
  15. package/build/{cli-a1a21ngj.js → cli-bnyw3j31.js} +209 -277
  16. package/build/{cli-n3vbmjds.js → cli-dmw59zrn.js} +22 -9
  17. package/build/{cli-a1skmp2k.js → cli-dxy76cm5.js} +1 -1
  18. package/build/{cli-z54mq5x2.js → cli-h6jcfm7a.js} +12 -32
  19. package/build/{cli-5r3exzsd.js → cli-j1asry8c.js} +3 -2
  20. package/build/cli-pkdjamer.js +100 -0
  21. package/build/{cli-217my1rx.js → cli-r8cerdwk.js} +24 -0
  22. package/build/{cli-qh2jv1be.js → cli-tqgz4vr1.js} +8001 -9032
  23. package/build/{cli-rsrfym9h.js → cli-y2sz3mcw.js} +9627 -1170
  24. package/build/{cli-k1q2rgqp.js → cli-y9mxmfcd.js} +244 -15
  25. package/build/cli.js +111 -54
  26. package/build/{fixes-japr7a9s.js → fixes-yk983h2t.js} +4 -4
  27. package/build/{index-vmccexkz.js → index-75897c3g.js} +2 -2
  28. package/build/{index-06av46he.js → index-nmjb4qyy.js} +2343 -1169
  29. package/build/{index-y97bt7f4.js → index-rn5js2k4.js} +10 -8
  30. package/build/{issues-std4g3eq.js → issues-z7ntcj5d.js} +4 -4
  31. package/build/{logs-p902qs1m.js → logs-wm2z2eer.js} +4 -4
  32. package/build/{main-2483qzbq.js → main-3d7dfdvs.js} +17 -90
  33. package/build/pentest-4vxzspwb.js +28 -0
  34. package/build/{pentests-kr1hgr5n.js → pentests-a389ar4x.js} +4 -4
  35. package/build/{projects-g82mqvcj.js → projects-byjv0w9m.js} +4 -4
  36. package/build/{targetedPentest-6wpedxs2.js → targetedPentest-yc65zb6t.js} +10 -9
  37. package/build/{threatModel-8yejmbh9.js → threatModel-dj6fpdf3.js} +17 -11
  38. package/build/{uninstall-bhzm12ym.js → uninstall-0hb46y31.js} +1 -1
  39. package/build/upload-7wtbr768.js +36 -0
  40. package/build/{utils-101g2kfx.js → utils-zvr7bcyw.js} +1 -1
  41. package/package.json +3 -2
  42. package/build/agent-7svf818d.js +0 -16
  43. package/build/blackboxAgent-bggt61y3.js +0 -17
  44. package/build/blackboxPentest-2cq8eys6.js +0 -45
  45. package/build/pentest-rh96z40d.js +0 -27
package/README.md CHANGED
@@ -54,6 +54,49 @@ Open the Apex TUI:
54
54
  pensar
55
55
  ```
56
56
 
57
+ ### Headless CLI
58
+
59
+ Run pentests without the TUI for scripting, CI, or evalgate integration:
60
+
61
+ ```bash
62
+ # Basic pentest
63
+ pensar pentest --target https://example.com
64
+
65
+ # With extended thinking and task-driven mode
66
+ pensar pentest --target https://example.com --extended-thinking --task-driven
67
+
68
+ # Whitebox (with source code access)
69
+ pensar pentest --target https://example.com --cwd ./my-app
70
+
71
+ # Targeted pentest with specific objectives
72
+ pensar targeted-pentest --target https://example.com --objective "Test authentication bypass"
73
+ ```
74
+
75
+ | Flag | Command | Description |
76
+ | ------------------------------ | ------------------------- | ---------------------------------------------- |
77
+ | `--target <url>` | pentest, targeted-pentest | Target URL (required) |
78
+ | `--cwd <path>` | pentest | Source code path for whitebox mode |
79
+ | `--mode <mode>` | pentest | `exfil` for pivoting and flag extraction |
80
+ | `--model <model>` | pentest, targeted-pentest | AI model (default: auto-selected) |
81
+ | `--extended-thinking` | pentest | Enable extended thinking for supported models |
82
+ | `--task-driven` | pentest | Enable task-driven architecture (experimental) |
83
+ | `--prompt <text\|@file>` | pentest | Custom guidance for the agent |
84
+ | `--threat-model <text\|@file>` | pentest | Threat model to guide testing |
85
+ | `--objective <text>` | targeted-pentest | Testing objective (repeatable) |
86
+
87
+ ### W&B Weave Tracing
88
+
89
+ Stream step-level agent traces to Weights & Biases Weave for analysis and fine-tuning:
90
+
91
+ ```bash
92
+ export WANDB_API_KEY=your-key
93
+ export WANDB_ENTITY=your-entity
94
+ # WANDB_PROJECT defaults to "apex-traces"
95
+ pensar pentest --target https://example.com
96
+ ```
97
+
98
+ Traces include reasoning steps, tool calls, token usage, and state checkpoints. When credentials are not set, tracing is silently disabled.
99
+
57
100
  ## Kali Linux Container (Optional)
58
101
 
59
102
  For **best performance**, run Apex in the included Kali Linux container with preconfigured pentest tools:
@@ -0,0 +1,17 @@
1
+ import {
2
+ CodeAgent
3
+ } from "./cli-8wy5b9jj.js";
4
+ import"./cli-y2sz3mcw.js";
5
+ import"./cli-avwxy3m0.js";
6
+ import"./cli-3y0dgy56.js";
7
+ import"./cli-tqgz4vr1.js";
8
+ import"./cli-r8cerdwk.js";
9
+ import"./cli-a8ba6n6t.js";
10
+ import"./cli-6bhe5b0c.js";
11
+ import"./cli-02b1whj6.js";
12
+ import"./cli-j1asry8c.js";
13
+ import"./cli-7ckctq7a.js";
14
+ import"./cli-8rxa073f.js";
15
+ export {
16
+ CodeAgent
17
+ };
@@ -1,19 +1,20 @@
1
1
  import {
2
2
  WhiteboxAttackSurfaceResultSchema
3
- } from "./cli-k7n1erh2.js";
3
+ } from "./cli-2qa6mdgp.js";
4
4
  import {
5
5
  OffensiveSecurityAgent
6
- } from "./cli-rsrfym9h.js";
7
- import"./cli-b5ntxjsa.js";
6
+ } from "./cli-y2sz3mcw.js";
7
+ import"./cli-avwxy3m0.js";
8
+ import"./cli-3y0dgy56.js";
8
9
  import {
9
10
  hasToolCall,
10
11
  tool
11
- } from "./cli-qh2jv1be.js";
12
- import"./cli-n8r79tnh.js";
13
- import"./cli-xcq92gq3.js";
14
- import"./cli-3tdnqq4n.js";
15
- import"./cli-5r3exzsd.js";
16
- import"./cli-217my1rx.js";
12
+ } from "./cli-tqgz4vr1.js";
13
+ import"./cli-r8cerdwk.js";
14
+ import"./cli-a8ba6n6t.js";
15
+ import"./cli-6bhe5b0c.js";
16
+ import"./cli-02b1whj6.js";
17
+ import"./cli-j1asry8c.js";
17
18
  import"./cli-7ckctq7a.js";
18
19
  import"./cli-8rxa073f.js";
19
20
 
@@ -46,8 +47,8 @@ Your primary search tool. Use it to find route definitions, middleware, controll
46
47
  - Each application/service you identify (appType: "web_application" or "api")
47
48
  - Notable subdomains hosting distinct services (appType: "subdomain")
48
49
  - Cloud resources like S3 buckets, cloud storage, CDN origins (appType: "cloud_resource" or "storage")
49
- - For S3 buckets: set url to the bucket endpoint (e.g. "https://bucket-name.s3.amazonaws.com") and use appType "storage"
50
- - For other cloud resources: set url to the resource endpoint and use appType "cloud_resource"
50
+ - For S3 buckets: set \`domain\` to the **canonical virtual-hosted-style** endpoint (e.g. "https://bucket-name.s3.amazonaws.com") and use appType "storage". Do NOT use path-style URLs (e.g. "https://s3.amazonaws.com/bucket-name").
51
+ - For other cloud resources: set \`domain\` to the primary/canonical resource endpoint and use appType "cloud_resource"
51
52
  - If known domains are provided, set the \`domain\` field to associate the app with the correct domain
52
53
 
53
54
  ## document_endpoint
@@ -85,7 +86,9 @@ Call this LAST with your complete structured results. This ends your run.
85
86
  - S3 buckets, GCS buckets, Azure Blob Storage (search for bucket names, s3://, storage URLs)
86
87
  - CDN distributions (CloudFront, Cloudflare)
87
88
  - Infrastructure-as-code definitions (Terraform, CloudFormation, CDK, SST, Pulumi, serverless.yml)
88
- - Document each as an app with appType "cloud_resource" or "storage" and set the url to the resource endpoint
89
+ - Document each as an app with appType "cloud_resource" or "storage" and set the \`domain\` to the **canonical** resource endpoint
90
+ - **S3 canonical URL:** Always use virtual-hosted-style "https://bucket-name.s3.amazonaws.com" (or with region: "https://bucket-name.s3.us-east-1.amazonaws.com"). Never use path-style "https://s3.amazonaws.com/bucket-name".
91
+ - **Do NOT document alternative URL formats** as separate endpoints — only document the canonical/primary URL and any distinct functional paths under it
89
92
 
90
93
  ## Phase 2: APP ANALYSIS (delegate to coding agents)
91
94
  For each app you identified, spawn a coding agent with a detailed objective. The objective should instruct the agent to:
@@ -101,7 +104,6 @@ For each app you identified, spawn a coding agent with a detailed objective. The
101
104
  - Source-code file in \`file\` (e.g., \`src/routes/users.ts\`) — this is NOT the route
102
105
  - Line number in \`line\`
103
106
  - Auth requirement in \`authRequired\`
104
- - Specific pentest objectives in \`pentestObjectives\`
105
107
 
106
108
  **IMPORTANT:** Tell each coding agent to set \`appName\` on every \`document_endpoint\` call so endpoints are organized by application.
107
109
 
@@ -8,14 +8,14 @@ import {
8
8
  pollWorkOSToken,
9
9
  selectWorkspace,
10
10
  startDeviceFlow
11
- } from "./cli-n8r79tnh.js";
11
+ } from "./cli-a8ba6n6t.js";
12
12
  import {
13
13
  config,
14
14
  getPensarApiUrl,
15
15
  getPensarConsoleUrl
16
- } from "./cli-xcq92gq3.js";
17
- import"./cli-3tdnqq4n.js";
18
- import"./cli-5r3exzsd.js";
16
+ } from "./cli-6bhe5b0c.js";
17
+ import"./cli-02b1whj6.js";
18
+ import"./cli-j1asry8c.js";
19
19
  import {
20
20
  __require
21
21
  } from "./cli-8rxa073f.js";
@@ -3,16 +3,17 @@ import {
3
3
  } from "./cli-6gtnyaqf.js";
4
4
  import {
5
5
  OffensiveSecurityAgent
6
- } from "./cli-rsrfym9h.js";
7
- import"./cli-b5ntxjsa.js";
6
+ } from "./cli-y2sz3mcw.js";
7
+ import"./cli-avwxy3m0.js";
8
+ import"./cli-3y0dgy56.js";
8
9
  import {
9
10
  hasToolCall
10
- } from "./cli-qh2jv1be.js";
11
- import"./cli-n8r79tnh.js";
12
- import"./cli-xcq92gq3.js";
13
- import"./cli-3tdnqq4n.js";
14
- import"./cli-5r3exzsd.js";
15
- import"./cli-217my1rx.js";
11
+ } from "./cli-tqgz4vr1.js";
12
+ import"./cli-r8cerdwk.js";
13
+ import"./cli-a8ba6n6t.js";
14
+ import"./cli-6bhe5b0c.js";
15
+ import"./cli-02b1whj6.js";
16
+ import"./cli-j1asry8c.js";
16
17
  import"./cli-7ckctq7a.js";
17
18
  import"./cli-8rxa073f.js";
18
19
 
@@ -86,13 +87,14 @@ Look for:
86
87
  ### Browser path (use for SPAs, OAuth, JS-rendered forms):
87
88
  1. \`browser_navigate\` to the login URL
88
89
  2. \`browser_snapshot\` to find form fields and their refs
89
- 3. \`browser_fill\` the username/email field (use ref from snapshot)
90
- 4. \`browser_snapshot\` again (page may update after input)
91
- 5. \`browser_fill\` the password field
92
- 6. \`browser_click\` the submit/login button
93
- 7. \`browser_snapshot\` or \`browser_screenshot\` to verify the result
94
- 8. \`browser_get_cookies\` to extract session cookies
95
- 9. Optionally \`browser_evaluate\` to extract tokens from localStorage/sessionStorage:
90
+ 3. \`browser_screenshot\` to capture the login page before filling credentials
91
+ 4. \`browser_fill\` the username/email field (use ref from snapshot)
92
+ 5. \`browser_snapshot\` again (page may update after input)
93
+ 6. \`browser_fill\` the password field
94
+ 7. \`browser_click\` the submit/login button
95
+ 8. \`browser_snapshot\` AND \`browser_screenshot\` to verify and document the post-submit state
96
+ 9. \`browser_get_cookies\` to extract session cookies
97
+ 10. Optionally \`browser_evaluate\` to extract tokens from localStorage/sessionStorage:
96
98
  \`\`\`javascript
97
99
  (() => {
98
100
  const tokens = {};
@@ -153,11 +155,11 @@ If you encounter rate-limiting errors (e.g. "Rate limit exceeded", HTTP 429, "to
153
155
 
154
156
  # Screenshot Evidence
155
157
 
156
- - Use \`browser_screenshot\` to capture the page state at key moments during authentication
157
- - **Always screenshot after login attempt** to document success (dashboard/welcome page) or failure (error message)
158
- - Screenshot any error pages, CAPTCHA challenges, MFA prompts, or unexpected barriers
159
- - Use descriptive filenames: "login-form", "auth-success", "auth-error", "mfa-prompt", "captcha-detected"
160
- - Screenshots are automatically stored and displayed in the console logs for debugging
158
+ - **Screenshot liberally.** A human reviews your run after it completes and relies on screenshots to follow along with what the browser actually did. Every time you navigate to a new page, fill a form field, click a button, or observe a state change, call \`browser_screenshot\` so the reviewer can see exactly what you saw. Aim for at least one screenshot per distinct page or state change — screenshots are cheap, missing visual context is not.
159
+ - **Always screenshot after login attempt** to document success (dashboard/welcome page) or failure (error message).
160
+ - Screenshot any error pages, CAPTCHA challenges, MFA prompts, or unexpected barriers.
161
+ - Use descriptive filenames: "login-form", "username-filled", "password-filled", "auth-success", "auth-error", "mfa-prompt", "captcha-detected".
162
+ - Screenshots are automatically stored and displayed in the console logs for debugging and human review.
161
163
  `;
162
164
 
163
165
  // src/core/agents/specialized/authenticationAgent/agent.ts
@@ -0,0 +1,18 @@
1
+ import {
2
+ BlackboxAttackSurfaceAgent
3
+ } from "./cli-h6jcfm7a.js";
4
+ import"./cli-6gtnyaqf.js";
5
+ import"./cli-y2sz3mcw.js";
6
+ import"./cli-avwxy3m0.js";
7
+ import"./cli-3y0dgy56.js";
8
+ import"./cli-tqgz4vr1.js";
9
+ import"./cli-r8cerdwk.js";
10
+ import"./cli-a8ba6n6t.js";
11
+ import"./cli-6bhe5b0c.js";
12
+ import"./cli-02b1whj6.js";
13
+ import"./cli-j1asry8c.js";
14
+ import"./cli-7ckctq7a.js";
15
+ import"./cli-8rxa073f.js";
16
+ export {
17
+ BlackboxAttackSurfaceAgent
18
+ };
@@ -0,0 +1,36 @@
1
+ import {
2
+ runPentestWorkflow
3
+ } from "./cli-bnyw3j31.js";
4
+ import"./cli-y9mxmfcd.js";
5
+ import"./cli-54e201hd.js";
6
+ import"./cli-h6jcfm7a.js";
7
+ import"./cli-fw5r7pfj.js";
8
+ import"./cli-8wy5b9jj.js";
9
+ import"./cli-6gtnyaqf.js";
10
+ import"./cli-2qa6mdgp.js";
11
+ import"./cli-y2sz3mcw.js";
12
+ import"./cli-avwxy3m0.js";
13
+ import"./cli-3y0dgy56.js";
14
+ import"./cli-tqgz4vr1.js";
15
+ import"./cli-r8cerdwk.js";
16
+ import"./cli-a8ba6n6t.js";
17
+ import"./cli-6bhe5b0c.js";
18
+ import"./cli-02b1whj6.js";
19
+ import"./cli-j1asry8c.js";
20
+ import"./cli-7ckctq7a.js";
21
+ import"./cli-8rxa073f.js";
22
+
23
+ // src/core/api/blackboxPentest.ts
24
+ async function runPentestAgent(input) {
25
+ const { findings, findingsPath, pocsPath, reportPath } = await runPentestWorkflow(input);
26
+ console.log(`
27
+ Found ${findings.length} vulnerabilities`);
28
+ console.log(`Findings: ${findingsPath}`);
29
+ console.log(`POCs: ${pocsPath}`);
30
+ if (reportPath)
31
+ console.log(`Report: ${reportPath}`);
32
+ return { findings, findingsPath, pocsPath, reportPath };
33
+ }
34
+ export {
35
+ runPentestAgent
36
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getCurrentVersion
3
- } from "./cli-5r3exzsd.js";
3
+ } from "./cli-j1asry8c.js";
4
4
 
5
5
  // src/core/config/config.ts
6
6
  import os from "os";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  exports_external,
3
3
  init_zod
4
- } from "./cli-qh2jv1be.js";
4
+ } from "./cli-tqgz4vr1.js";
5
5
 
6
6
  // src/core/agents/specialized/whiteboxAttackSurface/types.ts
7
7
  init_zod();
@@ -24,8 +24,9 @@ var EndpointSchema = exports_external.object({
24
24
  line: exports_external.number().optional().describe("Line number in the file"),
25
25
  authRequired: exports_external.boolean().optional().describe("Whether this endpoint appears to require authentication"),
26
26
  description: exports_external.string().optional().describe("Brief description of what this endpoint does"),
27
- pentestObjectives: exports_external.array(exports_external.string()).describe("Specific pentest objectives for this endpoint (e.g. 'Test for IDOR by enumerating user IDs', 'Test for SQL injection in search parameter')"),
28
- riskScore: RiskScoreSchema.optional().describe("AI-calculated risk score for prioritizing pentest efforts")
27
+ pentestObjectives: exports_external.array(exports_external.string()).default([]).describe("Pentest objectives for this endpoint, derived from the threat model when available " + "(e.g. 'Test for IDOR by enumerating user IDs', 'Test for SQL injection in search parameter')"),
28
+ riskScore: RiskScoreSchema.optional().describe("AI-calculated risk score for prioritizing pentest efforts"),
29
+ threatModel: exports_external.string().optional().describe("Endpoint-specific threat model describing attack vectors, data sensitivity, and testing priorities")
29
30
  });
30
31
  var AppSchema = exports_external.object({
31
32
  name: exports_external.string().describe("Application or service name"),