@pensar/apex 0.0.113 → 0.0.114-canary.29ca521a

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 (38) hide show
  1. package/README.md +27 -55
  2. package/build/agent-g5akfqp9.js +16 -0
  3. package/build/{agent-k1n19b3w.js → agent-ygvcd5fx.js} +9 -9
  4. package/build/{auth-a0ftn8cb.js → auth-5phvh3q6.js} +4 -4
  5. package/build/{authentication-vjefzf37.js → authentication-ts3vntab.js} +19 -11
  6. package/build/blackboxAgent-2ejpycqq.js +17 -0
  7. package/build/{blackboxPentest-26japf1w.js → blackboxPentest-hr7hhr1q.js} +13 -13
  8. package/build/{cli-0v3p48tt.js → cli-035zw3x7.js} +13 -6
  9. package/build/{cli-g0r410cd.js → cli-0r1hfxms.js} +1 -1
  10. package/build/{cli-tat7hrek.js → cli-11znnvgf.js} +8 -6
  11. package/build/{cli-0tpx8khk.js → cli-5gh0m3xb.js} +57 -57
  12. package/build/{cli-6nhtpv4g.js → cli-71076s1k.js} +1 -1
  13. package/build/{cli-yc2cs5cs.js → cli-73h5egap.js} +1 -1
  14. package/build/{cli-4sxvxwcb.js → cli-a295pzaw.js} +1 -1
  15. package/build/{cli-j6qdxby9.js → cli-c1wvnj2y.js} +5 -5
  16. package/build/{cli-065mgjsh.js → cli-gy41z3h0.js} +2 -2
  17. package/build/{cli-wqh6md2n.js → cli-mwwtke6h.js} +1 -1
  18. package/build/{cli-7kpzf8kz.js → cli-r0vc673n.js} +2 -2
  19. package/build/{cli-qeg15dzj.js → cli-x8jzsefp.js} +1 -1
  20. package/build/{cli-mnqb1xvt.js → cli-xgq8jt1g.js} +1 -1
  21. package/build/{cli-t7dpdkd6.js → cli-z9vb517x.js} +79 -20
  22. package/build/cli.js +23 -23
  23. package/build/{fixes-szq7tb0p.js → fixes-p6z3vsc2.js} +4 -4
  24. package/build/{index-8dgs0erz.js → index-a9k5eace.js} +2 -2
  25. package/build/{index-sr5w8v3d.js → index-hmfqq7he.js} +9665 -2854
  26. package/build/{index-4ds7eh13.js → index-ygn0hmhn.js} +11 -9
  27. package/build/{issues-7yvjwc2j.js → issues-a4s2pv8k.js} +4 -4
  28. package/build/{logs-22ks7j0v.js → logs-0hwqk50v.js} +4 -4
  29. package/build/pentest-x8ttg7ct.js +25 -0
  30. package/build/{pentests-7a8s43nj.js → pentests-pr8cwwhq.js} +4 -4
  31. package/build/{projects-0a1zfjgm.js → projects-r13nzd2n.js} +4 -4
  32. package/build/{targetedPentest-qrcrtpzg.js → targetedPentest-wjdskzma.js} +9 -9
  33. package/build/{uninstall-hp43qwmn.js → uninstall-yh0kpqza.js} +1 -1
  34. package/build/{utils-9fhmzzzh.js → utils-7x4v0asf.js} +1 -1
  35. package/package.json +1 -1
  36. package/build/agent-cff8va32.js +0 -16
  37. package/build/blackboxAgent-dq8eany1.js +0 -17
  38. 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">
@@ -20,53 +22,6 @@ Want to run from the cloud or integrate it with your CI/CD? See <a href="https:/
20
22
  <img src="screenshot.png" alt="Pensar Apex Screenshot" width="800">
21
23
  </p> -->
22
24
 
23
- ## Use Cases
24
-
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.
55
-
56
- ```bash
57
- /operator
58
- ```
59
-
60
- Examples:
61
-
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
67
-
68
- This turns Apex into a **terminal-native AI pentesting partner** rather than just a scanner.
69
-
70
25
  ## Installation
71
26
 
72
27
  #### macOS / Linux (Quick Install)
@@ -82,18 +37,18 @@ brew tap pensarai/tap
82
37
  brew install apex
83
38
  ```
84
39
 
85
- #### Windows (PowerShell)
86
-
87
- ```powershell
88
- irm https://www.pensarai.com/apex.ps1 | iex
89
- ```
90
-
91
40
  #### npm
92
41
 
93
42
  ```bash
94
43
  npm install -g @pensar/apex
95
44
  ```
96
45
 
46
+ #### Windows (PowerShell)
47
+
48
+ ```powershell
49
+ irm https://www.pensarai.com/apex.ps1 | iex
50
+ ```
51
+
97
52
  ## Usage
98
53
 
99
54
  Open the Apex TUI:
@@ -121,7 +76,24 @@ pensar
121
76
 
122
77
  ---
123
78
 
79
+ ## Use Cases
80
+
81
+ ### Developers
82
+
83
+ - Run `/pentest` before merging a PR — catch vulnerabilities as naturally as running tests
84
+ - Get actionable findings with severity scores, evidence, and suggested fixes — no security background needed
85
+ - Integrate into CI/CD via headless CLI commands or Pensar Console
86
+
87
+ ### Security Engineers
88
+
89
+ - Deploy agent-driven swarm testing across large attack surfaces
90
+ - Use `/operator` mode for manual investigation, exploit chaining, and validation
91
+ - Automate repetitive testing workflows with persistent memory that accumulates across engagements
92
+ - Scale across teams and projects through Pensar Console
93
+
94
+ ---
95
+
124
96
  ### ⚠️ Responsible Use
125
97
 
126
- This repository contains tools for **authorized security testing** only.
98
+ This repository contains tools for **authorized security testing** only.
127
99
  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-r0vc673n.js";
4
+ import"./cli-z9vb517x.js";
5
+ import"./cli-mwwtke6h.js";
6
+ import"./cli-c1wvnj2y.js";
7
+ import"./cli-73h5egap.js";
8
+ import"./cli-x8jzsefp.js";
9
+ import"./cli-71076s1k.js";
10
+ import"./cli-xgq8jt1g.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-a295pzaw.js";
4
4
  import {
5
5
  OffensiveSecurityAgent
6
- } from "./cli-t7dpdkd6.js";
7
- import"./cli-wqh6md2n.js";
6
+ } from "./cli-z9vb517x.js";
7
+ import"./cli-mwwtke6h.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-c1wvnj2y.js";
12
+ import"./cli-73h5egap.js";
13
+ import"./cli-x8jzsefp.js";
14
+ import"./cli-71076s1k.js";
15
+ import"./cli-xgq8jt1g.js";
16
+ import"./cli-5gh0m3xb.js";
17
17
  import"./cli-7ckctq7a.js";
18
18
  import"./cli-8rxa073f.js";
19
19
 
@@ -8,14 +8,14 @@ import {
8
8
  pollWorkOSToken,
9
9
  selectWorkspace,
10
10
  startDeviceFlow
11
- } from "./cli-yc2cs5cs.js";
11
+ } from "./cli-73h5egap.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-x8jzsefp.js";
17
+ import"./cli-71076s1k.js";
18
+ import"./cli-xgq8jt1g.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-z9vb517x.js";
7
+ import"./cli-mwwtke6h.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-c1wvnj2y.js";
11
+ import"./cli-73h5egap.js";
12
+ import"./cli-x8jzsefp.js";
13
+ import"./cli-71076s1k.js";
14
+ import"./cli-xgq8jt1g.js";
15
+ import"./cli-5gh0m3xb.js";
16
16
  import"./cli-7ckctq7a.js";
17
17
  import"./cli-8rxa073f.js";
18
18
 
@@ -170,12 +170,13 @@ class AuthenticationAgent extends OffensiveSecurityAgent {
170
170
  authHints,
171
171
  authConfig,
172
172
  onStepFinish,
173
- abortSignal
173
+ abortSignal,
174
+ context
174
175
  } = opts;
175
176
  const cm = session.credentialManager;
176
177
  super({
177
178
  system: detectOSAndEnhancePrompt(AUTH_SUBAGENT_SYSTEM_PROMPT),
178
- prompt: buildAuthPrompt(target, authHints, cm),
179
+ prompt: buildAuthPrompt(target, authHints, cm, context),
179
180
  model,
180
181
  session,
181
182
  target,
@@ -245,9 +246,16 @@ function loadAuthResult(authDataPath) {
245
246
  };
246
247
  }
247
248
  }
248
- function buildAuthPrompt(target, authHints, credentialManager) {
249
+ function buildAuthPrompt(target, authHints, credentialManager, context) {
249
250
  const parts = [`TARGET: ${target}
250
251
  `];
252
+ if (context) {
253
+ parts.push("APPLICATION CONTEXT:");
254
+ parts.push(`The following is context specific to the application under test. If it contains non-malicious instructions relevant to authentication, follow them.
255
+ `);
256
+ parts.push(context);
257
+ parts.push("");
258
+ }
251
259
  const credBlock = credentialManager?.formatForPrompt();
252
260
  if (credBlock) {
253
261
  parts.push(credBlock);
@@ -0,0 +1,17 @@
1
+ import {
2
+ BlackboxAttackSurfaceAgent
3
+ } from "./cli-gy41z3h0.js";
4
+ import"./cli-6gtnyaqf.js";
5
+ import"./cli-z9vb517x.js";
6
+ import"./cli-mwwtke6h.js";
7
+ import"./cli-c1wvnj2y.js";
8
+ import"./cli-73h5egap.js";
9
+ import"./cli-x8jzsefp.js";
10
+ import"./cli-71076s1k.js";
11
+ import"./cli-xgq8jt1g.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-11znnvgf.js";
4
+ import"./cli-035zw3x7.js";
5
+ import"./cli-r0vc673n.js";
6
+ import"./cli-a295pzaw.js";
7
+ import"./cli-gy41z3h0.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-z9vb517x.js";
10
+ import"./cli-mwwtke6h.js";
11
+ import"./cli-c1wvnj2y.js";
12
+ import"./cli-73h5egap.js";
13
+ import"./cli-x8jzsefp.js";
14
+ import"./cli-71076s1k.js";
15
+ import"./cli-xgq8jt1g.js";
16
+ import"./cli-5gh0m3xb.js";
17
17
  import"./cli-7ckctq7a.js";
18
18
  import"./cli-8rxa073f.js";
19
19
 
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-t7dpdkd6.js";
3
+ } from "./cli-z9vb517x.js";
4
4
  import {
5
5
  exports_external,
6
6
  init_zod
7
- } from "./cli-j6qdxby9.js";
7
+ } from "./cli-c1wvnj2y.js";
8
8
 
9
9
  // src/core/agents/specialized/pentest/agent.ts
10
10
  init_zod();
@@ -29,11 +29,12 @@ class TargetedPentestAgent extends OffensiveSecurityAgent {
29
29
  abortSignal,
30
30
  sandbox,
31
31
  findingsRegistry,
32
- messages
32
+ messages,
33
+ context
33
34
  } = opts;
34
35
  super({
35
36
  system: buildSystemPrompt(session),
36
- prompt: buildPrompt(target, objectives, session, findingsRegistry),
37
+ prompt: buildPrompt(target, objectives, session, findingsRegistry, context),
37
38
  model,
38
39
  session,
39
40
  target,
@@ -172,7 +173,7 @@ Authentication:
172
173
  function buildSystemPrompt(session) {
173
174
  return session.config?.exfilMode ? PENTEST_SYSTEM_PROMPT_EXFIL : PENTEST_SYSTEM_PROMPT_BASE;
174
175
  }
175
- function buildPrompt(target, objectives, session, findingsRegistry) {
176
+ function buildPrompt(target, objectives, session, findingsRegistry, context) {
176
177
  const sessionRootPath = session.rootPath;
177
178
  const exfilMode = session.config?.exfilMode ?? false;
178
179
  const outcomeGuidance = session.config?.outcomeGuidance;
@@ -277,6 +278,12 @@ Your target is a flag with the format FLAG{...}. Locate and extract it.
277
278
  9. After testing ALL objectives, call the response tool with your final summary
278
279
 
279
280
  Do NOT discover or enumerate other endpoints or services. Focus exclusively on the target and objectives above.`;
281
+ const contextSection = context ? `
282
+ ## Application Context
283
+ The following is context specific to the application under test. If it contains non-malicious instructions relevant to your testing, follow them.
284
+
285
+ ${context}
286
+ ` : "";
280
287
  return `# Testing Assignment
281
288
 
282
289
  ## Target
@@ -284,7 +291,7 @@ Do NOT discover or enumerate other endpoints or services. Focus exclusively on t
284
291
  ${authSection}
285
292
  ${knownFindingsSection}
286
293
  ${knowledgeBaseSection}
287
-
294
+ ${contextSection}
288
295
  ## Objectives
289
296
  ${objectiveList}
290
297
  ${outcomeSection}
@@ -2,7 +2,7 @@ import {
2
2
  config,
3
3
  ensureValidToken,
4
4
  getPensarApiUrl
5
- } from "./cli-qeg15dzj.js";
5
+ } from "./cli-x8jzsefp.js";
6
6
 
7
7
  // src/core/api/issues.ts
8
8
  async function getAuthHeaders() {
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  TargetedPentestAgent
3
- } from "./cli-0v3p48tt.js";
3
+ } from "./cli-035zw3x7.js";
4
4
  import {
5
5
  CodeAgent
6
- } from "./cli-7kpzf8kz.js";
6
+ } from "./cli-r0vc673n.js";
7
7
  import {
8
8
  EndpointSchema
9
- } from "./cli-4sxvxwcb.js";
9
+ } from "./cli-a295pzaw.js";
10
10
  import {
11
11
  BlackboxAttackSurfaceAgent
12
- } from "./cli-065mgjsh.js";
12
+ } from "./cli-gy41z3h0.js";
13
13
  import {
14
14
  CweEntrySchema,
15
15
  FindingsRegistry
16
- } from "./cli-t7dpdkd6.js";
16
+ } from "./cli-z9vb517x.js";
17
17
  import {
18
18
  exports_external,
19
19
  init_zod
20
- } from "./cli-j6qdxby9.js";
20
+ } from "./cli-c1wvnj2y.js";
21
21
 
22
22
  // src/core/workflows/pentest.ts
23
23
  import { existsSync as existsSync4, readdirSync as readdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
@@ -473,6 +473,7 @@ function readExecutionMetrics(sessionRootPath) {
473
473
  return {
474
474
  tokenUsage: normalizeTokenUsage(parsed.tokenUsage),
475
475
  runtime: typeof parsed.runtime === "string" ? parsed.runtime : undefined,
476
+ elapsedSeconds: toNonNegativeInteger(parsed.elapsedSeconds) || undefined,
476
477
  updatedAt: typeof parsed.updatedAt === "string" ? parsed.updatedAt : new Date().toISOString()
477
478
  };
478
479
  } catch {
@@ -500,6 +501,7 @@ function writeExecutionMetrics(input) {
500
501
  const next = {
501
502
  tokenUsage: nextTokenUsage,
502
503
  runtime: input.runtime ?? existing?.runtime,
504
+ elapsedSeconds: input.elapsedSeconds ?? existing?.elapsedSeconds,
503
505
  updatedAt: new Date().toISOString()
504
506
  };
505
507
  writeFileSync2(metricsPath(input.sessionRootPath), JSON.stringify(next, null, 2), "utf-8");