cantarella-framework 1.4.0 → 1.5.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/CHANGELOG.md +4 -0
- package/modules/bug-bounty-cvss-calculator/index.mjs +93 -0
- package/modules/bug-bounty-cvss-calculator/module.json +14 -0
- package/modules/wrapper-exiftool/index.mjs +41 -0
- package/modules/wrapper-exiftool/module.json +21 -0
- package/modules/wrapper-lynis/index.mjs +42 -0
- package/modules/wrapper-lynis/module.json +21 -0
- package/modules/wrapper-semgrep/index.mjs +45 -0
- package/modules/wrapper-semgrep/module.json +21 -0
- package/package.json +2 -2
- package/packages/cli/dist/cli.js +1 -1
- package/packages/gui/dist/server.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
- New modules: Lynis system audit, Semgrep static analysis, ExifTool metadata reader, and CVSS 3.1 base score calculator.
|
|
6
|
+
|
|
3
7
|
## 1.4.0
|
|
4
8
|
|
|
5
9
|
- New modules: Nuclei template scanning, Sherlock username search, httpx live host probing, and CISA KEV and EPSS vulnerability lookup.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
let input = "";
|
|
2
|
+
process.stdin.setEncoding("utf8");
|
|
3
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
4
|
+
process.stdin.on("end", () => {
|
|
5
|
+
const request = JSON.parse(input || "{}");
|
|
6
|
+
const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
7
|
+
try {
|
|
8
|
+
const result = calculate(String(request.target ?? ""));
|
|
9
|
+
emit({ type: "result", summary: result.summary, data: result.data });
|
|
10
|
+
emit({ type: "done", summary: `CVSS calculation finished: ${result.data.base_score} ${result.data.severity}.` });
|
|
11
|
+
} catch (error) {
|
|
12
|
+
emit({ type: "error", message: error.message });
|
|
13
|
+
process.exitCode = 1;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const AV = { N: 0.85, A: 0.62, L: 0.55, P: 0.2 };
|
|
18
|
+
const AC = { L: 0.77, H: 0.44 };
|
|
19
|
+
const PR_UNCHANGED = { N: 0.85, L: 0.62, H: 0.27 };
|
|
20
|
+
const PR_CHANGED = { N: 0.85, L: 0.68, H: 0.5 };
|
|
21
|
+
const UI = { N: 0.85, R: 0.62 };
|
|
22
|
+
const CIA = { N: 0, L: 0.22, H: 0.56 };
|
|
23
|
+
|
|
24
|
+
// Roundup as defined in the CVSS v3.1 specification: the smallest number,
|
|
25
|
+
// specified to one decimal place, that is equal to or higher than the input.
|
|
26
|
+
// The input is first rounded to five decimals so floating point noise
|
|
27
|
+
// cannot push an exact tenth over the edge.
|
|
28
|
+
function roundUp(value) {
|
|
29
|
+
const scaled = Math.round(value * 100000);
|
|
30
|
+
if (scaled % 10000 === 0) return scaled / 100000;
|
|
31
|
+
const floored = Math.floor(scaled / 10000) * 10000;
|
|
32
|
+
return (floored + 10000) / 100000;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function severityOf(score) {
|
|
36
|
+
if (score === 0) return "None";
|
|
37
|
+
if (score < 4.0) return "Low";
|
|
38
|
+
if (score < 7.0) return "Medium";
|
|
39
|
+
if (score < 9.0) return "High";
|
|
40
|
+
return "Critical";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function calculate(vector) {
|
|
44
|
+
const clean = vector.trim().replace(/^CVSS:3\.1\//i, "");
|
|
45
|
+
const metrics = {};
|
|
46
|
+
for (const part of clean.split("/")) {
|
|
47
|
+
const [key, value] = part.split(":");
|
|
48
|
+
if (key && value) metrics[key] = value;
|
|
49
|
+
}
|
|
50
|
+
const required = ["AV", "AC", "PR", "UI", "S", "C", "I", "A"];
|
|
51
|
+
for (const key of required) {
|
|
52
|
+
if (!metrics[key]) throw new Error(`Invalid CVSS vector: missing ${key}. Expected a CVSS:3.1 vector such as CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.`);
|
|
53
|
+
}
|
|
54
|
+
const scopeChanged = metrics.S === "C";
|
|
55
|
+
if (metrics.S !== "U" && !scopeChanged) throw new Error(`Invalid CVSS vector: unknown scope ${metrics.S}.`);
|
|
56
|
+
const lookup = (table, value, name) => {
|
|
57
|
+
if (!(value in table)) throw new Error(`Invalid CVSS vector: unknown ${name} value ${value}.`);
|
|
58
|
+
return table[value];
|
|
59
|
+
};
|
|
60
|
+
const av = lookup(AV, metrics.AV, "AV");
|
|
61
|
+
const ac = lookup(AC, metrics.AC, "AC");
|
|
62
|
+
const pr = lookup(scopeChanged ? PR_CHANGED : PR_UNCHANGED, metrics.PR, "PR");
|
|
63
|
+
const ui = lookup(UI, metrics.UI, "UI");
|
|
64
|
+
const c = lookup(CIA, metrics.C, "C");
|
|
65
|
+
const i = lookup(CIA, metrics.I, "I");
|
|
66
|
+
const a = lookup(CIA, metrics.A, "A");
|
|
67
|
+
|
|
68
|
+
const iss = 1 - (1 - c) * (1 - i) * (1 - a);
|
|
69
|
+
let impact;
|
|
70
|
+
if (!scopeChanged) {
|
|
71
|
+
impact = 6.42 * iss;
|
|
72
|
+
} else {
|
|
73
|
+
impact = 7.52 * (iss - 0.029) - 3.25 * Math.pow(iss * 0.9731 - 0.02, 13);
|
|
74
|
+
}
|
|
75
|
+
let baseScore = 0;
|
|
76
|
+
if (impact > 0) {
|
|
77
|
+
const exploitability = 8.22 * av * ac * pr * ui;
|
|
78
|
+
baseScore = scopeChanged
|
|
79
|
+
? roundUp(Math.min(1.08 * (impact + exploitability), 10))
|
|
80
|
+
: roundUp(Math.min(impact + exploitability, 10));
|
|
81
|
+
}
|
|
82
|
+
const severity = severityOf(baseScore);
|
|
83
|
+
return {
|
|
84
|
+
summary: `CVSS:3.1 base score ${baseScore.toFixed(1)} ${severity} for ${vector.trim()}.`,
|
|
85
|
+
data: {
|
|
86
|
+
vector: vector.trim(),
|
|
87
|
+
base_score: baseScore,
|
|
88
|
+
severity,
|
|
89
|
+
scope_changed: scopeChanged,
|
|
90
|
+
impact: Math.round(impact * 10000) / 10000,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "bug-bounty",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Calculates the CVSS 3.1 base score and severity for a vector string.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"id": "bug-bounty/cvss-calculator",
|
|
7
|
+
"kind": "native",
|
|
8
|
+
"maintenance": "active",
|
|
9
|
+
"name": "CVSS Calculator",
|
|
10
|
+
"options": [],
|
|
11
|
+
"risk": "info",
|
|
12
|
+
"schema_version": 1,
|
|
13
|
+
"version": "0.1.0"
|
|
14
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
let input = "";
|
|
4
|
+
process.stdin.setEncoding("utf8");
|
|
5
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
6
|
+
process.stdin.on("end", () => {
|
|
7
|
+
const request = JSON.parse(input || "{}");
|
|
8
|
+
const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
9
|
+
const target = String(request.target ?? "");
|
|
10
|
+
const child = spawn("exiftool", ["-json", target], { stdio: ["ignore", "pipe", "pipe"] });
|
|
11
|
+
let stdout = "";
|
|
12
|
+
let stderr = "";
|
|
13
|
+
child.stdout.on("data", (chunk) => (stdout += chunk));
|
|
14
|
+
child.stderr.on("data", (chunk) => (stderr += chunk));
|
|
15
|
+
child.on("error", (error) => {
|
|
16
|
+
emit({ type: "error", message: `ExifTool failed: ${error.message}` });
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
});
|
|
19
|
+
child.on("close", (code) => {
|
|
20
|
+
let tags = null;
|
|
21
|
+
try {
|
|
22
|
+
const parsed = JSON.parse(stdout || "[]");
|
|
23
|
+
tags = Array.isArray(parsed) && parsed.length ? parsed[0] : null;
|
|
24
|
+
} catch {
|
|
25
|
+
tags = null;
|
|
26
|
+
}
|
|
27
|
+
if (code !== 0 || !tags) {
|
|
28
|
+
emit({ type: "error", message: `ExifTool failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
29
|
+
process.exitCode = 1;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const { SourceFile, ...rest } = tags;
|
|
33
|
+
const tagCount = Object.keys(rest).length;
|
|
34
|
+
emit({
|
|
35
|
+
type: "result",
|
|
36
|
+
summary: `ExifTool reported ${tagCount} tags for ${SourceFile ?? target}.`,
|
|
37
|
+
data: { source_file: SourceFile ?? target, tags: rest },
|
|
38
|
+
});
|
|
39
|
+
emit({ type: "done", summary: `ExifTool finished: ${tagCount} tags.` });
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "forensics",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Reads file metadata with ExifTool and reports the tags found.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "exiftool",
|
|
9
|
+
"install_hint": "Install exiftool from your distribution packages.",
|
|
10
|
+
"name": "ExifTool"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "forensics/exiftool",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "ExifTool",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "info",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
let input = "";
|
|
4
|
+
process.stdin.setEncoding("utf8");
|
|
5
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
6
|
+
process.stdin.on("end", () => {
|
|
7
|
+
const request = JSON.parse(input || "{}");
|
|
8
|
+
const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
9
|
+
const child = spawn("lynis", ["audit", "system", "--quiet"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
10
|
+
let stdout = "";
|
|
11
|
+
let stderr = "";
|
|
12
|
+
child.stdout.on("data", (chunk) => (stdout += chunk));
|
|
13
|
+
child.stderr.on("data", (chunk) => (stderr += chunk));
|
|
14
|
+
child.on("error", (error) => {
|
|
15
|
+
emit({ type: "error", message: `Lynis failed: ${error.message}` });
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
});
|
|
18
|
+
child.on("close", (code) => {
|
|
19
|
+
const plain = stdout.replace(/\x1b\[[0-9;]*m/g, "");
|
|
20
|
+
const findings = [];
|
|
21
|
+
for (const line of plain.split("\n")) {
|
|
22
|
+
const trimmed = line.trim();
|
|
23
|
+
const warning = trimmed.match(/^\[ WARNING \]\s*(.+)$/);
|
|
24
|
+
const suggestion = trimmed.match(/^\[ SUGGESTION \]\s*(.+)$/);
|
|
25
|
+
if (warning) findings.push({ level: "warning", text: warning[1].trim() });
|
|
26
|
+
else if (suggestion) findings.push({ level: "suggestion", text: suggestion[1].trim() });
|
|
27
|
+
}
|
|
28
|
+
if (code !== 0 && !findings.length) {
|
|
29
|
+
emit({ type: "error", message: `Lynis failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
30
|
+
process.exitCode = 1;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const warnings = findings.filter((finding) => finding.level === "warning").length;
|
|
34
|
+
const suggestions = findings.length - warnings;
|
|
35
|
+
emit({
|
|
36
|
+
type: "result",
|
|
37
|
+
summary: `Lynis reported ${warnings} warnings and ${suggestions} suggestions.`,
|
|
38
|
+
data: { warnings, suggestions, findings: findings.slice(0, 200) },
|
|
39
|
+
});
|
|
40
|
+
emit({ type: "done", summary: `Lynis audit finished: ${findings.length} findings.` });
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "blue-team",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Runs a Lynis system audit and reports warnings and suggestions.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "lynis",
|
|
9
|
+
"install_hint": "Install lynis from your distribution packages.",
|
|
10
|
+
"name": "Lynis"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "blue-team/lynis",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "Lynis",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "low",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
let input = "";
|
|
4
|
+
process.stdin.setEncoding("utf8");
|
|
5
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
6
|
+
process.stdin.on("end", () => {
|
|
7
|
+
const request = JSON.parse(input || "{}");
|
|
8
|
+
const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
9
|
+
const target = String(request.target ?? "");
|
|
10
|
+
const child = spawn("semgrep", ["--config", "auto", "--json", target], { stdio: ["ignore", "pipe", "pipe"] });
|
|
11
|
+
let stdout = "";
|
|
12
|
+
let stderr = "";
|
|
13
|
+
child.stdout.on("data", (chunk) => (stdout += chunk));
|
|
14
|
+
child.stderr.on("data", (chunk) => (stderr += chunk));
|
|
15
|
+
child.on("error", (error) => {
|
|
16
|
+
emit({ type: "error", message: `Semgrep failed: ${error.message}` });
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
});
|
|
19
|
+
child.on("close", (code) => {
|
|
20
|
+
let findings = [];
|
|
21
|
+
try {
|
|
22
|
+
const parsed = JSON.parse(stdout || "{}");
|
|
23
|
+
findings = (parsed.results ?? []).map((result) => ({
|
|
24
|
+
check_id: result.check_id ?? "",
|
|
25
|
+
path: result.path ?? "",
|
|
26
|
+
line: result.start?.line ?? null,
|
|
27
|
+
severity: result.extra?.severity ?? "",
|
|
28
|
+
message: result.extra?.message ?? "",
|
|
29
|
+
}));
|
|
30
|
+
} catch {
|
|
31
|
+
// Unparseable output is treated as no findings; raw output is kept as evidence.
|
|
32
|
+
}
|
|
33
|
+
if (code !== 0 && !findings.length) {
|
|
34
|
+
emit({ type: "error", message: `Semgrep failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
emit({
|
|
39
|
+
type: "result",
|
|
40
|
+
summary: `Semgrep reported ${findings.length} findings in ${target}.`,
|
|
41
|
+
data: { target, findings: findings.slice(0, 200) },
|
|
42
|
+
});
|
|
43
|
+
emit({ type: "done", summary: `Semgrep scan finished: ${findings.length} findings.` });
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "code-audit",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Runs Semgrep static analysis against a target path and reports findings.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "semgrep",
|
|
9
|
+
"install_hint": "Install semgrep from your distribution packages or with pipx install semgrep.",
|
|
10
|
+
"name": "Semgrep"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "code-audit/semgrep",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "Semgrep",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "low",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"release:notes": "node scripts/release-notes.mjs"
|
|
20
20
|
},
|
|
21
21
|
"type": "module",
|
|
22
|
-
"version": "1.
|
|
22
|
+
"version": "1.5.0",
|
|
23
23
|
"workspaces": [
|
|
24
24
|
"packages/*"
|
|
25
25
|
],
|
|
@@ -56,4 +56,4 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"license": "Apache-2.0"
|
|
59
|
-
}
|
|
59
|
+
}
|
package/packages/cli/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ process.stdout.on("error", (error) => {
|
|
|
11
11
|
process.exit(0);
|
|
12
12
|
throw error;
|
|
13
13
|
});
|
|
14
|
-
const VERSION = "1.
|
|
14
|
+
const VERSION = "1.5.0";
|
|
15
15
|
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
|
|
16
16
|
function banner() {
|
|
17
17
|
return (process.stdout.columns ?? 80) >= 72 ? BANNER : COMPACT_BANNER;
|
|
@@ -78,8 +78,8 @@ export function createGuiServer(root) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
sendJson(response, 200, {
|
|
81
|
-
version: "1.
|
|
82
|
-
update_message: (await checkForUpdate("1.
|
|
81
|
+
version: "1.5.0",
|
|
82
|
+
update_message: (await checkForUpdate("1.5.0")).message,
|
|
83
83
|
categories: CATEGORIES,
|
|
84
84
|
modules: modules.map(({ manifest }) => manifest),
|
|
85
85
|
external_tools: [...tools.values()],
|