@profullstack/threatcrush 0.1.8 → 0.1.9
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 +1 -1
- package/dist/index.js +158 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +182 -12
package/README.md
CHANGED
|
@@ -128,7 +128,7 @@ Config lives at `/etc/threatcrush/threatcrushd.conf` with module configs in `/et
|
|
|
128
128
|
| Tier | Price |
|
|
129
129
|
|------|-------|
|
|
130
130
|
| **Lifetime Access** | $499 one-time |
|
|
131
|
-
| **With Referral** | $
|
|
131
|
+
| **With Referral** | Friend pays $399 · You earn $100 cash per referral |
|
|
132
132
|
|
|
133
133
|
Pay once, access forever. All core modules, CLI, daemon, API, and lifetime updates included.
|
|
134
134
|
|
package/dist/index.js
CHANGED
|
@@ -3840,6 +3840,15 @@ var source_default = chalk;
|
|
|
3840
3840
|
|
|
3841
3841
|
// src/index.ts
|
|
3842
3842
|
var import_readline = __toESM(require("readline"));
|
|
3843
|
+
var import_node_child_process = require("child_process");
|
|
3844
|
+
var import_node_fs = require("fs");
|
|
3845
|
+
var import_node_path = require("path");
|
|
3846
|
+
var PKG_VERSION = "0.1.8";
|
|
3847
|
+
try {
|
|
3848
|
+
const pkg = JSON.parse((0, import_node_fs.readFileSync)((0, import_node_path.join)(__dirname, "..", "package.json"), "utf-8"));
|
|
3849
|
+
PKG_VERSION = pkg.version;
|
|
3850
|
+
} catch {
|
|
3851
|
+
}
|
|
3843
3852
|
var LOGO = `
|
|
3844
3853
|
${source_default.green(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")}
|
|
3845
3854
|
${source_default.green(" \u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D")}
|
|
@@ -3850,6 +3859,7 @@ ${source_default.green(" \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u25
|
|
|
3850
3859
|
${source_default.dim(" C R U S H")}
|
|
3851
3860
|
`;
|
|
3852
3861
|
var API_URL = process.env.THREATCRUSH_API_URL || "https://threatcrush.com";
|
|
3862
|
+
var PKG_NAME = "@profullstack/threatcrush";
|
|
3853
3863
|
async function promptEmail() {
|
|
3854
3864
|
const rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
3855
3865
|
return new Promise((resolve) => {
|
|
@@ -3886,7 +3896,7 @@ async function emailGate() {
|
|
|
3886
3896
|
console.log(source_default.dim(` Referral code: ${source_default.white(result.referral_code)}`));
|
|
3887
3897
|
console.log(source_default.dim(` Share: ${API_URL}?ref=${result.referral_code}`));
|
|
3888
3898
|
console.log(source_default.green(`
|
|
3889
|
-
\u{1F381} Refer a friend \u2192
|
|
3899
|
+
\u{1F381} Refer a friend \u2192 they save $100, you earn $100 in crypto via CoinPayPortal
|
|
3890
3900
|
`));
|
|
3891
3901
|
} else {
|
|
3892
3902
|
console.log(source_default.green(`
|
|
@@ -3895,15 +3905,76 @@ async function emailGate() {
|
|
|
3895
3905
|
}
|
|
3896
3906
|
return true;
|
|
3897
3907
|
}
|
|
3908
|
+
function detectPackageManager() {
|
|
3909
|
+
try {
|
|
3910
|
+
const npmGlobal = (0, import_node_child_process.execSync)("npm ls -g --depth=0 --json 2>/dev/null", { encoding: "utf-8" });
|
|
3911
|
+
if (npmGlobal.includes(PKG_NAME)) return "npm";
|
|
3912
|
+
} catch {
|
|
3913
|
+
}
|
|
3914
|
+
try {
|
|
3915
|
+
(0, import_node_child_process.execSync)("pnpm --version", { stdio: "pipe" });
|
|
3916
|
+
return "pnpm";
|
|
3917
|
+
} catch {
|
|
3918
|
+
}
|
|
3919
|
+
try {
|
|
3920
|
+
(0, import_node_child_process.execSync)("yarn --version", { stdio: "pipe" });
|
|
3921
|
+
return "yarn";
|
|
3922
|
+
} catch {
|
|
3923
|
+
}
|
|
3924
|
+
try {
|
|
3925
|
+
(0, import_node_child_process.execSync)("bun --version", { stdio: "pipe" });
|
|
3926
|
+
return "bun";
|
|
3927
|
+
} catch {
|
|
3928
|
+
}
|
|
3929
|
+
return "npm";
|
|
3930
|
+
}
|
|
3898
3931
|
var program2 = new Command();
|
|
3899
|
-
program2.name("threatcrush").description(
|
|
3900
|
-
|
|
3901
|
-
|
|
3932
|
+
program2.name("threatcrush").description(
|
|
3933
|
+
`${source_default.green("\u26A1 ThreatCrush")} \u2014 All-in-one security agent
|
|
3934
|
+
|
|
3935
|
+
Monitor every connection on every port. Detect live attacks,
|
|
3936
|
+
scan your code, pentest your APIs, and alert you in real-time.
|
|
3937
|
+
|
|
3938
|
+
${source_default.dim("Website:")} ${source_default.green("https://threatcrush.com")}
|
|
3939
|
+
${source_default.dim("GitHub:")} ${source_default.green("https://github.com/profullstack/threatcrush")}
|
|
3940
|
+
${source_default.dim("npm:")} ${source_default.green("https://www.npmjs.com/package/@profullstack/threatcrush")}
|
|
3941
|
+
${source_default.dim("License:")} ${source_default.green("$499 lifetime")} (or $399 with referral)
|
|
3942
|
+
|
|
3943
|
+
${source_default.dim("Examples:")}
|
|
3944
|
+
${source_default.green("$")} threatcrush monitor ${source_default.dim("# Real-time monitoring")}
|
|
3945
|
+
${source_default.green("$")} threatcrush tui ${source_default.dim("# Interactive dashboard")}
|
|
3946
|
+
${source_default.green("$")} threatcrush scan ./src ${source_default.dim("# Scan code for vulns")}
|
|
3947
|
+
${source_default.green("$")} threatcrush pentest URL ${source_default.dim("# Pen test a URL")}
|
|
3948
|
+
${source_default.green("$")} threatcrush modules install ${source_default.dim("# Install a module")}
|
|
3949
|
+
${source_default.green("$")} threatcrush update ${source_default.dim("# Update to latest")}
|
|
3950
|
+
${source_default.green("$")} threatcrush remove ${source_default.dim("# Uninstall completely")}`
|
|
3951
|
+
).version(PKG_VERSION, "-v, --version", "Show version number").helpOption("-h, --help", "Show this help").addHelpText("after", `
|
|
3952
|
+
${source_default.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}
|
|
3953
|
+
${source_default.dim("Modules:")}
|
|
3954
|
+
ThreatCrush uses pluggable security modules. Core modules included:
|
|
3955
|
+
${source_default.green("network-monitor")} All TCP/UDP traffic, port scans, SYN floods
|
|
3956
|
+
${source_default.green("log-watcher")} nginx, Apache, syslog, journald
|
|
3957
|
+
${source_default.green("ssh-guard")} Failed logins, brute force, tunneling
|
|
3958
|
+
${source_default.green("code-scanner")} Vulnerabilities, secrets, dependency CVEs
|
|
3959
|
+
${source_default.green("pentest-engine")} SQLi, XSS, SSRF, API fuzzing
|
|
3960
|
+
${source_default.green("dns-monitor")} DNS tunneling, DGA detection
|
|
3961
|
+
${source_default.green("firewall-rules")} Auto-blocks via iptables/nftables
|
|
3962
|
+
${source_default.green("alert-system")} Slack, Discord, email, webhook, PagerDuty
|
|
3963
|
+
|
|
3964
|
+
Browse community modules: ${source_default.green("threatcrush store")}
|
|
3965
|
+
`);
|
|
3966
|
+
var gatedCommand = (name, desc, aliases) => {
|
|
3967
|
+
const cmd = program2.command(name).description(desc).action(async () => {
|
|
3902
3968
|
await emailGate();
|
|
3903
3969
|
});
|
|
3970
|
+
if (aliases) {
|
|
3971
|
+
for (const alias of aliases) {
|
|
3972
|
+
cmd.alias(alias);
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3904
3975
|
};
|
|
3905
3976
|
gatedCommand("monitor", "Real-time security monitoring (all ports, all protocols)");
|
|
3906
|
-
gatedCommand("tui", "Interactive security dashboard (htop for security)");
|
|
3977
|
+
gatedCommand("tui", "Interactive security dashboard (htop for security)", ["dashboard"]);
|
|
3907
3978
|
gatedCommand("init", "Auto-detect services and configure ThreatCrush");
|
|
3908
3979
|
gatedCommand("scan", "Scan codebase for vulnerabilities and secrets");
|
|
3909
3980
|
gatedCommand("pentest", "Penetration test URLs and APIs");
|
|
@@ -3911,16 +3982,94 @@ gatedCommand("status", "Show daemon status and loaded modules");
|
|
|
3911
3982
|
gatedCommand("start", "Start the ThreatCrush daemon");
|
|
3912
3983
|
gatedCommand("stop", "Stop the ThreatCrush daemon");
|
|
3913
3984
|
gatedCommand("logs", "Tail daemon logs");
|
|
3914
|
-
gatedCommand("update", "Update CLI and all installed modules");
|
|
3915
3985
|
gatedCommand("activate", "Activate your license key");
|
|
3916
|
-
program2.command("
|
|
3986
|
+
program2.command("update").description("Update ThreatCrush CLI and all installed modules").option("--cli", "Update CLI only").option("--modules", "Update modules only").action(async (opts) => {
|
|
3987
|
+
console.log(LOGO);
|
|
3988
|
+
if (opts.modules) {
|
|
3989
|
+
console.log(source_default.yellow(" Module updates coming soon.\n"));
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3992
|
+
const pm = detectPackageManager();
|
|
3993
|
+
console.log(source_default.dim(` Detected package manager: ${pm}
|
|
3994
|
+
`));
|
|
3995
|
+
const commands = {
|
|
3996
|
+
npm: `npm update -g ${PKG_NAME}`,
|
|
3997
|
+
pnpm: `pnpm update -g ${PKG_NAME}`,
|
|
3998
|
+
yarn: `yarn global upgrade ${PKG_NAME}`,
|
|
3999
|
+
bun: `bun update -g ${PKG_NAME}`
|
|
4000
|
+
};
|
|
4001
|
+
const cmd = commands[pm] || commands.npm;
|
|
4002
|
+
console.log(source_default.green(` \u2192 ${cmd}
|
|
4003
|
+
`));
|
|
4004
|
+
try {
|
|
4005
|
+
(0, import_node_child_process.execSync)(cmd, { stdio: "inherit" });
|
|
4006
|
+
console.log(source_default.green("\n \u2713 ThreatCrush updated successfully!\n"));
|
|
4007
|
+
try {
|
|
4008
|
+
const newVersion = (0, import_node_child_process.execSync)(`${pm === "npm" ? "npm" : pm} list -g ${PKG_NAME} --depth=0`, {
|
|
4009
|
+
encoding: "utf-8",
|
|
4010
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
4011
|
+
});
|
|
4012
|
+
const match = newVersion.match(/@[\d.]+/);
|
|
4013
|
+
if (match) {
|
|
4014
|
+
console.log(source_default.dim(` Version: ${match[0]}
|
|
4015
|
+
`));
|
|
4016
|
+
}
|
|
4017
|
+
} catch {
|
|
4018
|
+
}
|
|
4019
|
+
} catch (err) {
|
|
4020
|
+
console.log(source_default.red("\n \u2717 Update failed. Try manually:\n"));
|
|
4021
|
+
console.log(source_default.dim(` ${cmd}
|
|
4022
|
+
`));
|
|
4023
|
+
}
|
|
4024
|
+
});
|
|
4025
|
+
program2.command("remove").description("Uninstall ThreatCrush CLI completely").alias("uninstall").action(async () => {
|
|
4026
|
+
console.log(LOGO);
|
|
4027
|
+
const rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
4028
|
+
const confirm = await new Promise((resolve) => {
|
|
4029
|
+
rl.question(source_default.yellow(" Are you sure you want to uninstall ThreatCrush? (y/N): "), (answer) => {
|
|
4030
|
+
rl.close();
|
|
4031
|
+
resolve(answer.trim().toLowerCase());
|
|
4032
|
+
});
|
|
4033
|
+
});
|
|
4034
|
+
if (confirm !== "y" && confirm !== "yes") {
|
|
4035
|
+
console.log(source_default.dim("\n Cancelled.\n"));
|
|
4036
|
+
return;
|
|
4037
|
+
}
|
|
4038
|
+
const pm = detectPackageManager();
|
|
4039
|
+
console.log(source_default.dim(`
|
|
4040
|
+
Detected package manager: ${pm}
|
|
4041
|
+
`));
|
|
4042
|
+
const commands = {
|
|
4043
|
+
npm: `npm uninstall -g ${PKG_NAME}`,
|
|
4044
|
+
pnpm: `pnpm remove -g ${PKG_NAME}`,
|
|
4045
|
+
yarn: `yarn global remove ${PKG_NAME}`,
|
|
4046
|
+
bun: `bun remove -g ${PKG_NAME}`
|
|
4047
|
+
};
|
|
4048
|
+
const cmd = commands[pm] || commands.npm;
|
|
4049
|
+
console.log(source_default.green(` \u2192 ${cmd}
|
|
4050
|
+
`));
|
|
4051
|
+
try {
|
|
4052
|
+
(0, import_node_child_process.execSync)(cmd, { stdio: "inherit" });
|
|
4053
|
+
console.log(source_default.green("\n \u2713 ThreatCrush has been uninstalled.\n"));
|
|
4054
|
+
console.log(source_default.dim(" We're sorry to see you go! \u{1F44B}\n"));
|
|
4055
|
+
console.log(source_default.dim(" Config files may remain at /etc/threatcrush/"));
|
|
4056
|
+
console.log(source_default.dim(" Logs may remain at /var/log/threatcrush/"));
|
|
4057
|
+
console.log(source_default.dim(" State may remain at /var/lib/threatcrush/\n"));
|
|
4058
|
+
} catch (err) {
|
|
4059
|
+
console.log(source_default.red("\n \u2717 Uninstall failed. Try manually:\n"));
|
|
4060
|
+
console.log(source_default.dim(` ${cmd}
|
|
4061
|
+
`));
|
|
4062
|
+
}
|
|
4063
|
+
});
|
|
4064
|
+
program2.command("modules").description("Manage security modules").argument("[action]", "list | install | remove | available | update").argument("[name]", "module name").action(async () => {
|
|
3917
4065
|
await emailGate();
|
|
3918
4066
|
});
|
|
3919
4067
|
program2.command("store").description("Browse the module marketplace").argument("[action]", "search | info | publish").argument("[query]", "search query or module name").action(async () => {
|
|
3920
4068
|
await emailGate();
|
|
3921
4069
|
});
|
|
3922
|
-
program2.action(
|
|
3923
|
-
|
|
4070
|
+
program2.action(() => {
|
|
4071
|
+
console.log(LOGO);
|
|
4072
|
+
program2.help();
|
|
3924
4073
|
});
|
|
3925
4074
|
program2.parse();
|
|
3926
4075
|
//# sourceMappingURL=index.js.map
|