@rhodawkai/bounty-hunter 2.0.1 → 2.0.2
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/bin/rhodawk.js +61 -20
- package/package.json +1 -1
package/bin/rhodawk.js
CHANGED
|
@@ -1,38 +1,79 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
4
6
|
const { spawnSync } = require("child_process");
|
|
5
7
|
|
|
6
8
|
const PKG = "rhodawk-bounty-hunter";
|
|
7
9
|
const args = process.argv.slice(2);
|
|
10
|
+
const SELF_REAL = fs.realpathSync(__filename);
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
return probe.status === 0;
|
|
12
|
+
if (process.env.RHODAWK_NPM_WRAPPER === "1") {
|
|
13
|
+
console.error("[rhodawk] Aborting recursive wrapper invocation.");
|
|
14
|
+
process.exit(1);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
function
|
|
17
|
-
|
|
17
|
+
function isExecutable(filePath) {
|
|
18
|
+
try {
|
|
19
|
+
const stat = fs.statSync(filePath);
|
|
20
|
+
if (!stat.isFile()) return false;
|
|
21
|
+
if (process.platform === "win32") return true;
|
|
22
|
+
fs.accessSync(filePath, fs.constants.X_OK);
|
|
23
|
+
return true;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function findExternalCmd(cmd) {
|
|
30
|
+
const pathDirs = (process.env.PATH || "").split(path.delimiter).filter(Boolean);
|
|
31
|
+
const exts = process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""];
|
|
32
|
+
|
|
33
|
+
for (const dir of pathDirs) {
|
|
34
|
+
for (const ext of exts) {
|
|
35
|
+
const candidate = path.join(dir, cmd + ext);
|
|
36
|
+
if (!isExecutable(candidate)) continue;
|
|
37
|
+
let real;
|
|
38
|
+
try {
|
|
39
|
+
real = fs.realpathSync(candidate);
|
|
40
|
+
} catch {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (real === SELF_REAL) continue;
|
|
44
|
+
return candidate;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function run(cmdPath, cmdArgs) {
|
|
51
|
+
const res = spawnSync(cmdPath, cmdArgs, {
|
|
52
|
+
stdio: "inherit",
|
|
53
|
+
env: { ...process.env, RHODAWK_NPM_WRAPPER: "1" },
|
|
54
|
+
});
|
|
18
55
|
if (res.error) {
|
|
19
|
-
console.error(`[rhodawk] Failed to run ${
|
|
56
|
+
console.error(`[rhodawk] Failed to run ${cmdPath}: ${res.error.message}`);
|
|
20
57
|
process.exit(1);
|
|
21
58
|
}
|
|
22
59
|
process.exit(res.status ?? 0);
|
|
23
60
|
}
|
|
24
61
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
run("pipx", ["run", "--spec", PKG, "rhodawk", ...args]);
|
|
62
|
+
const rhodawkBin = findExternalCmd("rhodawk");
|
|
63
|
+
if (rhodawkBin) {
|
|
64
|
+
run(rhodawkBin, args);
|
|
29
65
|
} else {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
` # or inside a virtualenv:\n` +
|
|
35
|
-
` pip install ${PKG}\n`
|
|
36
|
-
);
|
|
37
|
-
process.exit(1);
|
|
66
|
+
const pipxBin = findExternalCmd("pipx");
|
|
67
|
+
if (pipxBin) {
|
|
68
|
+
run(pipxBin, ["run", "--spec", PKG, "rhodawk", ...args]);
|
|
69
|
+
}
|
|
38
70
|
}
|
|
71
|
+
|
|
72
|
+
console.error(
|
|
73
|
+
`[rhodawk] Python CLI not found on PATH.\n` +
|
|
74
|
+
`Install the core package first:\n` +
|
|
75
|
+
` pipx install ${PKG}\n` +
|
|
76
|
+
` # or inside a virtualenv:\n` +
|
|
77
|
+
` pip install ${PKG}\n`
|
|
78
|
+
);
|
|
79
|
+
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhodawkai/bounty-hunter",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "RhodawkAI Bounty Hunter CLI wrapper — fail-closed, CDN-aware autonomous bug bounty reconnaissance & attack-surface prioritization.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "RhodawkAI <manager@rhodawkai.com>",
|