infynon 0.2.0-beta.6.1

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/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "infynon",
3
+ "version": "0.2.0-beta.6.1",
4
+ "description": "Universal package security manager & network firewall — intercepts installs across npm, pip, cargo, go, gem and more with 3-layer CVE verification, plus a real-time reverse proxy WAF with TUI dashboard",
5
+ "bin": {
6
+ "infynon": "./run.js",
7
+ "infynon-pkg": "./run.js"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "node postinstall.js",
11
+ "preuninstall": "node preuninstall.js"
12
+ },
13
+ "files": [
14
+ "run.js",
15
+ "postinstall.js",
16
+ "preuninstall.js"
17
+ ],
18
+ "engines": {
19
+ "node": ">=14"
20
+ },
21
+ "keywords": [
22
+ "security",
23
+ "package-manager",
24
+ "vulnerability",
25
+ "firewall",
26
+ "waf",
27
+ "cve",
28
+ "pentest",
29
+ "supply-chain"
30
+ ],
31
+ "author": "d4rkNinja",
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/d4rkNinja/infynon-cli"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/d4rkNinja/infynon-cli/issues"
39
+ },
40
+ "homepage": "https://github.com/d4rkNinja/infynon-cli#readme"
41
+ }
package/postinstall.js ADDED
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const https = require("https");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const os = require("os");
8
+ const { execSync } = require("child_process");
9
+
10
+ const REPO = "d4rkNinja/infynon-cli";
11
+ const VERSION = require("./package.json").version;
12
+ const BIN_DIR = path.join(__dirname, "bin");
13
+ const BIN_PATH = path.join(BIN_DIR, process.platform === "win32" ? "infynon.exe" : "infynon");
14
+
15
+ // Map Node.js platform/arch to the GitHub release target triple
16
+ function getTarget() {
17
+ const platform = process.platform;
18
+ const arch = process.arch;
19
+
20
+ if (platform === "win32" && arch === "x64") return { target: "x86_64-pc-windows-msvc", ext: ".exe" };
21
+ if (platform === "linux" && arch === "x64") return { target: "x86_64-unknown-linux-musl", ext: "" };
22
+ if (platform === "linux" && arch === "arm64") return { target: "aarch64-unknown-linux-musl", ext: "" };
23
+ if (platform === "darwin" && arch === "x64") return { target: "x86_64-apple-darwin", ext: "" };
24
+ if (platform === "darwin" && arch === "arm64") return { target: "aarch64-apple-darwin", ext: "" };
25
+
26
+ return null;
27
+ }
28
+
29
+ function downloadFile(url, dest, redirects) {
30
+ redirects = redirects === undefined ? 0 : redirects;
31
+ if (redirects > 5) {
32
+ throw new Error("Too many redirects while downloading binary");
33
+ }
34
+
35
+ return new Promise(function (resolve, reject) {
36
+ const file = fs.createWriteStream(dest);
37
+ https
38
+ .get(url, { headers: { "User-Agent": "infynon-npm-installer" } }, function (res) {
39
+ if (res.statusCode === 301 || res.statusCode === 302) {
40
+ file.close();
41
+ fs.unlinkSync(dest);
42
+ return downloadFile(res.headers.location, dest, redirects + 1)
43
+ .then(resolve)
44
+ .catch(reject);
45
+ }
46
+ if (res.statusCode !== 200) {
47
+ file.close();
48
+ fs.unlinkSync(dest);
49
+ return reject(new Error("Download failed with status " + res.statusCode + " from " + url));
50
+ }
51
+ res.pipe(file);
52
+ file.on("finish", function () {
53
+ file.close(resolve);
54
+ });
55
+ })
56
+ .on("error", function (err) {
57
+ fs.unlink(dest, function () {});
58
+ reject(err);
59
+ });
60
+ });
61
+ }
62
+
63
+ async function main() {
64
+ const info = getTarget();
65
+
66
+ if (!info) {
67
+ console.warn(
68
+ "[infynon] Unsupported platform: " + process.platform + " " + process.arch + ".\n" +
69
+ " Build from source: cargo install --git https://github.com/" + REPO
70
+ );
71
+ process.exit(0); // non-fatal — let the install succeed
72
+ }
73
+
74
+ // Strip npm prerelease suffix for the GitHub tag (beta.6 → beta.6 stays; just prefix with v)
75
+ const tag = "v" + VERSION;
76
+ const assetName = "infynon-" + info.target + info.ext;
77
+ const url = "https://github.com/" + REPO + "/releases/download/" + tag + "/" + assetName;
78
+
79
+ if (!fs.existsSync(BIN_DIR)) {
80
+ fs.mkdirSync(BIN_DIR, { recursive: true });
81
+ }
82
+
83
+ console.log("[infynon] Downloading " + assetName + " from " + tag + " release...");
84
+
85
+ try {
86
+ await downloadFile(url, BIN_PATH);
87
+ } catch (err) {
88
+ console.error("[infynon] Download failed: " + err.message);
89
+ console.error("[infynon] You can install manually: https://github.com/" + REPO + "/releases/tag/" + tag);
90
+ process.exit(0); // non-fatal
91
+ }
92
+
93
+ // Make executable on Unix
94
+ if (process.platform !== "win32") {
95
+ fs.chmodSync(BIN_PATH, 0o755);
96
+ }
97
+
98
+ console.log("[infynon] Installed successfully. Run: infynon --help");
99
+ }
100
+
101
+ main().catch(function (err) {
102
+ console.error("[infynon] Unexpected error during install:", err.message);
103
+ process.exit(0); // non-fatal — don't break npm install
104
+ });
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const os = require("os");
7
+
8
+ // Mirror the same path logic as src/firewall/config.rs → config_dir()
9
+ const INFYNON_DIR = path.join(os.homedir(), ".infynon");
10
+
11
+ // Files/dirs managed by infynon that live outside the npm package
12
+ const MANAGED_PATHS = [
13
+ { p: path.join(INFYNON_DIR, "infynon.toml"), label: "firewall config" },
14
+ { p: path.join(INFYNON_DIR, "eagle-eye.toml"), label: "eagle eye config" },
15
+ { p: path.join(INFYNON_DIR, "access.jsonl"), label: "access log" },
16
+ { p: path.join(INFYNON_DIR, "blocked.jsonl"), label: "blocked log" },
17
+ { p: path.join(INFYNON_DIR, "sbom.json"), label: "SBOM" },
18
+ ];
19
+
20
+ console.log("\n[infynon] Cleaning up...\n");
21
+
22
+ let removed = 0;
23
+
24
+ for (const { p, label } of MANAGED_PATHS) {
25
+ if (fs.existsSync(p)) {
26
+ try {
27
+ fs.rmSync(p, { force: true });
28
+ console.log(" removed " + label + " (" + p + ")");
29
+ removed++;
30
+ } catch (err) {
31
+ console.warn(" skipped " + label + " — " + err.message);
32
+ }
33
+ }
34
+ }
35
+
36
+ // Remove ~/.infynon/ itself if it is now empty
37
+ if (fs.existsSync(INFYNON_DIR)) {
38
+ try {
39
+ const remaining = fs.readdirSync(INFYNON_DIR);
40
+ if (remaining.length === 0) {
41
+ fs.rmdirSync(INFYNON_DIR);
42
+ console.log(" removed ~/.infynon/ directory");
43
+ } else {
44
+ console.log(
45
+ " kept ~/.infynon/ — " + remaining.length +
46
+ " user file(s) remain: " + remaining.join(", ")
47
+ );
48
+ }
49
+ } catch (_) {}
50
+ }
51
+
52
+ if (removed === 0) {
53
+ console.log(" nothing to clean up.\n");
54
+ } else {
55
+ console.log("\n[infynon] Clean uninstall complete.\n");
56
+ }
package/run.js ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("path");
5
+ const { spawnSync } = require("child_process");
6
+ const fs = require("fs");
7
+
8
+ const BIN_PATH = path.join(
9
+ __dirname,
10
+ "bin",
11
+ process.platform === "win32" ? "infynon.exe" : "infynon"
12
+ );
13
+
14
+ if (!fs.existsSync(BIN_PATH)) {
15
+ console.error(
16
+ "[infynon] Binary not found at: " + BIN_PATH + "\n" +
17
+ " Try reinstalling: npm install -g infynon\n" +
18
+ " Or build from source: cargo install --git https://github.com/d4rkNinja/infynon-cli"
19
+ );
20
+ process.exit(1);
21
+ }
22
+
23
+ const result = spawnSync(BIN_PATH, process.argv.slice(2), {
24
+ stdio: "inherit",
25
+ windowsHide: false,
26
+ });
27
+
28
+ if (result.error) {
29
+ console.error("[infynon] Failed to run binary:", result.error.message);
30
+ process.exit(1);
31
+ }
32
+
33
+ process.exit(result.status !== null ? result.status : 1);