@armurai/pentestswarm 0.2.0

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 ADDED
@@ -0,0 +1,40 @@
1
+ # @armurai/pentestswarm
2
+
3
+ One-command install of [Pentest Swarm AI](https://github.com/Armur-Ai/Pentest-Swarm-AI):
4
+
5
+ ```bash
6
+ npm install -g @armurai/pentestswarm
7
+ pentestswarm run
8
+ ```
9
+
10
+ The package is scoped to the `@armurai` org, but the installed command is just
11
+ `pentestswarm`.
12
+
13
+ This package is a thin delivery wrapper: on install it downloads the prebuilt
14
+ Go binary for your platform from the matching GitHub release (`vX.Y.Z`), and
15
+ the `pentestswarm` command execs it directly. The real program is the Go
16
+ binary — see the main repo for docs.
17
+
18
+ ## Publishing (maintainers)
19
+
20
+ The package `version` MUST match a published GitHub release tag (the
21
+ postinstall downloads `pentestswarm-<os>-<arch>` from
22
+ `releases/download/v<version>/`). To cut a release:
23
+
24
+ 1. Tag + push (`git tag vX.Y.Z && git push origin vX.Y.Z`) → GoReleaser builds
25
+ the per-platform binaries and publishes the GitHub release.
26
+ 2. Bump `npm/package.json` `version` to `X.Y.Z`.
27
+ 3. `cd npm && npm publish` — `publishConfig.access` is already `public`, so the
28
+ scoped package publishes publicly without the `--access public` flag. Needs
29
+ `npm login` to the `@armurai` org (member with publish rights).
30
+
31
+ To let the `@armurai:<team>` team manage the package after the first publish:
32
+
33
+ ```bash
34
+ npm access grant read-write armurai:<team> @armurai/pentestswarm
35
+ ```
36
+
37
+ A CI step can automate 2–3 on release via an npm **automation** token stored as
38
+ the `NPM_TOKEN` GitHub Actions secret. Consider migrating to per-platform
39
+ `optionalDependencies` packages (esbuild-style) later to avoid a postinstall
40
+ network fetch.
package/bin/cli.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ // Thin shim: exec the real (Go) pentestswarm binary fetched by install.js,
3
+ // forwarding all args, stdio, and the exit code — so `pentestswarm …` behaves
4
+ // exactly like the native binary, including the interactive TUI.
5
+ "use strict";
6
+ const path = require("path");
7
+ const fs = require("fs");
8
+ const { spawnSync } = require("child_process");
9
+
10
+ const ext = process.platform === "win32" ? ".exe" : "";
11
+ const bin = path.join(__dirname, "pentestswarm" + ext);
12
+
13
+ if (!fs.existsSync(bin)) {
14
+ console.error(
15
+ "pentestswarm: binary not found — the postinstall download may have failed.\n" +
16
+ "Reinstall (npm i -g @armurai/pentestswarm), or install from\n" +
17
+ "https://github.com/Armur-Ai/Pentest-Swarm-AI/releases"
18
+ );
19
+ process.exit(1);
20
+ }
21
+
22
+ const res = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
23
+ if (res.error) {
24
+ console.error("pentestswarm:", res.error.message);
25
+ process.exit(1);
26
+ }
27
+ process.exit(res.status === null ? 1 : res.status);
package/install.js ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ // postinstall: fetch the prebuilt pentestswarm binary matching this package's
3
+ // version + the host platform from the GitHub release, into ./bin. The Go
4
+ // binary is the real program; this npm package is just a delivery vehicle so
5
+ // `npm i -g pentestswarm` works like any other CLI.
6
+ "use strict";
7
+ const fs = require("fs");
8
+ const path = require("path");
9
+ const https = require("https");
10
+
11
+ const REPO = "Armur-Ai/Pentest-Swarm-AI";
12
+ const version = "v" + require("./package.json").version;
13
+
14
+ // Map Node's platform/arch onto the GoReleaser artifact names
15
+ // (pentestswarm-<goos>-<goarch>).
16
+ const osMap = { darwin: "darwin", linux: "linux", win32: "windows" };
17
+ const archMap = { x64: "amd64", arm64: "arm64" };
18
+ const goos = osMap[process.platform];
19
+ const goarch = archMap[process.arch];
20
+
21
+ if (!goos || !goarch) {
22
+ console.error(
23
+ `pentestswarm: unsupported platform ${process.platform}/${process.arch}.\n` +
24
+ `Install from https://github.com/${REPO}/releases instead.`
25
+ );
26
+ process.exit(0); // don't hard-fail the whole npm install
27
+ }
28
+
29
+ const ext = goos === "windows" ? ".exe" : "";
30
+ const asset = `pentestswarm-${goos}-${goarch}`;
31
+ const url = `https://github.com/${REPO}/releases/download/${version}/${asset}`;
32
+ const binDir = path.join(__dirname, "bin");
33
+ const dest = path.join(binDir, "pentestswarm" + ext);
34
+
35
+ function download(u, file, redirects) {
36
+ if (redirects > 10) return file.destroy(new Error("too many redirects"));
37
+ https
38
+ .get(u, { headers: { "User-Agent": "pentestswarm-npm" } }, (res) => {
39
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
40
+ res.resume();
41
+ return download(res.headers.location, file, (redirects || 0) + 1);
42
+ }
43
+ if (res.statusCode !== 200) {
44
+ return file.destroy(new Error(`HTTP ${res.statusCode} for ${u}`));
45
+ }
46
+ res.pipe(file);
47
+ })
48
+ .on("error", (e) => file.destroy(e));
49
+ }
50
+
51
+ fs.mkdirSync(binDir, { recursive: true });
52
+ const out = fs.createWriteStream(dest, { mode: 0o755 });
53
+ out.on("finish", () => {
54
+ try {
55
+ fs.chmodSync(dest, 0o755);
56
+ } catch (_) {}
57
+ console.log(`pentestswarm ${version} installed (${goos}/${goarch}).`);
58
+ });
59
+ out.on("error", (e) => {
60
+ console.error(
61
+ `pentestswarm: could not download the binary (${e.message}).\n` +
62
+ `Grab it from https://github.com/${REPO}/releases or use the install script.`
63
+ );
64
+ // Exit 0 so a transient download hiccup doesn't break the user's whole
65
+ // `npm install`; the bin shim reports a clear error if the binary is absent.
66
+ process.exit(0);
67
+ });
68
+ download(url, out, 0);
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@armurai/pentestswarm",
3
+ "publishConfig": {
4
+ "access": "public"
5
+ },
6
+ "version": "0.2.0",
7
+ "description": "Autonomous AI-powered penetration-testing swarm — one command, real vulns.",
8
+ "keywords": ["security", "pentest", "bug-bounty", "ai", "swarm", "appsec", "cli"],
9
+ "homepage": "https://github.com/Armur-Ai/Pentest-Swarm-AI",
10
+ "bugs": "https://github.com/Armur-Ai/Pentest-Swarm-AI/issues",
11
+ "license": "AGPL-3.0-only",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/Armur-Ai/Pentest-Swarm-AI.git",
15
+ "directory": "npm"
16
+ },
17
+ "bin": {
18
+ "pentestswarm": "bin/cli.js"
19
+ },
20
+ "files": [
21
+ "bin/cli.js",
22
+ "install.js"
23
+ ],
24
+ "scripts": {
25
+ "postinstall": "node install.js"
26
+ },
27
+ "engines": {
28
+ "node": ">=16"
29
+ },
30
+ "os": ["darwin", "linux", "win32"],
31
+ "cpu": ["x64", "arm64"]
32
+ }