@pensar/apex 2.4.0 → 2.5.0-canary.2bbb0f6f

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 (68) hide show
  1. package/build/agent-20hb6mg7.js +20 -0
  2. package/build/{agent-5ejt5vpz.js → agent-71sn1cjn.js} +9 -8
  3. package/build/{agent-nhs1w5w0.js → agent-xnrz4bhp.js} +11 -10
  4. package/build/{apps-17wvz1d7.js → apps-ghf7kp1s.js} +72 -31
  5. package/build/{auth-z3h9859n.js → auth-p1nrv7re.js} +25 -20
  6. package/build/authentication-m1vj2f0s.js +20 -0
  7. package/build/blackboxAgent-hjfzgk93.js +20 -0
  8. package/build/blackboxPentest-9snp9gvp.js +70 -0
  9. package/build/{cli-0n4r54hq.js → cli-08fcc6d8.js} +1 -1
  10. package/build/{cli-gq40s5b3.js → cli-14j00zfh.js} +5 -3
  11. package/build/{cli-vnynf0js.js → cli-3bmqdcfh.js} +10 -4
  12. package/build/{cli-mavved45.js → cli-3ew5fs3f.js} +46 -25
  13. package/build/{cli-xshasbwe.js → cli-4mgj070h.js} +30 -4
  14. package/build/{cli-repbyhkk.js → cli-4vwnsyep.js} +1141 -525
  15. package/build/cli-53rm0rrz.js +15 -0
  16. package/build/cli-68260ckj.js +12136 -0
  17. package/build/cli-7q3ae3ft.js +6 -0
  18. package/build/{cli-5k33webc.js → cli-7sqb16dd.js} +45 -43
  19. package/build/{cli-9rhzhgx2.js → cli-8pk8znhw.js} +1 -1
  20. package/build/cli-9pbk8m32.js +32 -0
  21. package/build/{cli-72cvcqhg.js → cli-9ya3yktn.js} +1 -1
  22. package/build/{cli-vq52kp7j.js → cli-a8n64cef.js} +23 -5
  23. package/build/{cli-qqt4gj1w.js → cli-a9vq54sx.js} +5 -3
  24. package/build/{cli-swpbx60z.js → cli-avmhkjtv.js} +1 -1481
  25. package/build/{cli-tkc598ey.js → cli-f47dgye3.js} +411 -280
  26. package/build/{cli-k8kc47pq.js → cli-fw7sp0fp.js} +3 -3
  27. package/build/{cli-32z0017y.js → cli-g3cb8pj5.js} +2 -2
  28. package/build/{cli-tznv8pf1.js → cli-gbch9xmy.js} +1 -1
  29. package/build/cli-knd276ed.js +1485 -0
  30. package/build/{cli-2cbwdk78.js → cli-t7rhyqx5.js} +1 -1
  31. package/build/{cli-b1adytsy.js → cli-yge44bmk.js} +28 -5
  32. package/build/cli.js +641 -95
  33. package/build/{config-f1mj4nhd.js → config-cqw98n5y.js} +18 -15
  34. package/build/{doctor-ekneewa3.js → doctor-vzh1wmfa.js} +8 -7
  35. package/build/{fastStrike-8zka43xs.js → fastStrike-f441e9nr.js} +13 -10
  36. package/build/{fixes-b89s5haw.js → fixes-xxz52cf2.js} +25 -20
  37. package/build/getMachineId-bsd-xj3bn2fv.js +36 -0
  38. package/build/getMachineId-darwin-07jzjcx6.js +36 -0
  39. package/build/getMachineId-linux-ahngynxd.js +29 -0
  40. package/build/getMachineId-unsupported-vy43b44z.js +19 -0
  41. package/build/getMachineId-win-8x66cynz.js +38 -0
  42. package/build/{index-ghwf5z3v.js → index-23jj0234.js} +3 -3
  43. package/build/{index-6d22pyxt.js → index-3gavwzay.js} +1756 -1213
  44. package/build/{index-4ad3sdwk.js → index-4v5jc2td.js} +4 -4
  45. package/build/{index-mtq7kmxz.js → index-5wh7gq37.js} +4 -2
  46. package/build/{index-sf16jm0m.js → index-e7kq5rrd.js} +9 -7
  47. package/build/{index-rbzhk712.js → index-fxx38nc9.js} +11 -10
  48. package/build/{index-hqjdg6fg.js → index-j3dc7dks.js} +17 -9
  49. package/build/{index-y5w6n3tb.js → index-yc1dnj3n.js} +2 -2
  50. package/build/{issues-xx5bs4md.js → issues-zdag9ayw.js} +82 -26
  51. package/build/{logs-qtxe51w2.js → logs-f492cjgt.js} +25 -20
  52. package/build/{offesecAgent-b9e2xm6v.js → offesecAgent-pr0cmrqb.js} +10 -9
  53. package/build/pentest-1g3fzah5.js +30 -0
  54. package/build/{pentests-6ks3szc4.js → pentests-vstpzh9j.js} +26 -21
  55. package/build/{targetedPentest-s1ptvq8e.js → targetedPentest-wj3ae355.js} +11 -10
  56. package/build/{targets-sxygyj87.js → targets-806zxf1n.js} +27 -22
  57. package/build/threatModel-dc4jbhkf.js +29 -0
  58. package/build/{uninstall-tvsh81v8.js → uninstall-58ak2e2v.js} +6 -3
  59. package/build/{upload-7wdyyqmr.js → upload-kkktzh83.js} +8 -7
  60. package/build/{utils-7fwdkqk6.js → utils-1sawtwbj.js} +7 -6
  61. package/package.json +8 -2
  62. package/build/agent-mvpgvgks.js +0 -19
  63. package/build/authentication-3s97cpk4.js +0 -19
  64. package/build/blackboxAgent-gw0a1ca4.js +0 -19
  65. package/build/blackboxPentest-44333zss.js +0 -37
  66. package/build/main-mmjp338j.js +0 -324
  67. package/build/pentest-xtc1sjdw.js +0 -29
  68. package/build/threatModel-xsm6fwk5.js +0 -27
@@ -1,29 +1,34 @@
1
1
  #!/usr/bin/env bun
2
+ import {
3
+ markCommandFailed
4
+ } from "./cli-7q3ae3ft.js";
2
5
  import {
3
6
  listPentestTargets,
4
7
  listTargetLogs,
5
8
  searchTargetLogs
6
- } from "./cli-vq52kp7j.js";
7
- import"./cli-5k33webc.js";
8
- import"./cli-gq40s5b3.js";
9
- import"./cli-b1adytsy.js";
10
- import"./cli-mavved45.js";
11
- import"./cli-xshasbwe.js";
12
- import"./cli-32z0017y.js";
13
- import"./cli-k8kc47pq.js";
9
+ } from "./cli-a8n64cef.js";
10
+ import"./cli-9pbk8m32.js";
11
+ import"./cli-7sqb16dd.js";
12
+ import"./cli-fw7sp0fp.js";
13
+ import"./cli-14j00zfh.js";
14
+ import"./cli-3ew5fs3f.js";
15
+ import"./cli-yge44bmk.js";
16
+ import"./cli-4mgj070h.js";
17
+ import"./cli-g3cb8pj5.js";
14
18
  import"./cli-9fsre5pt.js";
15
- import"./cli-qqt4gj1w.js";
16
- import"./cli-repbyhkk.js";
17
- import"./cli-tznv8pf1.js";
19
+ import"./cli-a9vq54sx.js";
20
+ import"./cli-4vwnsyep.js";
21
+ import"./cli-gbch9xmy.js";
18
22
  import"./cli-fw5r7pfj.js";
19
23
  import"./cli-c8131c4q.js";
20
- import"./cli-tkc598ey.js";
21
- import"./cli-0n4r54hq.js";
22
- import"./cli-swpbx60z.js";
24
+ import"./cli-f47dgye3.js";
25
+ import"./cli-08fcc6d8.js";
26
+ import"./cli-avmhkjtv.js";
23
27
  import"./cli-j54qa6tm.js";
24
- import"./cli-72cvcqhg.js";
25
- import"./cli-9rhzhgx2.js";
26
- import"./cli-vnynf0js.js";
28
+ import"./cli-9ya3yktn.js";
29
+ import"./cli-8pk8znhw.js";
30
+ import"./cli-3bmqdcfh.js";
31
+ import"./cli-knd276ed.js";
27
32
  import"./cli-bc05qbss.js";
28
33
 
29
34
  // src/cli/targets.ts
@@ -70,7 +75,7 @@ async function main() {
70
75
  if (!targetId) {
71
76
  console.error("Error: target ID is required");
72
77
  console.error("Usage: pensar targets logs <targetId> [--level <level>] [--role <role>] [--limit <n>]");
73
- process.exit(1);
78
+ return markCommandFailed();
74
79
  }
75
80
  const level = getFlag("--level", args);
76
81
  const role = getFlag("--role", args);
@@ -84,7 +89,7 @@ async function main() {
84
89
  if (!targetId || !query) {
85
90
  console.error("Error: target ID and query are required");
86
91
  console.error("Usage: pensar targets search <targetId> <query> [--level <level>] [--role <role>] [--context <n>]");
87
- process.exit(1);
92
+ return markCommandFailed();
88
93
  }
89
94
  const level = getFlag("--level", args);
90
95
  const role = getFlag("--role", args);
@@ -99,7 +104,7 @@ async function main() {
99
104
  } else if (sub.startsWith("--")) {
100
105
  console.error("Error: pentest ID is required");
101
106
  console.error("Usage: pensar targets <pentestId>");
102
- process.exit(1);
107
+ return markCommandFailed();
103
108
  } else {
104
109
  const pentestId = sub;
105
110
  const targets = await listPentestTargets(pentestId);
@@ -108,7 +113,7 @@ async function main() {
108
113
  } catch (err) {
109
114
  console.error(`
110
115
  Error: ${err instanceof Error ? err.message : String(err)}`);
111
- process.exit(1);
116
+ return markCommandFailed();
112
117
  }
113
118
  }
114
- main();
119
+ await main();
@@ -0,0 +1,29 @@
1
+ import {
2
+ runThreatModelWorkflow
3
+ } from "./cli-a8n64cef.js";
4
+ import"./cli-9pbk8m32.js";
5
+ import"./cli-7sqb16dd.js";
6
+ import"./cli-fw7sp0fp.js";
7
+ import"./cli-14j00zfh.js";
8
+ import"./cli-3ew5fs3f.js";
9
+ import"./cli-yge44bmk.js";
10
+ import"./cli-4mgj070h.js";
11
+ import"./cli-g3cb8pj5.js";
12
+ import"./cli-9fsre5pt.js";
13
+ import"./cli-a9vq54sx.js";
14
+ import"./cli-4vwnsyep.js";
15
+ import"./cli-gbch9xmy.js";
16
+ import"./cli-fw5r7pfj.js";
17
+ import"./cli-c8131c4q.js";
18
+ import"./cli-f47dgye3.js";
19
+ import"./cli-08fcc6d8.js";
20
+ import"./cli-avmhkjtv.js";
21
+ import"./cli-j54qa6tm.js";
22
+ import"./cli-9ya3yktn.js";
23
+ import"./cli-8pk8znhw.js";
24
+ import"./cli-3bmqdcfh.js";
25
+ import"./cli-knd276ed.js";
26
+ import"./cli-bc05qbss.js";
27
+ export {
28
+ runThreatModelWorkflow
29
+ };
@@ -1,8 +1,11 @@
1
1
  #!/usr/bin/env bun
2
+ import {
3
+ markCommandFailed
4
+ } from "./cli-7q3ae3ft.js";
2
5
  import {
3
6
  detectInstallMethod,
4
7
  init_installation
5
- } from "./cli-vnynf0js.js";
8
+ } from "./cli-3bmqdcfh.js";
6
9
  import {
7
10
  __require
8
11
  } from "./cli-bc05qbss.js";
@@ -227,7 +230,7 @@ async function main() {
227
230
  } catch (err) {
228
231
  console.error(`
229
232
  Error: ${err instanceof Error ? err.message : String(err)}`);
230
- process.exit(1);
233
+ return markCommandFailed();
231
234
  }
232
235
  }
233
- main();
236
+ await main();
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  createWeaveTracer,
3
3
  resolveConfig
4
- } from "./cli-2cbwdk78.js";
5
- import"./cli-tkc598ey.js";
6
- import"./cli-0n4r54hq.js";
7
- import"./cli-swpbx60z.js";
4
+ } from "./cli-t7rhyqx5.js";
5
+ import"./cli-f47dgye3.js";
6
+ import"./cli-08fcc6d8.js";
7
+ import"./cli-avmhkjtv.js";
8
8
  import"./cli-j54qa6tm.js";
9
- import"./cli-72cvcqhg.js";
10
- import"./cli-9rhzhgx2.js";
11
- import"./cli-vnynf0js.js";
9
+ import"./cli-9ya3yktn.js";
10
+ import"./cli-8pk8znhw.js";
11
+ import"./cli-3bmqdcfh.js";
12
+ import"./cli-knd276ed.js";
12
13
  import"./cli-bc05qbss.js";
13
14
 
14
15
  // src/core/integrations/wandb/upload.ts
@@ -5,13 +5,14 @@ import {
5
5
  import {
6
6
  AVAILABLE_MODELS,
7
7
  init_ai
8
- } from "./cli-tkc598ey.js";
9
- import"./cli-0n4r54hq.js";
10
- import"./cli-swpbx60z.js";
8
+ } from "./cli-f47dgye3.js";
9
+ import"./cli-08fcc6d8.js";
10
+ import"./cli-avmhkjtv.js";
11
11
  import"./cli-j54qa6tm.js";
12
- import"./cli-72cvcqhg.js";
13
- import"./cli-9rhzhgx2.js";
14
- import"./cli-vnynf0js.js";
12
+ import"./cli-9ya3yktn.js";
13
+ import"./cli-8pk8znhw.js";
14
+ import"./cli-3bmqdcfh.js";
15
+ import"./cli-knd276ed.js";
15
16
  import"./cli-bc05qbss.js";
16
17
 
17
18
  // src/core/providers/utils.ts
package/package.json CHANGED
@@ -16,6 +16,10 @@
16
16
  "@modelcontextprotocol/sdk": "^1.29.0",
17
17
  "@openrouter/ai-sdk-provider": "^2.9.1",
18
18
  "@opentelemetry/api": "^1.9.1",
19
+ "@opentelemetry/exporter-trace-otlp-http": "^0.221.0",
20
+ "@opentelemetry/otlp-exporter-base": "^0.221.0",
21
+ "@opentelemetry/otlp-transformer": "^0.221.0",
22
+ "@opentelemetry/resources": "^2.10.0",
19
23
  "@opentui/core": "^0.1.107",
20
24
  "@opentui/react": "^0.1.107",
21
25
  "@pensar/surface": "0.3.0",
@@ -39,6 +43,8 @@
39
43
  "description": "AI-powered penetration testing CLI tool with terminal UI",
40
44
  "devDependencies": {
41
45
  "@biomejs/biome": "2.4.14",
46
+ "@opentelemetry/context-async-hooks": "^2.10.0",
47
+ "@opentelemetry/sdk-trace-base": "^2.10.0",
42
48
  "@types/bun": "^1.3.14",
43
49
  "@types/mailparser": "^3.4.6",
44
50
  "@types/mime-types": "^3.0.1",
@@ -85,7 +91,7 @@
85
91
  "url": "https://github.com/pensarai/apex.git"
86
92
  },
87
93
  "scripts": {
88
- "build": "bun build src/cli.ts --outdir build --target node --format esm --splitting --external @opentui/core --external @opentui/react --external @opentui/react/* --external react --external react/jsx-runtime --external react/jsx-dev-runtime --external react-reconciler --external weave --external electron --external chromium-bidi --external camoufox-js",
94
+ "build": "rm -rf build && bun build src/cli.ts --outdir build --target node --format esm --splitting --external @opentui/core --external @opentui/react --external @opentui/react/* --external react --external react/jsx-runtime --external react/jsx-dev-runtime --external react-reconciler --external weave --external electron --external chromium-bidi --external camoufox-js",
89
95
  "build:binaries": "bun run generate:ascii && mkdir -p dist && bun run build:binary:macos-arm64 && bun run build:binary:macos-x64 && bun run build:binary:linux-x64 && bun run build:binary:linux-arm64",
90
96
  "build:binary": "bun run generate:ascii && bun build src/cli.ts --compile --external electron --external chromium-bidi --external camoufox-js --outfile pensar",
91
97
  "build:binary:linux-arm64": "bun build src/cli.ts --compile --external electron --external chromium-bidi --external camoufox-js --target=bun-linux-arm64 --outfile dist/pensar-linux-arm64",
@@ -113,5 +119,5 @@
113
119
  "tsc": "tsc --noEmit"
114
120
  },
115
121
  "type": "module",
116
- "version": "2.4.0"
122
+ "version": "2.5.0-canary.2bbb0f6f"
117
123
  }
@@ -1,19 +0,0 @@
1
- import {
2
- CodeAgent
3
- } from "./cli-32z0017y.js";
4
- import"./cli-9fsre5pt.js";
5
- import"./cli-qqt4gj1w.js";
6
- import"./cli-repbyhkk.js";
7
- import"./cli-tznv8pf1.js";
8
- import"./cli-c8131c4q.js";
9
- import"./cli-tkc598ey.js";
10
- import"./cli-0n4r54hq.js";
11
- import"./cli-swpbx60z.js";
12
- import"./cli-j54qa6tm.js";
13
- import"./cli-72cvcqhg.js";
14
- import"./cli-9rhzhgx2.js";
15
- import"./cli-vnynf0js.js";
16
- import"./cli-bc05qbss.js";
17
- export {
18
- CodeAgent
19
- };
@@ -1,19 +0,0 @@
1
- import {
2
- runAuthenticationAgent
3
- } from "./cli-xshasbwe.js";
4
- import"./cli-9fsre5pt.js";
5
- import"./cli-qqt4gj1w.js";
6
- import"./cli-repbyhkk.js";
7
- import"./cli-tznv8pf1.js";
8
- import"./cli-c8131c4q.js";
9
- import"./cli-tkc598ey.js";
10
- import"./cli-0n4r54hq.js";
11
- import"./cli-swpbx60z.js";
12
- import"./cli-j54qa6tm.js";
13
- import"./cli-72cvcqhg.js";
14
- import"./cli-9rhzhgx2.js";
15
- import"./cli-vnynf0js.js";
16
- import"./cli-bc05qbss.js";
17
- export {
18
- runAuthenticationAgent
19
- };
@@ -1,19 +0,0 @@
1
- import {
2
- BlackboxAttackSurfaceAgent
3
- } from "./cli-gq40s5b3.js";
4
- import"./cli-9fsre5pt.js";
5
- import"./cli-qqt4gj1w.js";
6
- import"./cli-repbyhkk.js";
7
- import"./cli-tznv8pf1.js";
8
- import"./cli-c8131c4q.js";
9
- import"./cli-tkc598ey.js";
10
- import"./cli-0n4r54hq.js";
11
- import"./cli-swpbx60z.js";
12
- import"./cli-j54qa6tm.js";
13
- import"./cli-72cvcqhg.js";
14
- import"./cli-9rhzhgx2.js";
15
- import"./cli-vnynf0js.js";
16
- import"./cli-bc05qbss.js";
17
- export {
18
- BlackboxAttackSurfaceAgent
19
- };
@@ -1,37 +0,0 @@
1
- import {
2
- runPentestWorkflow
3
- } from "./cli-5k33webc.js";
4
- import"./cli-gq40s5b3.js";
5
- import"./cli-b1adytsy.js";
6
- import"./cli-mavved45.js";
7
- import"./cli-32z0017y.js";
8
- import"./cli-k8kc47pq.js";
9
- import"./cli-9fsre5pt.js";
10
- import"./cli-qqt4gj1w.js";
11
- import"./cli-repbyhkk.js";
12
- import"./cli-tznv8pf1.js";
13
- import"./cli-fw5r7pfj.js";
14
- import"./cli-c8131c4q.js";
15
- import"./cli-tkc598ey.js";
16
- import"./cli-0n4r54hq.js";
17
- import"./cli-swpbx60z.js";
18
- import"./cli-j54qa6tm.js";
19
- import"./cli-72cvcqhg.js";
20
- import"./cli-9rhzhgx2.js";
21
- import"./cli-vnynf0js.js";
22
- import"./cli-bc05qbss.js";
23
-
24
- // src/core/api/blackboxPentest.ts
25
- async function runPentestAgent(input) {
26
- const { findings, findingsPath, pocsPath, reportPath } = await runPentestWorkflow(input);
27
- console.log(`
28
- Found ${findings.length} vulnerabilities`);
29
- console.log(`Findings: ${findingsPath}`);
30
- console.log(`POCs: ${pocsPath}`);
31
- if (reportPath)
32
- console.log(`Report: ${reportPath}`);
33
- return { findings, findingsPath, pocsPath, reportPath };
34
- }
35
- export {
36
- runPentestAgent
37
- };
@@ -1,324 +0,0 @@
1
- import {
2
- __commonJS,
3
- __require
4
- } from "./cli-bc05qbss.js";
5
-
6
- // node_modules/dotenv/lib/main.js
7
- var require_main = __commonJS(function(exports, module) {
8
- var fs = __require("fs");
9
- var path = __require("path");
10
- var os = __require("os");
11
- var crypto = __require("crypto");
12
- var TIPS = [
13
- "◈ encrypted .env [www.dotenvx.com]",
14
- "◈ secrets for agents [www.dotenvx.com]",
15
- "⌁ auth for agents [www.vestauth.com]",
16
- "⌘ custom filepath { path: '/custom/path/.env' }",
17
- "⌘ enable debugging { debug: true }",
18
- "⌘ override existing { override: true }",
19
- "⌘ suppress logs { quiet: true }",
20
- "⌘ multiple files { path: ['.env.local', '.env'] }"
21
- ];
22
- function _getRandomTip() {
23
- return TIPS[Math.floor(Math.random() * TIPS.length)];
24
- }
25
- function parseBoolean(value) {
26
- if (typeof value === "string") {
27
- return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
28
- }
29
- return Boolean(value);
30
- }
31
- function supportsAnsi() {
32
- return process.stdout.isTTY;
33
- }
34
- function dim(text) {
35
- return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
36
- }
37
- var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
38
- function parse(src) {
39
- const obj = {};
40
- let lines = src.toString();
41
- lines = lines.replace(/\r\n?/mg, `
42
- `);
43
- let match;
44
- while ((match = LINE.exec(lines)) != null) {
45
- const key = match[1];
46
- let value = match[2] || "";
47
- value = value.trim();
48
- const maybeQuote = value[0];
49
- value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
50
- if (maybeQuote === '"') {
51
- value = value.replace(/\\n/g, `
52
- `);
53
- value = value.replace(/\\r/g, "\r");
54
- }
55
- obj[key] = value;
56
- }
57
- return obj;
58
- }
59
- function _parseVault(options) {
60
- options = options || {};
61
- const vaultPath = _vaultPath(options);
62
- options.path = vaultPath;
63
- const result = DotenvModule.configDotenv(options);
64
- if (!result.parsed) {
65
- const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
66
- err.code = "MISSING_DATA";
67
- throw err;
68
- }
69
- const keys = _dotenvKey(options).split(",");
70
- const length = keys.length;
71
- let decrypted;
72
- for (let i = 0;i < length; i++) {
73
- try {
74
- const key = keys[i].trim();
75
- const attrs = _instructions(result, key);
76
- decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
77
- break;
78
- } catch (error) {
79
- if (i + 1 >= length) {
80
- throw error;
81
- }
82
- }
83
- }
84
- return DotenvModule.parse(decrypted);
85
- }
86
- function _warn(message) {
87
- console.error(`⚠ ${message}`);
88
- }
89
- function _debug(message) {
90
- console.log(`┆ ${message}`);
91
- }
92
- function _log(message) {
93
- console.log(`◇ ${message}`);
94
- }
95
- function _dotenvKey(options) {
96
- if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
97
- return options.DOTENV_KEY;
98
- }
99
- if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
100
- return process.env.DOTENV_KEY;
101
- }
102
- return "";
103
- }
104
- function _instructions(result, dotenvKey) {
105
- let uri;
106
- try {
107
- uri = new URL(dotenvKey);
108
- } catch (error) {
109
- if (error.code === "ERR_INVALID_URL") {
110
- const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
111
- err.code = "INVALID_DOTENV_KEY";
112
- throw err;
113
- }
114
- throw error;
115
- }
116
- const key = uri.password;
117
- if (!key) {
118
- const err = new Error("INVALID_DOTENV_KEY: Missing key part");
119
- err.code = "INVALID_DOTENV_KEY";
120
- throw err;
121
- }
122
- const environment = uri.searchParams.get("environment");
123
- if (!environment) {
124
- const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
125
- err.code = "INVALID_DOTENV_KEY";
126
- throw err;
127
- }
128
- const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
129
- const ciphertext = result.parsed[environmentKey];
130
- if (!ciphertext) {
131
- const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
132
- err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
133
- throw err;
134
- }
135
- return { ciphertext, key };
136
- }
137
- function _vaultPath(options) {
138
- let possibleVaultPath = null;
139
- if (options && options.path && options.path.length > 0) {
140
- if (Array.isArray(options.path)) {
141
- for (const filepath of options.path) {
142
- if (fs.existsSync(filepath)) {
143
- possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
144
- }
145
- }
146
- } else {
147
- possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
148
- }
149
- } else {
150
- possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
151
- }
152
- if (fs.existsSync(possibleVaultPath)) {
153
- return possibleVaultPath;
154
- }
155
- return null;
156
- }
157
- function _resolveHome(envPath) {
158
- return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
159
- }
160
- function _configVault(options) {
161
- const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
162
- const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
163
- if (debug || !quiet) {
164
- _log("loading env from encrypted .env.vault");
165
- }
166
- const parsed = DotenvModule._parseVault(options);
167
- let processEnv = process.env;
168
- if (options && options.processEnv != null) {
169
- processEnv = options.processEnv;
170
- }
171
- DotenvModule.populate(processEnv, parsed, options);
172
- return { parsed };
173
- }
174
- function configDotenv(options) {
175
- const dotenvPath = path.resolve(process.cwd(), ".env");
176
- let encoding = "utf8";
177
- let processEnv = process.env;
178
- if (options && options.processEnv != null) {
179
- processEnv = options.processEnv;
180
- }
181
- let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
182
- let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
183
- if (options && options.encoding) {
184
- encoding = options.encoding;
185
- } else {
186
- if (debug) {
187
- _debug("no encoding is specified (UTF-8 is used by default)");
188
- }
189
- }
190
- let optionPaths = [dotenvPath];
191
- if (options && options.path) {
192
- if (!Array.isArray(options.path)) {
193
- optionPaths = [_resolveHome(options.path)];
194
- } else {
195
- optionPaths = [];
196
- for (const filepath of options.path) {
197
- optionPaths.push(_resolveHome(filepath));
198
- }
199
- }
200
- }
201
- let lastError;
202
- const parsedAll = {};
203
- for (const path2 of optionPaths) {
204
- try {
205
- const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding }));
206
- DotenvModule.populate(parsedAll, parsed, options);
207
- } catch (e) {
208
- if (debug) {
209
- _debug(`failed to load ${path2} ${e.message}`);
210
- }
211
- lastError = e;
212
- }
213
- }
214
- const populated = DotenvModule.populate(processEnv, parsedAll, options);
215
- debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
216
- quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
217
- if (debug || !quiet) {
218
- const keysCount = Object.keys(populated).length;
219
- const shortPaths = [];
220
- for (const filePath of optionPaths) {
221
- try {
222
- const relative = path.relative(process.cwd(), filePath);
223
- shortPaths.push(relative);
224
- } catch (e) {
225
- if (debug) {
226
- _debug(`failed to load ${filePath} ${e.message}`);
227
- }
228
- lastError = e;
229
- }
230
- }
231
- _log(`injected env (${keysCount}) from ${shortPaths.join(",")} ${dim(`// tip: ${_getRandomTip()}`)}`);
232
- }
233
- if (lastError) {
234
- return { parsed: parsedAll, error: lastError };
235
- } else {
236
- return { parsed: parsedAll };
237
- }
238
- }
239
- function config(options) {
240
- if (_dotenvKey(options).length === 0) {
241
- return DotenvModule.configDotenv(options);
242
- }
243
- const vaultPath = _vaultPath(options);
244
- if (!vaultPath) {
245
- _warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`);
246
- return DotenvModule.configDotenv(options);
247
- }
248
- return DotenvModule._configVault(options);
249
- }
250
- function decrypt(encrypted, keyStr) {
251
- const key = Buffer.from(keyStr.slice(-64), "hex");
252
- let ciphertext = Buffer.from(encrypted, "base64");
253
- const nonce = ciphertext.subarray(0, 12);
254
- const authTag = ciphertext.subarray(-16);
255
- ciphertext = ciphertext.subarray(12, -16);
256
- try {
257
- const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
258
- aesgcm.setAuthTag(authTag);
259
- return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
260
- } catch (error) {
261
- const isRange = error instanceof RangeError;
262
- const invalidKeyLength = error.message === "Invalid key length";
263
- const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
264
- if (isRange || invalidKeyLength) {
265
- const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
266
- err.code = "INVALID_DOTENV_KEY";
267
- throw err;
268
- } else if (decryptionFailed) {
269
- const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
270
- err.code = "DECRYPTION_FAILED";
271
- throw err;
272
- } else {
273
- throw error;
274
- }
275
- }
276
- }
277
- function populate(processEnv, parsed, options = {}) {
278
- const debug = Boolean(options && options.debug);
279
- const override = Boolean(options && options.override);
280
- const populated = {};
281
- if (typeof parsed !== "object") {
282
- const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
283
- err.code = "OBJECT_REQUIRED";
284
- throw err;
285
- }
286
- for (const key of Object.keys(parsed)) {
287
- if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
288
- if (override === true) {
289
- processEnv[key] = parsed[key];
290
- populated[key] = parsed[key];
291
- }
292
- if (debug) {
293
- if (override === true) {
294
- _debug(`"${key}" is already defined and WAS overwritten`);
295
- } else {
296
- _debug(`"${key}" is already defined and was NOT overwritten`);
297
- }
298
- }
299
- } else {
300
- processEnv[key] = parsed[key];
301
- populated[key] = parsed[key];
302
- }
303
- }
304
- return populated;
305
- }
306
- var DotenvModule = {
307
- configDotenv,
308
- _configVault,
309
- _parseVault,
310
- config,
311
- decrypt,
312
- parse,
313
- populate
314
- };
315
- module.exports.configDotenv = DotenvModule.configDotenv;
316
- module.exports._configVault = DotenvModule._configVault;
317
- module.exports._parseVault = DotenvModule._parseVault;
318
- module.exports.config = DotenvModule.config;
319
- module.exports.decrypt = DotenvModule.decrypt;
320
- module.exports.parse = DotenvModule.parse;
321
- module.exports.populate = DotenvModule.populate;
322
- module.exports = DotenvModule;
323
- });
324
- export default require_main();
@@ -1,29 +0,0 @@
1
- import {
2
- DEFAULT_CONCURRENCY,
3
- runPentestSwarm,
4
- runPentestWorkflow
5
- } from "./cli-5k33webc.js";
6
- import"./cli-gq40s5b3.js";
7
- import"./cli-b1adytsy.js";
8
- import"./cli-mavved45.js";
9
- import"./cli-32z0017y.js";
10
- import"./cli-k8kc47pq.js";
11
- import"./cli-9fsre5pt.js";
12
- import"./cli-qqt4gj1w.js";
13
- import"./cli-repbyhkk.js";
14
- import"./cli-tznv8pf1.js";
15
- import"./cli-fw5r7pfj.js";
16
- import"./cli-c8131c4q.js";
17
- import"./cli-tkc598ey.js";
18
- import"./cli-0n4r54hq.js";
19
- import"./cli-swpbx60z.js";
20
- import"./cli-j54qa6tm.js";
21
- import"./cli-72cvcqhg.js";
22
- import"./cli-9rhzhgx2.js";
23
- import"./cli-vnynf0js.js";
24
- import"./cli-bc05qbss.js";
25
- export {
26
- DEFAULT_CONCURRENCY,
27
- runPentestSwarm,
28
- runPentestWorkflow
29
- };