@pensar/apex 0.0.113 → 0.0.114-canary.1775f089

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 (40) hide show
  1. package/README.md +19 -67
  2. package/build/agent-52h91djs.js +16 -0
  3. package/build/{agent-k1n19b3w.js → agent-htp87jx5.js} +39 -47
  4. package/build/{auth-a0ftn8cb.js → auth-hap3w5dk.js} +4 -4
  5. package/build/{authentication-vjefzf37.js → authentication-dtz33a5x.js} +21 -11
  6. package/build/blackboxAgent-dqxkz2bc.js +17 -0
  7. package/build/{blackboxPentest-26japf1w.js → blackboxPentest-xaefbkew.js} +13 -13
  8. package/build/cli-2rkbzhvj.js +7524 -0
  9. package/build/{cli-g0r410cd.js → cli-3y7c3m8p.js} +1 -1
  10. package/build/{cli-t7dpdkd6.js → cli-4qzcxwfp.js} +809 -384
  11. package/build/{cli-yc2cs5cs.js → cli-5g381af1.js} +1 -1
  12. package/build/{cli-0tpx8khk.js → cli-5gh0m3xb.js} +57 -57
  13. package/build/{cli-7kpzf8kz.js → cli-8qzgz72f.js} +6 -3
  14. package/build/{cli-mnqb1xvt.js → cli-axr89j41.js} +1 -1
  15. package/build/{cli-0v3p48tt.js → cli-cjdheabf.js} +69 -31
  16. package/build/{cli-065mgjsh.js → cli-cndebjbk.js} +47 -26
  17. package/build/{cli-qeg15dzj.js → cli-ekexez12.js} +1 -1
  18. package/build/{cli-tat7hrek.js → cli-evz7x313.js} +230 -103
  19. package/build/{cli-j6qdxby9.js → cli-jtkmm7n7.js} +123 -15
  20. package/build/{cli-wqh6md2n.js → cli-wjnrr5gy.js} +5 -13
  21. package/build/{cli-6nhtpv4g.js → cli-ybsywgq3.js} +1 -1
  22. package/build/{cli-4sxvxwcb.js → cli-zyxdcp6e.js} +1 -1
  23. package/build/cli.js +69 -23
  24. package/build/{fixes-szq7tb0p.js → fixes-5ca7j1cs.js} +4 -4
  25. package/build/{index-4ds7eh13.js → index-884w6tcc.js} +14 -11
  26. package/build/{index-8dgs0erz.js → index-kx15cvth.js} +2 -2
  27. package/build/{index-sr5w8v3d.js → index-m184y9ky.js} +3823 -4350
  28. package/build/{issues-7yvjwc2j.js → issues-j7h8th79.js} +4 -4
  29. package/build/{logs-22ks7j0v.js → logs-39kexvjb.js} +4 -4
  30. package/build/pentest-m0pdyrqs.js +25 -0
  31. package/build/{pentests-7a8s43nj.js → pentests-n1g38exn.js} +4 -4
  32. package/build/{projects-0a1zfjgm.js → projects-fcw4vvy9.js} +4 -4
  33. package/build/{targetedPentest-qrcrtpzg.js → targetedPentest-69rprne5.js} +11 -11
  34. package/build/threatModel-1eptz128.js +59 -0
  35. package/build/{uninstall-hp43qwmn.js → uninstall-v42hfsag.js} +1 -1
  36. package/build/{utils-9fhmzzzh.js → utils-7x4v0asf.js} +1 -1
  37. package/package.json +1 -1
  38. package/build/agent-cff8va32.js +0 -16
  39. package/build/blackboxAgent-dq8eany1.js +0 -17
  40. package/build/pentest-agm6pqh1.js +0 -25
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  <h1 align="center">Pensar Apex</h1>
2
2
 
3
- <p align="center">AI-powered penetration testing using an AI agent to perform comprehensive blackbox and whitebox pentesting - directly in your terminal.
3
+ <p align="center">
4
+ AI-powered penetration testing using autonomous agents — directly in your terminal. Run blackbox and whitebox pentests that explore, reason, and surface real vulnerabilities.
5
+
4
6
  </p>
5
7
 
6
8
  <p align="center">
@@ -22,77 +24,27 @@ Want to run from the cloud or integrate it with your CI/CD? See <a href="https:/
22
24
 
23
25
  ## Use Cases
24
26
 
25
- Apex enables both developers and security professionals to run autonomous and assisted penetration testing directly from the terminal.
26
-
27
- ### Developers: Run a Pentest in Minutes
28
-
29
- Apex makes it easy for developers to run a real penetration test without needing deep offensive security expertise.
30
-
31
- Using the autonomous `/pentest` mode, Apex will perform reconnaissance, attack surface discovery, vulnerability testing, and exploitation attempts automatically.
32
-
33
- This allows teams to quickly identify security issues before they reach production.
34
-
35
- ```bash
36
- /pentest
37
- ```
38
-
39
- Examples:
40
-
41
- - Test a staging environment before deploying
42
- - Scan a newly launched domain or API
43
- - Run quick security checks during development
44
- - Identify exposed services or misconfigurations
45
-
46
- This is the **fastest way to get real pentesting coverage without becoming a security expert.**
47
-
48
- ---
49
-
50
- ### Security Engineers: Advanced Operator Workflows
51
-
52
- Security professionals can use Apex as an **agentic offensive security harness** that orchestrates tools and reasoning workflows.
53
-
54
- The `/operator` mode allows engineers to work interactively with the Offensive Security Agent, guiding investigations and chaining tools dynamically.
27
+ ### Developers
55
28
 
56
- ```bash
57
- /operator
58
- ```
59
-
60
- Examples:
29
+ - Run `/pentest` before merging a PR — catch vulnerabilities as naturally as running tests
30
+ - Get actionable findings with severity scores, evidence, and suggested fixes — no security background needed
31
+ - Integrate into CI/CD via headless CLI commands or Pensar Console
61
32
 
62
- - Deep investigation of suspicious endpoints
63
- - Manual exploitation of discovered vulnerabilities
64
- - Tool orchestration across recon and exploitation phases
65
- - Validation and reproduction of vulnerabilities
66
- - Open-source security research / testing
33
+ ### Security Engineers
67
34
 
68
- This turns Apex into a **terminal-native AI pentesting partner** rather than just a scanner.
35
+ - Deploy agent-driven swarm testing across large attack surfaces
36
+ - Use `/operator` mode for manual investigation, exploit chaining, and validation
37
+ - Automate repetitive testing workflows with persistent memory that accumulates across engagements
38
+ - Scale across teams and projects through Pensar Console
69
39
 
70
40
  ## Installation
71
41
 
72
- #### macOS / Linux (Quick Install)
73
-
74
- ```bash
75
- curl -fsSL https://pensarai.com/install.sh | bash
76
- ```
77
-
78
- #### Homebrew
79
-
80
- ```bash
81
- brew tap pensarai/tap
82
- brew install apex
83
- ```
84
-
85
- #### Windows (PowerShell)
86
-
87
- ```powershell
88
- irm https://www.pensarai.com/apex.ps1 | iex
89
- ```
90
-
91
- #### npm
92
-
93
- ```bash
94
- npm install -g @pensar/apex
95
- ```
42
+ | Method | Command |
43
+ | ------------------------------- | ---------------------------------------------------- |
44
+ | **Quick Install** (macOS/Linux) | `curl -fsSL https://pensarai.com/install.sh \| bash` |
45
+ | **Homebrew** | `brew tap pensarai/tap && brew install apex` |
46
+ | **npm** | `npm install -g @pensar/apex` |
47
+ | **Windows** (PowerShell) | `irm https://www.pensarai.com/apex.ps1 \| iex` |
96
48
 
97
49
  ## Usage
98
50
 
@@ -123,5 +75,5 @@ pensar
123
75
 
124
76
  ### ⚠️ Responsible Use
125
77
 
126
- This repository contains tools for **authorized security testing** only.
78
+ This repository contains tools for **authorized security testing** only.
127
79
  Before use, please read and agree to the [Responsible Use Disclosure](./RESPONSIBLE_USE.md).
@@ -0,0 +1,16 @@
1
+ import {
2
+ CodeAgent
3
+ } from "./cli-8qzgz72f.js";
4
+ import"./cli-4qzcxwfp.js";
5
+ import"./cli-wjnrr5gy.js";
6
+ import"./cli-jtkmm7n7.js";
7
+ import"./cli-5g381af1.js";
8
+ import"./cli-ekexez12.js";
9
+ import"./cli-ybsywgq3.js";
10
+ import"./cli-axr89j41.js";
11
+ import"./cli-5gh0m3xb.js";
12
+ import"./cli-7ckctq7a.js";
13
+ import"./cli-8rxa073f.js";
14
+ export {
15
+ CodeAgent
16
+ };
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  WhiteboxAttackSurfaceResultSchema
3
- } from "./cli-4sxvxwcb.js";
3
+ } from "./cli-zyxdcp6e.js";
4
4
  import {
5
5
  OffensiveSecurityAgent
6
- } from "./cli-t7dpdkd6.js";
7
- import"./cli-wqh6md2n.js";
6
+ } from "./cli-4qzcxwfp.js";
7
+ import"./cli-wjnrr5gy.js";
8
8
  import {
9
9
  hasToolCall,
10
10
  tool
11
- } from "./cli-j6qdxby9.js";
12
- import"./cli-yc2cs5cs.js";
13
- import"./cli-qeg15dzj.js";
14
- import"./cli-6nhtpv4g.js";
15
- import"./cli-mnqb1xvt.js";
16
- import"./cli-0tpx8khk.js";
11
+ } from "./cli-jtkmm7n7.js";
12
+ import"./cli-5g381af1.js";
13
+ import"./cli-ekexez12.js";
14
+ import"./cli-ybsywgq3.js";
15
+ import"./cli-axr89j41.js";
16
+ import"./cli-5gh0m3xb.js";
17
17
  import"./cli-7ckctq7a.js";
18
18
  import"./cli-8rxa073f.js";
19
19
 
@@ -41,16 +41,25 @@ Read config files, entry points, route definitions, etc.
41
41
  ## grep
42
42
  Your primary search tool. Use it to find route definitions, middleware, controllers, etc.
43
43
 
44
- ## document_asset
45
- **Use this to document every significant asset you discover.** Each call persists a JSON record to the session's assets directory. Document:
46
- - Each application/service you identify (assetType: "web_application" or "api")
47
- - Notable subdomains or infrastructure you encounter (assetType: "subdomain", "infrastructure_service")
48
- - Key API endpoint groups or admin panels (assetType: "endpoint", "admin_panel")
44
+ ## document_app
45
+ **Use this to document each application/service you identify.** Each call persists a JSON record to the session's apps directory. Document:
46
+ - Each application/service you identify (appType: "web_application" or "api")
47
+ - Notable subdomains hosting distinct services (appType: "subdomain")
49
48
 
50
- Call this throughout your analysis as you discover assets — don't wait until the end. Include relevant details like the technology stack, URL, authentication requirements, and risk level.
49
+ ## document_endpoint
50
+ **This is your primary output tool for endpoints.** Each call persists a JSON record to the session's endpoints directory, organized by app. Document:
51
+ - Individual API endpoints and web pages
52
+
53
+ **CRITICAL — endpoint documentation rules:**
54
+ - **ONE endpoint per unique route path.** Do NOT create separate entries for different HTTP methods on the same path. If \`/api/users\` supports GET, POST, and DELETE, that is ONE entry with \`method: ["GET", "POST", "DELETE"]\`.
55
+ - **Use \`method: "PAGE"\`** for web pages and views.
56
+ - **Always set \`appName\`** to group endpoints under the correct application.
57
+ - **Always set \`url\`** to the route path, \`file\` to the source file, \`handler\` to the function name, and \`authRequired\` to indicate auth requirements.
58
+
59
+ Call these tools throughout your analysis as you discover apps and endpoints — don't wait until the end.
51
60
 
52
61
  ## spawn_coding_agent
53
- **This is your key tool for scaling out analysis.** Spawn coding sub-agents to analyze individual apps in parallel for higher fidelity. Each sub-agent has full filesystem access (read_file, list_files, grep, execute_command).
62
+ **This is your key tool for scaling out analysis.** Spawn coding sub-agents to analyze individual apps in parallel for higher fidelity. Each sub-agent has full filesystem access (read_file, list_files, grep, execute_command) and the document_app/document_endpoint tools.
54
63
 
55
64
  ## submit_results
56
65
  Call this LAST with your complete structured results. This ends your run.
@@ -71,36 +80,18 @@ Call this LAST with your complete structured results. This ends your run.
71
80
  For each app you identified, spawn a coding agent with a detailed objective. The objective should instruct the agent to:
72
81
 
73
82
  1. **Identify the framework** — read the app's config/entry point to determine the web framework
74
- 2. **Find ALL web pages** — search for page/view/route definitions:
75
- - React/Next.js: pages/ or app/ directory, route components
76
- - Express: res.render(), res.sendFile(), static file serving
77
- - Django: urls.py patterns pointing to template views
78
- - Rails: routes.rb entries pointing to controller actions that render views
79
- - Vue/Nuxt: pages/ directory, router definitions
80
- - etc.
81
- 3. **Find ALL API endpoints** search for route/endpoint definitions:
82
- - Express: app.get(), app.post(), router.get(), router.post(), etc.
83
- - Next.js: app/api/ or pages/api/ route handlers
84
- - Django: urls.py patterns pointing to API views, DRF viewsets/routers
85
- - FastAPI: @app.get(), @app.post() decorators
86
- - Rails: routes.rb API namespaces, controller actions
87
- - Spring: @GetMapping, @PostMapping, @RequestMapping
88
- - etc.
89
- 4. **For each endpoint, determine**:
90
- - HTTP method and route path
91
- - Handler function/component name
92
- - File location and line number
93
- - Whether auth appears to be required (middleware, decorators, guards)
94
- - Brief description of what it does
95
- 5. **For each endpoint, generate pentest objectives** — specific, actionable testing goals like:
96
- - "Test for SQL injection in the 'search' query parameter"
97
- - "Test for IDOR by accessing /api/orders/{id} with other users' order IDs"
98
- - "Test for XSS in the user profile name field"
99
- - "Test for privilege escalation by accessing admin-only endpoint as regular user"
100
- - "Test for CSRF on the password change endpoint"
101
- - "Test for path traversal in the file download parameter"
102
-
103
- **IMPORTANT:** Tell each coding agent to output its findings in a STRUCTURED FORMAT that you can parse. Instruct it to use clear delimiters or a consistent format for each endpoint (method, path, handler, file, line, auth, description, pentest objectives).
83
+ 2. **Document the application** — call \`document_app\` with the app name, type, and framework
84
+ 3. **Find ALL web pages** search for page/view/route definitions and document each with \`document_endpoint\` using \`method: "PAGE"\`
85
+ 4. **Find ALL API endpoints** search for route/endpoint definitions and document each unique path with \`document_endpoint\`, listing ALL HTTP methods in \`method\`
86
+ 5. **For each endpoint, include** in the document_endpoint call:
87
+ - Route path in \`url\`
88
+ - ALL HTTP methods in \`method\` (consolidated — one entry per path)
89
+ - Handler function in \`handler\`
90
+ - Source file in \`file\` and line number in \`line\`
91
+ - Auth requirement in \`authRequired\`
92
+ - Specific pentest objectives in \`pentestObjectives\`
93
+
94
+ **IMPORTANT:** Tell each coding agent to set \`appName\` on every \`document_endpoint\` call so endpoints are organized by application.
104
95
 
105
96
  ## Phase 3: COLLECT AND SUBMIT (do this yourself)
106
97
  1. Parse the output from all coding agents
@@ -155,7 +146,8 @@ This ends the agent run — make sure all data is included.`,
155
146
  "read_file",
156
147
  "list_files",
157
148
  "grep",
158
- "document_asset",
149
+ "document_app",
150
+ "document_endpoint",
159
151
  "spawn_coding_agent",
160
152
  "submit_results"
161
153
  ],
@@ -8,14 +8,14 @@ import {
8
8
  pollWorkOSToken,
9
9
  selectWorkspace,
10
10
  startDeviceFlow
11
- } from "./cli-yc2cs5cs.js";
11
+ } from "./cli-5g381af1.js";
12
12
  import {
13
13
  config,
14
14
  getPensarApiUrl,
15
15
  getPensarConsoleUrl
16
- } from "./cli-qeg15dzj.js";
17
- import"./cli-6nhtpv4g.js";
18
- import"./cli-mnqb1xvt.js";
16
+ } from "./cli-ekexez12.js";
17
+ import"./cli-ybsywgq3.js";
18
+ import"./cli-axr89j41.js";
19
19
  import {
20
20
  __require
21
21
  } from "./cli-8rxa073f.js";
@@ -3,16 +3,16 @@ import {
3
3
  } from "./cli-6gtnyaqf.js";
4
4
  import {
5
5
  OffensiveSecurityAgent
6
- } from "./cli-t7dpdkd6.js";
7
- import"./cli-wqh6md2n.js";
6
+ } from "./cli-4qzcxwfp.js";
7
+ import"./cli-wjnrr5gy.js";
8
8
  import {
9
9
  hasToolCall
10
- } from "./cli-j6qdxby9.js";
11
- import"./cli-yc2cs5cs.js";
12
- import"./cli-qeg15dzj.js";
13
- import"./cli-6nhtpv4g.js";
14
- import"./cli-mnqb1xvt.js";
15
- import"./cli-0tpx8khk.js";
10
+ } from "./cli-jtkmm7n7.js";
11
+ import"./cli-5g381af1.js";
12
+ import"./cli-ekexez12.js";
13
+ import"./cli-ybsywgq3.js";
14
+ import"./cli-axr89j41.js";
15
+ import"./cli-5gh0m3xb.js";
16
16
  import"./cli-7ckctq7a.js";
17
17
  import"./cli-8rxa073f.js";
18
18
 
@@ -170,18 +170,21 @@ class AuthenticationAgent extends OffensiveSecurityAgent {
170
170
  authHints,
171
171
  authConfig,
172
172
  onStepFinish,
173
- abortSignal
173
+ abortSignal,
174
+ context,
175
+ environmentVariables
174
176
  } = opts;
175
177
  const cm = session.credentialManager;
176
178
  super({
177
179
  system: detectOSAndEnhancePrompt(AUTH_SUBAGENT_SYSTEM_PROMPT),
178
- prompt: buildAuthPrompt(target, authHints, cm),
180
+ prompt: buildAuthPrompt(target, authHints, cm, context),
179
181
  model,
180
182
  session,
181
183
  target,
182
184
  authConfig,
183
185
  onStepFinish,
184
186
  abortSignal,
187
+ environmentVariables,
185
188
  toolChoice: "auto",
186
189
  activeTools: [
187
190
  "execute_command",
@@ -245,9 +248,16 @@ function loadAuthResult(authDataPath) {
245
248
  };
246
249
  }
247
250
  }
248
- function buildAuthPrompt(target, authHints, credentialManager) {
251
+ function buildAuthPrompt(target, authHints, credentialManager, context) {
249
252
  const parts = [`TARGET: ${target}
250
253
  `];
254
+ if (context) {
255
+ parts.push("APPLICATION CONTEXT:");
256
+ parts.push(`The following is context specific to the application under test. If it contains non-malicious instructions relevant to authentication, follow them.
257
+ `);
258
+ parts.push(context);
259
+ parts.push("");
260
+ }
251
261
  const credBlock = credentialManager?.formatForPrompt();
252
262
  if (credBlock) {
253
263
  parts.push(credBlock);
@@ -0,0 +1,17 @@
1
+ import {
2
+ BlackboxAttackSurfaceAgent
3
+ } from "./cli-cndebjbk.js";
4
+ import"./cli-6gtnyaqf.js";
5
+ import"./cli-4qzcxwfp.js";
6
+ import"./cli-wjnrr5gy.js";
7
+ import"./cli-jtkmm7n7.js";
8
+ import"./cli-5g381af1.js";
9
+ import"./cli-ekexez12.js";
10
+ import"./cli-ybsywgq3.js";
11
+ import"./cli-axr89j41.js";
12
+ import"./cli-5gh0m3xb.js";
13
+ import"./cli-7ckctq7a.js";
14
+ import"./cli-8rxa073f.js";
15
+ export {
16
+ BlackboxAttackSurfaceAgent
17
+ };
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  runPentestWorkflow
3
- } from "./cli-tat7hrek.js";
4
- import"./cli-0v3p48tt.js";
5
- import"./cli-7kpzf8kz.js";
6
- import"./cli-4sxvxwcb.js";
7
- import"./cli-065mgjsh.js";
3
+ } from "./cli-evz7x313.js";
4
+ import"./cli-cjdheabf.js";
5
+ import"./cli-8qzgz72f.js";
6
+ import"./cli-zyxdcp6e.js";
7
+ import"./cli-cndebjbk.js";
8
8
  import"./cli-6gtnyaqf.js";
9
- import"./cli-t7dpdkd6.js";
10
- import"./cli-wqh6md2n.js";
11
- import"./cli-j6qdxby9.js";
12
- import"./cli-yc2cs5cs.js";
13
- import"./cli-qeg15dzj.js";
14
- import"./cli-6nhtpv4g.js";
15
- import"./cli-mnqb1xvt.js";
16
- import"./cli-0tpx8khk.js";
9
+ import"./cli-4qzcxwfp.js";
10
+ import"./cli-wjnrr5gy.js";
11
+ import"./cli-jtkmm7n7.js";
12
+ import"./cli-5g381af1.js";
13
+ import"./cli-ekexez12.js";
14
+ import"./cli-ybsywgq3.js";
15
+ import"./cli-axr89j41.js";
16
+ import"./cli-5gh0m3xb.js";
17
17
  import"./cli-7ckctq7a.js";
18
18
  import"./cli-8rxa073f.js";
19
19