@pensar/apex 0.0.111 → 0.0.112
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.
- package/README.md +2 -3
- package/bin/pensar.js +31 -276
- package/build/agent-5qdmmchx.js +206 -0
- package/build/agent-s2z0dasf.js +16 -0
- package/build/auth-jvq72ekc.js +263 -0
- package/build/authentication-nya4td5k.js +310 -0
- package/build/blackboxAgent-qa9ze2hn.js +17 -0
- package/build/blackboxPentest-85hwznet.js +41 -0
- package/build/cli-15vxn9zj.js +1358 -0
- package/build/cli-2ckm5es2.js +50 -0
- package/build/cli-49cd9yfk.js +4475 -0
- package/build/cli-5d6cs4dq.js +53 -0
- package/build/cli-6gtnyaqf.js +109 -0
- package/build/cli-7ckctq7a.js +45 -0
- package/build/cli-8rxa073f.js +104 -0
- package/build/cli-bp6d08sg.js +110 -0
- package/build/cli-e20q3hqz.js +307 -0
- package/build/cli-f9shhcxf.js +1498 -0
- package/build/cli-hmrzx8am.js +507 -0
- package/build/cli-j66pect7.js +202 -0
- package/build/cli-jb0gcnrs.js +60 -0
- package/build/cli-jh38b6zv.js +1074 -0
- package/build/cli-kqtgcdzn.js +54784 -0
- package/build/cli-r8r90gka.js +96700 -0
- package/build/cli-va4y0089.js +395 -0
- package/build/cli-w04ggbe4.js +104 -0
- package/build/cli-x1msjf55.js +103 -0
- package/build/cli-yj3dy0vg.js +180 -0
- package/build/cli.js +509 -0
- package/build/doctor-b7612pzw.js +117 -0
- package/build/fixes-1r6v7kh2.js +49 -0
- package/build/index-5ke2yd32.js +17 -0
- package/build/index-9ze42wn7.js +68412 -0
- package/build/index-rd11fk7h.js +1257 -0
- package/build/index-tke6896d.js +1097 -0
- package/build/index-vwvh1rdw.js +535 -0
- package/build/issues-kx721wja.js +94 -0
- package/build/logs-hav7d0nm.js +77 -0
- package/build/main-2483qzbq.js +397 -0
- package/build/multipart-parser-r38qdp5v.js +350 -0
- package/build/pentest-zzebnfa0.js +25 -0
- package/build/pentests-s9fwd71b.js +70 -0
- package/build/projects-tr719twv.js +35 -0
- package/build/targetedPentest-w2c85whf.js +32 -0
- package/build/token-6x6aavpc.js +58 -0
- package/build/token-util-na95bqjj.js +6 -0
- package/build/uninstall-2j0pymb0.js +231 -0
- package/build/utils-jky0th19.js +107 -0
- package/package.json +3 -4
- package/build/auth.js +0 -625
- package/build/highlights-eq9cgrbb.scm +0 -604
- package/build/highlights-ghv9g403.scm +0 -205
- package/build/highlights-hk7bwhj4.scm +0 -284
- package/build/highlights-r812a2qc.scm +0 -150
- package/build/highlights-x6tmsnaa.scm +0 -115
- package/build/index.js +0 -292069
- package/build/injections-73j83es3.scm +0 -27
- package/build/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
- package/build/tree-sitter-markdown-411r6y9b.wasm +0 -0
- package/build/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
- package/build/tree-sitter-typescript-zxjzwt75.wasm +0 -0
- package/build/tree-sitter-zig-e78zbjpm.wasm +0 -0
- package/src/core/installation/index.ts +0 -223
- package/src/core/installation/installation.test.ts +0 -454
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toolExists
|
|
3
|
+
} from "./cli-6gtnyaqf.js";
|
|
4
|
+
import"./cli-8rxa073f.js";
|
|
5
|
+
|
|
6
|
+
// src/core/doctor.ts
|
|
7
|
+
import { execSync, spawnSync } from "child_process";
|
|
8
|
+
import readline from "readline";
|
|
9
|
+
function detectPackageManager() {
|
|
10
|
+
const platform = process.platform;
|
|
11
|
+
if (platform === "darwin" && toolExists("brew")) {
|
|
12
|
+
return { name: "Homebrew", installCmd: "brew install nmap" };
|
|
13
|
+
}
|
|
14
|
+
if (toolExists("apt-get")) {
|
|
15
|
+
return {
|
|
16
|
+
name: "apt",
|
|
17
|
+
installCmd: "sudo apt-get update && sudo apt-get install -y nmap"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (toolExists("dnf")) {
|
|
21
|
+
return { name: "dnf", installCmd: "sudo dnf install -y nmap" };
|
|
22
|
+
}
|
|
23
|
+
if (toolExists("pacman")) {
|
|
24
|
+
return { name: "pacman", installCmd: "sudo pacman -S --noconfirm nmap" };
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
function prompt(question) {
|
|
29
|
+
const rl = readline.createInterface({
|
|
30
|
+
input: process.stdin,
|
|
31
|
+
output: process.stdout
|
|
32
|
+
});
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
rl.question(question, (answer) => {
|
|
35
|
+
rl.close();
|
|
36
|
+
resolve(answer.trim());
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function checkApiKeys() {
|
|
41
|
+
const keys = [
|
|
42
|
+
{ provider: "Anthropic", env: "ANTHROPIC_API_KEY" },
|
|
43
|
+
{ provider: "OpenAI", env: "OPENAI_API_KEY" },
|
|
44
|
+
{ provider: "Google", env: "GOOGLE_GENERATIVE_AI_API_KEY" },
|
|
45
|
+
{ provider: "OpenRouter", env: "OPENROUTER_API_KEY" },
|
|
46
|
+
{ provider: "AWS Bedrock", env: "BEDROCK_API_KEY" },
|
|
47
|
+
{ provider: "AWS IAM", env: "AWS_ACCESS_KEY_ID" },
|
|
48
|
+
{ provider: "vLLM (local)", env: "LOCAL_MODEL_URL" }
|
|
49
|
+
];
|
|
50
|
+
return keys.map(({ provider, env }) => ({
|
|
51
|
+
provider,
|
|
52
|
+
configured: Boolean(process.env[env])
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
async function runDoctor() {
|
|
56
|
+
console.log();
|
|
57
|
+
console.log("Pensar Doctor");
|
|
58
|
+
console.log("=============");
|
|
59
|
+
console.log();
|
|
60
|
+
console.log("System Tools");
|
|
61
|
+
console.log("------------");
|
|
62
|
+
const nmapInstalled = toolExists("nmap");
|
|
63
|
+
if (nmapInstalled) {
|
|
64
|
+
let version = "";
|
|
65
|
+
try {
|
|
66
|
+
version = execSync("nmap --version", { encoding: "utf-8" }).split(`
|
|
67
|
+
`)[0]?.trim() ?? "";
|
|
68
|
+
} catch {}
|
|
69
|
+
console.log(` ✓ nmap ${version ? `(${version})` : "installed"}`);
|
|
70
|
+
} else {
|
|
71
|
+
console.log(" ✗ nmap — not found (recommended for network scanning)");
|
|
72
|
+
}
|
|
73
|
+
console.log();
|
|
74
|
+
console.log("AI Providers");
|
|
75
|
+
console.log("------------");
|
|
76
|
+
const apiKeys = checkApiKeys();
|
|
77
|
+
const anyConfigured = apiKeys.some((k) => k.configured);
|
|
78
|
+
for (const key of apiKeys) {
|
|
79
|
+
const icon = key.configured ? "✓" : "·";
|
|
80
|
+
console.log(` ${icon} ${key.provider}`);
|
|
81
|
+
}
|
|
82
|
+
if (!anyConfigured) {
|
|
83
|
+
console.log();
|
|
84
|
+
console.log(" No AI provider configured. Set at least one API key to get started:");
|
|
85
|
+
console.log(" export ANTHROPIC_API_KEY=your-key-here");
|
|
86
|
+
}
|
|
87
|
+
console.log();
|
|
88
|
+
if (!nmapInstalled) {
|
|
89
|
+
const pm = detectPackageManager();
|
|
90
|
+
if (pm) {
|
|
91
|
+
const answer = await prompt(`Install nmap via ${pm.name}? (${pm.installCmd}) [y/N] `);
|
|
92
|
+
if (/^y(es)?$/i.test(answer)) {
|
|
93
|
+
console.log();
|
|
94
|
+
const result = spawnSync(pm.installCmd, {
|
|
95
|
+
stdio: "inherit",
|
|
96
|
+
shell: true
|
|
97
|
+
});
|
|
98
|
+
console.log();
|
|
99
|
+
if (result.status === 0) {
|
|
100
|
+
console.log("✓ nmap installed successfully!");
|
|
101
|
+
} else {
|
|
102
|
+
console.log("✗ Installation failed. You can install manually:");
|
|
103
|
+
console.log(` ${pm.installCmd}`);
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
console.log(" Skipped nmap installation.");
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
console.log(" No supported package manager found. Install nmap manually:");
|
|
110
|
+
console.log(" https://nmap.org/download.html");
|
|
111
|
+
}
|
|
112
|
+
console.log();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
runDoctor
|
|
117
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import {
|
|
3
|
+
getFix,
|
|
4
|
+
listFixes
|
|
5
|
+
} from "./cli-x1msjf55.js";
|
|
6
|
+
import"./cli-bp6d08sg.js";
|
|
7
|
+
import"./cli-jb0gcnrs.js";
|
|
8
|
+
import"./cli-yj3dy0vg.js";
|
|
9
|
+
import"./cli-8rxa073f.js";
|
|
10
|
+
|
|
11
|
+
// src/cli/fixes.ts
|
|
12
|
+
function showHelp() {
|
|
13
|
+
console.log(`pensar fixes — View security fixes via the Pensar API
|
|
14
|
+
|
|
15
|
+
Usage:
|
|
16
|
+
pensar fixes <issueId> List fixes for an issue
|
|
17
|
+
pensar fixes get <fixId> Get fix details (includes diff)
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
-h, --help Show this help message`);
|
|
21
|
+
}
|
|
22
|
+
async function main() {
|
|
23
|
+
const args = process.argv.slice(2);
|
|
24
|
+
const sub = args[0];
|
|
25
|
+
if (!sub || sub === "--help" || sub === "-h" || sub === "help") {
|
|
26
|
+
showHelp();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
if (sub === "get") {
|
|
31
|
+
const fixId = args[1];
|
|
32
|
+
if (!fixId) {
|
|
33
|
+
console.error("Error: fix ID is required");
|
|
34
|
+
console.error("Usage: pensar fixes get <fixId>");
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
const fix = await getFix(fixId);
|
|
38
|
+
console.log(JSON.stringify(fix, null, 2));
|
|
39
|
+
} else {
|
|
40
|
+
const fixes = await listFixes(sub);
|
|
41
|
+
console.log(JSON.stringify(fixes, null, 2));
|
|
42
|
+
}
|
|
43
|
+
} catch (err) {
|
|
44
|
+
console.error(`
|
|
45
|
+
Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
main();
|