cantarella-framework 1.19.0 → 1.20.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/incident-response-velociraptor-import/index.mjs +48 -0
- package/modules/incident-response-velociraptor-import/module.json +14 -0
- package/modules/reporting-docx-export/index.mjs +145 -0
- package/modules/reporting-docx-export/module.json +14 -0
- package/modules/reporting-pdf-export/index.mjs +88 -0
- package/modules/reporting-pdf-export/module.json +14 -0
- package/modules/vuln-management-qualys-import/index.mjs +46 -0
- package/modules/vuln-management-qualys-import/module.json +14 -0
- package/modules/wrapper-auditd/index.mjs +45 -0
- package/modules/wrapper-auditd/module.json +21 -0
- package/modules/wrapper-beef/index.mjs +35 -0
- package/modules/wrapper-beef/module.json +21 -0
- package/modules/wrapper-chainsaw/index.mjs +54 -0
- package/modules/wrapper-chainsaw/module.json +21 -0
- package/modules/wrapper-covenant/index.mjs +35 -0
- package/modules/wrapper-covenant/module.json +21 -0
- package/modules/wrapper-foremost/index.mjs +57 -0
- package/modules/wrapper-foremost/module.json +21 -0
- package/modules/wrapper-hayabusa/index.mjs +55 -0
- package/modules/wrapper-hayabusa/module.json +21 -0
- package/modules/wrapper-mythic/index.mjs +42 -0
- package/modules/wrapper-mythic/module.json +21 -0
- package/modules/wrapper-openscap/index.mjs +47 -0
- package/modules/wrapper-openscap/module.json +28 -0
- package/modules/wrapper-sigma/index.mjs +34 -0
- package/modules/wrapper-sigma/module.json +28 -0
- package/modules/wrapper-sliver/index.mjs +35 -0
- package/modules/wrapper-sliver/module.json +21 -0
- package/package.json +1 -1
- 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.20.0
|
|
4
|
+
|
|
5
|
+
- New modules: Foremost file carving, Sigma rule conversion, Hayabusa timeline building, Chainsaw threat hunting, Velociraptor export import, Qualys report import, OpenSCAP compliance evaluation, ausearch audit log search, DOCX export, PDF export, BeEF version check, Sliver version check, Covenant version check, and Mythic status check. All tools named in the concept map are now covered.
|
|
6
|
+
|
|
3
7
|
## 1.19.0
|
|
4
8
|
|
|
5
9
|
- New modules: Recon-ng module search, MobSF report import, BloodHound export import, ScoutSuite AWS auditing, CloudSploit cloud checks, kube-hunter Kubernetes hunting, Grype vulnerability scanning, Syft package inventory, tfsec Terraform checks, TruffleHog secret scanning, CodeQL SARIF import, ESLint code linting, ripgrep code search, and Autopsy report import.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
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
|
+
try {
|
|
10
|
+
const result = build(String(request.target ?? ""));
|
|
11
|
+
emit({ type: "result", summary: result.summary, data: result.data });
|
|
12
|
+
emit({ type: "done", summary: `Velociraptor import finished: ${result.data.rows} rows.` });
|
|
13
|
+
} catch (error) {
|
|
14
|
+
emit({ type: "error", message: error.message });
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function build(target) {
|
|
20
|
+
let raw;
|
|
21
|
+
try {
|
|
22
|
+
raw = readFileSync(target, "utf8");
|
|
23
|
+
} catch {
|
|
24
|
+
throw new Error(`Cannot read Velociraptor export file: ${target}.`);
|
|
25
|
+
}
|
|
26
|
+
const trimmed = raw.trim();
|
|
27
|
+
if (trimmed.startsWith("[")) {
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = JSON.parse(trimmed);
|
|
31
|
+
} catch {
|
|
32
|
+
throw new Error(`Invalid Velociraptor export file: ${target} is not valid JSON.`);
|
|
33
|
+
}
|
|
34
|
+
if (!Array.isArray(parsed)) throw new Error(`Invalid Velociraptor export file: ${target} is not a JSON array.`);
|
|
35
|
+
const columns = parsed.length > 0 ? Object.keys(parsed[0]) : [];
|
|
36
|
+
return {
|
|
37
|
+
summary: `Velociraptor import read ${parsed.length} rows from ${target}.`,
|
|
38
|
+
data: { source: target, format: "json", rows: parsed.length, columns, sample: parsed.slice(0, 5) },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const lines = trimmed.split("\n").filter((line) => line.trim());
|
|
42
|
+
if (!lines.length) throw new Error(`No rows found in ${target}.`);
|
|
43
|
+
const columns = lines[0].split(",").map((cell) => cell.trim());
|
|
44
|
+
return {
|
|
45
|
+
summary: `Velociraptor import read ${lines.length - 1} rows from ${target}.`,
|
|
46
|
+
data: { source: target, format: "csv", rows: Math.max(0, lines.length - 1), columns },
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "incident-response",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Imports rows from a Velociraptor query export and reports what it contains.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"id": "incident-response/velociraptor-import",
|
|
7
|
+
"kind": "native",
|
|
8
|
+
"maintenance": "active",
|
|
9
|
+
"name": "Velociraptor Import",
|
|
10
|
+
"options": [],
|
|
11
|
+
"risk": "info",
|
|
12
|
+
"schema_version": 1,
|
|
13
|
+
"version": "0.1.0"
|
|
14
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { deflateRawSync } from "node:zlib";
|
|
3
|
+
|
|
4
|
+
let input = "";
|
|
5
|
+
process.stdin.setEncoding("utf8");
|
|
6
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
7
|
+
process.stdin.on("end", () => {
|
|
8
|
+
const request = JSON.parse(input || "{}");
|
|
9
|
+
const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
10
|
+
try {
|
|
11
|
+
const result = build(String(request.target ?? ""));
|
|
12
|
+
emit({ type: "result", summary: result.summary, data: result.data });
|
|
13
|
+
emit({ type: "done", summary: `DOCX export finished: ${result.data.events} events.` });
|
|
14
|
+
} catch (error) {
|
|
15
|
+
emit({ type: "error", message: error.message });
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const CRC_TABLE = (() => {
|
|
21
|
+
const table = new Int32Array(256);
|
|
22
|
+
for (let n = 0; n < 256; n += 1) {
|
|
23
|
+
let c = n;
|
|
24
|
+
for (let k = 0; k < 8; k += 1) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
25
|
+
table[n] = c;
|
|
26
|
+
}
|
|
27
|
+
return table;
|
|
28
|
+
})();
|
|
29
|
+
|
|
30
|
+
function crc32(buffer) {
|
|
31
|
+
let c = 0xffffffff;
|
|
32
|
+
for (const byte of buffer) c = CRC_TABLE[(c ^ byte) & 0xff] ^ (c >>> 8);
|
|
33
|
+
return (c ^ 0xffffffff) >>> 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function zipEntry(name, data, offset) {
|
|
37
|
+
const compressed = deflateRawSync(data);
|
|
38
|
+
const crc = crc32(data);
|
|
39
|
+
const nameBuffer = Buffer.from(name, "utf8");
|
|
40
|
+
const local = Buffer.alloc(30);
|
|
41
|
+
local.writeUInt32LE(0x04034b50, 0);
|
|
42
|
+
local.writeUInt16LE(20, 4);
|
|
43
|
+
local.writeUInt16LE(0, 6);
|
|
44
|
+
local.writeUInt16LE(8, 8);
|
|
45
|
+
local.writeUInt16LE(0, 10);
|
|
46
|
+
local.writeUInt16LE(0, 12);
|
|
47
|
+
local.writeUInt32LE(crc, 14);
|
|
48
|
+
local.writeUInt32LE(compressed.length, 18);
|
|
49
|
+
local.writeUInt32LE(data.length, 22);
|
|
50
|
+
local.writeUInt16LE(nameBuffer.length, 26);
|
|
51
|
+
local.writeUInt16LE(0, 28);
|
|
52
|
+
const central = Buffer.alloc(46);
|
|
53
|
+
central.writeUInt32LE(0x02014b50, 0);
|
|
54
|
+
central.writeUInt16LE(20, 4);
|
|
55
|
+
central.writeUInt16LE(20, 6);
|
|
56
|
+
central.writeUInt16LE(0, 8);
|
|
57
|
+
central.writeUInt16LE(8, 10);
|
|
58
|
+
central.writeUInt16LE(0, 12);
|
|
59
|
+
central.writeUInt16LE(0, 14);
|
|
60
|
+
central.writeUInt32LE(crc, 16);
|
|
61
|
+
central.writeUInt32LE(compressed.length, 20);
|
|
62
|
+
central.writeUInt32LE(data.length, 24);
|
|
63
|
+
central.writeUInt16LE(nameBuffer.length, 28);
|
|
64
|
+
central.writeUInt16LE(0, 30);
|
|
65
|
+
central.writeUInt16LE(0, 32);
|
|
66
|
+
central.writeUInt16LE(0, 34);
|
|
67
|
+
central.writeUInt16LE(0, 36);
|
|
68
|
+
central.writeUInt32LE(0, 38);
|
|
69
|
+
central.writeUInt32LE(offset, 42);
|
|
70
|
+
return {
|
|
71
|
+
local: Buffer.concat([local, nameBuffer, compressed]),
|
|
72
|
+
central: Buffer.concat([central, nameBuffer]),
|
|
73
|
+
size: 30 + nameBuffer.length + compressed.length,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function escapeXml(value) {
|
|
78
|
+
return String(value ?? "")
|
|
79
|
+
.replace(/&/g, "&")
|
|
80
|
+
.replace(/</g, "<")
|
|
81
|
+
.replace(/>/g, ">");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function buildDocx(paragraphs) {
|
|
85
|
+
const body = paragraphs
|
|
86
|
+
.map((paragraph) => `<w:p><w:r><w:t>${escapeXml(paragraph)}</w:t></w:r></w:p>`)
|
|
87
|
+
.join("");
|
|
88
|
+
const documentXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body>${body}</w:body></w:document>`;
|
|
89
|
+
const contentTypes = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/></Types>`;
|
|
90
|
+
const rels = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/></Relationships>`;
|
|
91
|
+
const files = [
|
|
92
|
+
["[Content_Types].xml", Buffer.from(contentTypes, "utf8")],
|
|
93
|
+
["_rels/.rels", Buffer.from(rels, "utf8")],
|
|
94
|
+
["word/document.xml", Buffer.from(documentXml, "utf8")],
|
|
95
|
+
];
|
|
96
|
+
const locals = [];
|
|
97
|
+
const centrals = [];
|
|
98
|
+
let offset = 0;
|
|
99
|
+
for (const [name, data] of files) {
|
|
100
|
+
const entry = zipEntry(name, data, offset);
|
|
101
|
+
locals.push(entry.local);
|
|
102
|
+
centrals.push(entry.central);
|
|
103
|
+
offset += entry.size;
|
|
104
|
+
}
|
|
105
|
+
const centralDir = Buffer.concat(centrals);
|
|
106
|
+
const end = Buffer.alloc(22);
|
|
107
|
+
end.writeUInt32LE(0x06054b50, 0);
|
|
108
|
+
end.writeUInt16LE(0, 4);
|
|
109
|
+
end.writeUInt16LE(0, 6);
|
|
110
|
+
end.writeUInt16LE(files.length, 8);
|
|
111
|
+
end.writeUInt16LE(files.length, 10);
|
|
112
|
+
end.writeUInt32LE(centralDir.length, 12);
|
|
113
|
+
end.writeUInt32LE(offset, 16);
|
|
114
|
+
end.writeUInt16LE(0, 20);
|
|
115
|
+
return Buffer.concat([...locals, centralDir, end]);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function build(target) {
|
|
119
|
+
let raw;
|
|
120
|
+
try {
|
|
121
|
+
raw = readFileSync(target, "utf8");
|
|
122
|
+
} catch {
|
|
123
|
+
throw new Error(`Cannot read results file: ${target}.`);
|
|
124
|
+
}
|
|
125
|
+
let parsed;
|
|
126
|
+
try {
|
|
127
|
+
parsed = JSON.parse(raw);
|
|
128
|
+
} catch {
|
|
129
|
+
throw new Error(`Invalid results file: ${target} is not valid JSON.`);
|
|
130
|
+
}
|
|
131
|
+
const events = Array.isArray(parsed.events) ? parsed.events : [];
|
|
132
|
+
const paragraphs = [`Cantarella Report: ${parsed.module?.id ?? "unknown"}`];
|
|
133
|
+
let count = 0;
|
|
134
|
+
for (const event of events) {
|
|
135
|
+
if (event.type !== "result" && event.type !== "error") continue;
|
|
136
|
+
const text = event.type === "result" ? (event.summary ?? "") : (event.message ?? "");
|
|
137
|
+
paragraphs.push(`[${event.type}] ${text}`);
|
|
138
|
+
count += 1;
|
|
139
|
+
}
|
|
140
|
+
const docx = buildDocx(paragraphs);
|
|
141
|
+
return {
|
|
142
|
+
summary: `DOCX export built: ${count} events from ${target}.`,
|
|
143
|
+
data: { source: target, events: count, docx: docx.toString("base64") },
|
|
144
|
+
};
|
|
145
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "reporting",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Converts a Cantarella run results file into a Word document.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"id": "reporting/docx-export",
|
|
7
|
+
"kind": "native",
|
|
8
|
+
"maintenance": "active",
|
|
9
|
+
"name": "DOCX Export",
|
|
10
|
+
"options": [],
|
|
11
|
+
"risk": "info",
|
|
12
|
+
"schema_version": 1,
|
|
13
|
+
"version": "0.1.0"
|
|
14
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
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
|
+
try {
|
|
10
|
+
const result = build(String(request.target ?? ""));
|
|
11
|
+
emit({ type: "result", summary: result.summary, data: result.data });
|
|
12
|
+
emit({ type: "done", summary: `PDF export finished: ${result.data.events} events.` });
|
|
13
|
+
} catch (error) {
|
|
14
|
+
emit({ type: "error", message: error.message });
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function escapePdf(value) {
|
|
20
|
+
return String(value ?? "")
|
|
21
|
+
.replace(/\\/g, "\\\\")
|
|
22
|
+
.replace(/\(/g, "\\(")
|
|
23
|
+
.replace(/\)/g, "\\)");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function buildPdf(lines) {
|
|
27
|
+
const contentLines = [];
|
|
28
|
+
let y = 750;
|
|
29
|
+
for (const line of lines.slice(0, 40)) {
|
|
30
|
+
contentLines.push(`BT /F1 11 Tf 40 ${y} Td (${escapePdf(line)}) Tj ET`);
|
|
31
|
+
y -= 16;
|
|
32
|
+
}
|
|
33
|
+
const content = contentLines.join("\n");
|
|
34
|
+
const contentBuffer = Buffer.from(content, "utf8");
|
|
35
|
+
const objects = [
|
|
36
|
+
"<< /Type /Catalog /Pages 2 0 R >>",
|
|
37
|
+
"<< /Type /Pages /Kids [3 0 R] /Count 1 >>",
|
|
38
|
+
"<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Resources << /Font << /F1 5 0 R >> >> /Contents 4 0 R >>",
|
|
39
|
+
`<< /Length ${contentBuffer.length} >>\nstream\n${content}\nendstream`,
|
|
40
|
+
"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>",
|
|
41
|
+
];
|
|
42
|
+
const parts = [Buffer.from("%PDF-1.4\n", "utf8")];
|
|
43
|
+
const offsets = [0];
|
|
44
|
+
let offset = parts[0].length;
|
|
45
|
+
objects.forEach((object, index) => {
|
|
46
|
+
const body = Buffer.from(`${index + 1} 0 obj\n${object}\nendobj\n`, "utf8");
|
|
47
|
+
offsets.push(offset);
|
|
48
|
+
parts.push(body);
|
|
49
|
+
offset += body.length;
|
|
50
|
+
});
|
|
51
|
+
const xrefOffset = offset;
|
|
52
|
+
let xref = `xref\n0 ${objects.length + 1}\n0000000000 65535 f \n`;
|
|
53
|
+
for (let index = 1; index <= objects.length; index += 1) {
|
|
54
|
+
xref += `${String(offsets[index]).padStart(10, "0")} 00000 n \n`;
|
|
55
|
+
}
|
|
56
|
+
xref += `trailer\n<< /Size ${objects.length + 1} /Root 1 0 R >>\nstartxref\n${xrefOffset}\n%%EOF`;
|
|
57
|
+
parts.push(Buffer.from(xref, "utf8"));
|
|
58
|
+
return Buffer.concat(parts);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function build(target) {
|
|
62
|
+
let raw;
|
|
63
|
+
try {
|
|
64
|
+
raw = readFileSync(target, "utf8");
|
|
65
|
+
} catch {
|
|
66
|
+
throw new Error(`Cannot read results file: ${target}.`);
|
|
67
|
+
}
|
|
68
|
+
let parsed;
|
|
69
|
+
try {
|
|
70
|
+
parsed = JSON.parse(raw);
|
|
71
|
+
} catch {
|
|
72
|
+
throw new Error(`Invalid results file: ${target} is not valid JSON.`);
|
|
73
|
+
}
|
|
74
|
+
const events = Array.isArray(parsed.events) ? parsed.events : [];
|
|
75
|
+
const lines = [`Cantarella Report: ${parsed.module?.id ?? "unknown"}`];
|
|
76
|
+
let count = 0;
|
|
77
|
+
for (const event of events) {
|
|
78
|
+
if (event.type !== "result" && event.type !== "error") continue;
|
|
79
|
+
const text = event.type === "result" ? (event.summary ?? "") : (event.message ?? "");
|
|
80
|
+
lines.push(`[${event.type}] ${text}`);
|
|
81
|
+
count += 1;
|
|
82
|
+
}
|
|
83
|
+
const pdf = buildPdf(lines);
|
|
84
|
+
return {
|
|
85
|
+
summary: `PDF export built: ${count} events from ${target}.`,
|
|
86
|
+
data: { source: target, events: count, pdf: pdf.toString("base64") },
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "reporting",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Converts a Cantarella run results file into a PDF document.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"id": "reporting/pdf-export",
|
|
7
|
+
"kind": "native",
|
|
8
|
+
"maintenance": "active",
|
|
9
|
+
"name": "PDF Export",
|
|
10
|
+
"options": [],
|
|
11
|
+
"risk": "info",
|
|
12
|
+
"schema_version": 1,
|
|
13
|
+
"version": "0.1.0"
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
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
|
+
try {
|
|
10
|
+
const result = build(String(request.target ?? ""));
|
|
11
|
+
emit({ type: "result", summary: result.summary, data: result.data });
|
|
12
|
+
emit({ type: "done", summary: `Qualys import finished: ${result.data.vulnerabilities.length} vulnerabilities.` });
|
|
13
|
+
} catch (error) {
|
|
14
|
+
emit({ type: "error", message: error.message });
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function field(block, tag) {
|
|
20
|
+
const match = block.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`));
|
|
21
|
+
return match ? match[1].trim() : "";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function build(target) {
|
|
25
|
+
let raw;
|
|
26
|
+
try {
|
|
27
|
+
raw = readFileSync(target, "utf8");
|
|
28
|
+
} catch {
|
|
29
|
+
throw new Error(`Cannot read Qualys report file: ${target}.`);
|
|
30
|
+
}
|
|
31
|
+
const hosts = [];
|
|
32
|
+
const ipMatches = raw.match(/<IP>([\s\S]*?)<\/IP>/g) ?? [];
|
|
33
|
+
for (const ipMatch of ipMatches) {
|
|
34
|
+
const value = ipMatch.replace(/<\/?IP>/g, "").trim();
|
|
35
|
+
if (value) hosts.push(value);
|
|
36
|
+
}
|
|
37
|
+
const vulnerabilities = [];
|
|
38
|
+
const blocks = raw.match(/<VULN_INFO>[\s\S]*?<\/VULN_INFO>/g) ?? [];
|
|
39
|
+
for (const block of blocks) {
|
|
40
|
+
vulnerabilities.push({ qid: field(block, "QID"), severity: field(block, "SEVERITY") });
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
summary: `Qualys import read ${hosts.length} hosts and ${vulnerabilities.length} vulnerabilities from ${target}.`,
|
|
44
|
+
data: { source: target, hosts, vulnerabilities: vulnerabilities.slice(0, 100) },
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "vuln-management",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Imports hosts and vulnerabilities from a Qualys XML report and reports them.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"id": "vuln-management/qualys-import",
|
|
7
|
+
"kind": "native",
|
|
8
|
+
"maintenance": "active",
|
|
9
|
+
"name": "Qualys Import",
|
|
10
|
+
"options": [],
|
|
11
|
+
"risk": "info",
|
|
12
|
+
"schema_version": 1,
|
|
13
|
+
"version": "0.1.0"
|
|
14
|
+
}
|
|
@@ -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("ausearch", ["-k", 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: `ausearch failed: ${error.message}` });
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
});
|
|
19
|
+
child.on("close", (code) => {
|
|
20
|
+
const plain = stdout.replace(/\x1b\[[0-9;]*m/g, "");
|
|
21
|
+
let records = 0;
|
|
22
|
+
const types = new Set();
|
|
23
|
+
for (const line of plain.split("\n")) {
|
|
24
|
+
const trimmed = line.trim();
|
|
25
|
+
if (!trimmed) continue;
|
|
26
|
+
if (trimmed === "----") {
|
|
27
|
+
records += 1;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const match = trimmed.match(/^type=(\S+)/);
|
|
31
|
+
if (match) types.add(match[1]);
|
|
32
|
+
}
|
|
33
|
+
if (code !== 0 && !records && !plain.trim()) {
|
|
34
|
+
emit({ type: "error", message: `ausearch failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
emit({
|
|
39
|
+
type: "result",
|
|
40
|
+
summary: `ausearch found ${records} records for key ${target}.`,
|
|
41
|
+
data: { target, records, types: [...types].sort() },
|
|
42
|
+
});
|
|
43
|
+
emit({ type: "done", summary: `ausearch finished: ${records} records.` });
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "blue-team",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Searches the audit log for a key with ausearch and reports the matching records.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "ausearch",
|
|
9
|
+
"install_hint": "Install ausearch from your distribution packages (auditd).",
|
|
10
|
+
"name": "ausearch"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "blue-team/auditd",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "ausearch",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "low",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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("beef", ["--version"], { 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: `BeEF failed: ${error.message}` });
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
});
|
|
19
|
+
child.on("close", (code) => {
|
|
20
|
+
const plain = stdout.replace(/\x1b\[[0-9;]*m/g, "");
|
|
21
|
+
const match = plain.match(/(\d+\.\d+\.\d+(?:\.\d+)?)/);
|
|
22
|
+
const version = match ? match[1] : "";
|
|
23
|
+
if (code !== 0 && !version && !plain.trim()) {
|
|
24
|
+
emit({ type: "error", message: `BeEF failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
emit({
|
|
29
|
+
type: "result",
|
|
30
|
+
summary: version ? `BeEF version ${version} is installed.` : "BeEF is installed.",
|
|
31
|
+
data: { target, version },
|
|
32
|
+
});
|
|
33
|
+
emit({ type: "done", summary: version ? `BeEF finished: version ${version}.` : "BeEF finished." });
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "exploitation",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Checks the installed BeEF version and reports it.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "beef",
|
|
9
|
+
"install_hint": "Install BeEF from your distribution packages or the BeEF repository.",
|
|
10
|
+
"name": "BeEF"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "exploitation/beef",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "BeEF",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "high",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { mkdtemp, readdir, readFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
let input = "";
|
|
7
|
+
process.stdin.setEncoding("utf8");
|
|
8
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
9
|
+
process.stdin.on("end", async () => {
|
|
10
|
+
const request = JSON.parse(input || "{}");
|
|
11
|
+
const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
12
|
+
const target = String(request.target ?? "");
|
|
13
|
+
const dir = await mkdtemp(join(tmpdir(), "cantarella-chainsaw-"));
|
|
14
|
+
const child = spawn("chainsaw", ["hunt", target, "--output", dir, "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
15
|
+
let stdout = "";
|
|
16
|
+
let stderr = "";
|
|
17
|
+
child.stdout.on("data", (chunk) => (stdout += chunk));
|
|
18
|
+
child.stderr.on("data", (chunk) => (stderr += chunk));
|
|
19
|
+
child.on("error", (error) => {
|
|
20
|
+
emit({ type: "error", message: `Chainsaw failed: ${error.message}` });
|
|
21
|
+
process.exitCode = 1;
|
|
22
|
+
});
|
|
23
|
+
child.on("close", async (code) => {
|
|
24
|
+
const detections = [];
|
|
25
|
+
try {
|
|
26
|
+
const files = await readdir(dir);
|
|
27
|
+
for (const file of files) {
|
|
28
|
+
if (!file.endsWith(".json")) continue;
|
|
29
|
+
try {
|
|
30
|
+
const parsed = JSON.parse(await readFile(join(dir, file), "utf8"));
|
|
31
|
+
const list = Array.isArray(parsed) ? parsed : Array.isArray(parsed.detections) ? parsed.detections : [];
|
|
32
|
+
for (const entry of list) {
|
|
33
|
+
detections.push({ name: entry.name ?? entry.title ?? "", level: entry.level ?? "" });
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
// not parseable, skip
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
// no output dir, keep empty
|
|
41
|
+
}
|
|
42
|
+
if (code !== 0 && !detections.length) {
|
|
43
|
+
emit({ type: "error", message: `Chainsaw failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
44
|
+
process.exitCode = 1;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
emit({
|
|
48
|
+
type: "result",
|
|
49
|
+
summary: `Chainsaw found ${detections.length} detections in ${target}.`,
|
|
50
|
+
data: { target, detections: detections.slice(0, 100) },
|
|
51
|
+
});
|
|
52
|
+
emit({ type: "done", summary: `Chainsaw finished: ${detections.length} detections.` });
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "incident-response",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Hunts for threats in Windows event logs with Chainsaw and reports the detections.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "chainsaw",
|
|
9
|
+
"install_hint": "Install Chainsaw from your distribution packages or the Chainsaw releases.",
|
|
10
|
+
"name": "Chainsaw"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "incident-response/chainsaw",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "Chainsaw",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "low",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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("Covenant", ["--version"], { 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: `Covenant failed: ${error.message}` });
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
});
|
|
19
|
+
child.on("close", (code) => {
|
|
20
|
+
const plain = stdout.replace(/\x1b\[[0-9;]*m/g, "");
|
|
21
|
+
const match = plain.match(/(\d+\.\d+(?:\.\d+)?)/);
|
|
22
|
+
const version = match ? match[1] : "";
|
|
23
|
+
if (code !== 0 && !version && !plain.trim()) {
|
|
24
|
+
emit({ type: "error", message: `Covenant failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
emit({
|
|
29
|
+
type: "result",
|
|
30
|
+
summary: version ? `Covenant version ${version} is installed.` : "Covenant is installed.",
|
|
31
|
+
data: { target, version },
|
|
32
|
+
});
|
|
33
|
+
emit({ type: "done", summary: version ? `Covenant finished: version ${version}.` : "Covenant finished." });
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "exploitation",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Checks the installed Covenant version and reports it.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "Covenant",
|
|
9
|
+
"install_hint": "Install Covenant from your distribution packages or the Covenant releases.",
|
|
10
|
+
"name": "Covenant"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "exploitation/covenant",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "Covenant",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "high",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { mkdtemp, readdir } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { extname, join } from "node:path";
|
|
5
|
+
|
|
6
|
+
let input = "";
|
|
7
|
+
process.stdin.setEncoding("utf8");
|
|
8
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
9
|
+
process.stdin.on("end", async () => {
|
|
10
|
+
const request = JSON.parse(input || "{}");
|
|
11
|
+
const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
12
|
+
const target = String(request.target ?? "");
|
|
13
|
+
const dir = await mkdtemp(join(tmpdir(), "cantarella-foremost-"));
|
|
14
|
+
const child = spawn("foremost", ["-i", target, "-o", dir], { stdio: ["ignore", "pipe", "pipe"] });
|
|
15
|
+
let stdout = "";
|
|
16
|
+
let stderr = "";
|
|
17
|
+
child.stdout.on("data", (chunk) => (stdout += chunk));
|
|
18
|
+
child.stderr.on("data", (chunk) => (stderr += chunk));
|
|
19
|
+
child.on("error", (error) => {
|
|
20
|
+
emit({ type: "error", message: `Foremost failed: ${error.message}` });
|
|
21
|
+
process.exitCode = 1;
|
|
22
|
+
});
|
|
23
|
+
child.on("close", async (code) => {
|
|
24
|
+
const carved = {};
|
|
25
|
+
async function walk(current, depth) {
|
|
26
|
+
if (depth > 2) return;
|
|
27
|
+
let entries;
|
|
28
|
+
try {
|
|
29
|
+
entries = await readdir(current, { withFileTypes: true });
|
|
30
|
+
} catch {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
const full = join(current, entry.name);
|
|
35
|
+
if (entry.isDirectory()) {
|
|
36
|
+
await walk(full, depth + 1);
|
|
37
|
+
} else if (entry.isFile()) {
|
|
38
|
+
const type = extname(entry.name).replace(/^\./, "").toLowerCase() || "unknown";
|
|
39
|
+
carved[type] = (carved[type] ?? 0) + 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
await walk(dir, 0);
|
|
44
|
+
const total = Object.values(carved).reduce((sum, count) => sum + count, 0);
|
|
45
|
+
if (code !== 0 && !total) {
|
|
46
|
+
emit({ type: "error", message: `Foremost failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
47
|
+
process.exitCode = 1;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
emit({
|
|
51
|
+
type: "result",
|
|
52
|
+
summary: `Foremost carved ${total} files from ${target}.`,
|
|
53
|
+
data: { target, total, carved },
|
|
54
|
+
});
|
|
55
|
+
emit({ type: "done", summary: `Foremost finished: ${total} files.` });
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "forensics",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Carves files from a disk image with Foremost and reports what it recovered.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "foremost",
|
|
9
|
+
"install_hint": "Install Foremost from your distribution packages.",
|
|
10
|
+
"name": "Foremost"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "forensics/foremost",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "Foremost",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "low",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { mkdtemp, readFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
let input = "";
|
|
7
|
+
process.stdin.setEncoding("utf8");
|
|
8
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
9
|
+
process.stdin.on("end", async () => {
|
|
10
|
+
const request = JSON.parse(input || "{}");
|
|
11
|
+
const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
12
|
+
const target = String(request.target ?? "");
|
|
13
|
+
const dir = await mkdtemp(join(tmpdir(), "cantarella-hayabusa-"));
|
|
14
|
+
const report = join(dir, "timeline.csv");
|
|
15
|
+
const child = spawn("hayabusa", ["csv-timeline", "-d", target, "-o", report], { stdio: ["ignore", "pipe", "pipe"] });
|
|
16
|
+
let stdout = "";
|
|
17
|
+
let stderr = "";
|
|
18
|
+
child.stdout.on("data", (chunk) => (stdout += chunk));
|
|
19
|
+
child.stderr.on("data", (chunk) => (stderr += chunk));
|
|
20
|
+
child.on("error", (error) => {
|
|
21
|
+
emit({ type: "error", message: `Hayabusa failed: ${error.message}` });
|
|
22
|
+
process.exitCode = 1;
|
|
23
|
+
});
|
|
24
|
+
child.on("close", async (code) => {
|
|
25
|
+
const byLevel = {};
|
|
26
|
+
let events = 0;
|
|
27
|
+
try {
|
|
28
|
+
const raw = await readFile(report, "utf8");
|
|
29
|
+
const lines = raw.split("\n").filter((line) => line.trim());
|
|
30
|
+
if (lines.length > 1) {
|
|
31
|
+
const header = lines[0].split(",").map((cell) => cell.trim().toLowerCase());
|
|
32
|
+
const levelIndex = header.indexOf("level");
|
|
33
|
+
for (const line of lines.slice(1)) {
|
|
34
|
+
const cells = line.split(",");
|
|
35
|
+
const level = levelIndex >= 0 ? (cells[levelIndex] ?? "").trim().toLowerCase() : "";
|
|
36
|
+
if (level) byLevel[level] = (byLevel[level] ?? 0) + 1;
|
|
37
|
+
events += 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} catch {
|
|
41
|
+
// no report file, keep empty
|
|
42
|
+
}
|
|
43
|
+
if (code !== 0 && !events) {
|
|
44
|
+
emit({ type: "error", message: `Hayabusa failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
45
|
+
process.exitCode = 1;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
emit({
|
|
49
|
+
type: "result",
|
|
50
|
+
summary: `Hayabusa found ${events} timeline events in ${target}.`,
|
|
51
|
+
data: { target, events, by_level: byLevel },
|
|
52
|
+
});
|
|
53
|
+
emit({ type: "done", summary: `Hayabusa finished: ${events} events.` });
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "incident-response",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Builds a timeline from Windows event logs with Hayabusa and reports the detections.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "hayabusa",
|
|
9
|
+
"install_hint": "Install Hayabusa from your distribution packages or the Hayabusa releases.",
|
|
10
|
+
"name": "Hayabusa"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "incident-response/hayabusa",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "Hayabusa",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "low",
|
|
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 target = String(request.target ?? "");
|
|
10
|
+
const child = spawn("mythic", ["status"], { 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: `Mythic failed: ${error.message}` });
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
});
|
|
19
|
+
child.on("close", (code) => {
|
|
20
|
+
const plain = stdout.replace(/\x1b\[[0-9;]*m/g, "");
|
|
21
|
+
const services = [];
|
|
22
|
+
for (const line of plain.split("\n")) {
|
|
23
|
+
const trimmed = line.trim();
|
|
24
|
+
if (!trimmed) continue;
|
|
25
|
+
const match = trimmed.match(/^(\S+):\s*(running|stopped|exited)/i);
|
|
26
|
+
if (!match) continue;
|
|
27
|
+
services.push({ name: match[1], status: match[2].toLowerCase() });
|
|
28
|
+
}
|
|
29
|
+
if (code !== 0 && !services.length && !plain.trim()) {
|
|
30
|
+
emit({ type: "error", message: `Mythic failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
31
|
+
process.exitCode = 1;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const running = services.filter((service) => service.status === "running").length;
|
|
35
|
+
emit({
|
|
36
|
+
type: "result",
|
|
37
|
+
summary: `Mythic has ${services.length} services, ${running} running.`,
|
|
38
|
+
data: { target, services },
|
|
39
|
+
});
|
|
40
|
+
emit({ type: "done", summary: `Mythic finished: ${running} of ${services.length} services running.` });
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "exploitation",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Checks the Mythic server status and reports which services are running.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "mythic",
|
|
9
|
+
"install_hint": "Install Mythic from your distribution packages or the Mythic repository.",
|
|
10
|
+
"name": "Mythic"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "exploitation/mythic",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "Mythic",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "high",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { mkdtemp, readFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
let input = "";
|
|
7
|
+
process.stdin.setEncoding("utf8");
|
|
8
|
+
process.stdin.on("data", (chunk) => (input += chunk));
|
|
9
|
+
process.stdin.on("end", async () => {
|
|
10
|
+
const request = JSON.parse(input || "{}");
|
|
11
|
+
const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
|
|
12
|
+
const target = String(request.target ?? "");
|
|
13
|
+
const profile = String(request.options?.profile ?? "xccdf_org.ssgproject.content_profile_standard");
|
|
14
|
+
const dir = await mkdtemp(join(tmpdir(), "cantarella-openscap-"));
|
|
15
|
+
const report = join(dir, "results.xml");
|
|
16
|
+
const child = spawn("oscap", ["xccdf", "eval", "--profile", profile, "--results", report, target], { stdio: ["ignore", "pipe", "pipe"] });
|
|
17
|
+
let stdout = "";
|
|
18
|
+
let stderr = "";
|
|
19
|
+
child.stdout.on("data", (chunk) => (stdout += chunk));
|
|
20
|
+
child.stderr.on("data", (chunk) => (stderr += chunk));
|
|
21
|
+
child.on("error", (error) => {
|
|
22
|
+
emit({ type: "error", message: `OpenSCAP failed: ${error.message}` });
|
|
23
|
+
process.exitCode = 1;
|
|
24
|
+
});
|
|
25
|
+
child.on("close", async (code) => {
|
|
26
|
+
let pass = 0;
|
|
27
|
+
let fail = 0;
|
|
28
|
+
try {
|
|
29
|
+
const xml = await readFile(report, "utf8");
|
|
30
|
+
pass = (xml.match(/result="pass"/g) ?? []).length;
|
|
31
|
+
fail = (xml.match(/result="fail"/g) ?? []).length;
|
|
32
|
+
} catch {
|
|
33
|
+
// no results file, keep zero
|
|
34
|
+
}
|
|
35
|
+
if (code !== 0 && code !== 2 && !pass && !fail) {
|
|
36
|
+
emit({ type: "error", message: `OpenSCAP failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
emit({
|
|
41
|
+
type: "result",
|
|
42
|
+
summary: `OpenSCAP evaluated ${target}: ${pass} passed, ${fail} failed.`,
|
|
43
|
+
data: { target, profile, pass, fail },
|
|
44
|
+
});
|
|
45
|
+
emit({ type: "done", summary: `OpenSCAP finished: ${pass} passed, ${fail} failed.` });
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "blue-team",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Evaluates a system against a compliance profile with OpenSCAP and reports the pass and fail counts.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "oscap",
|
|
9
|
+
"install_hint": "Install OpenSCAP from your distribution packages (openscap-scanner).",
|
|
10
|
+
"name": "OpenSCAP"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "blue-team/openscap",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "OpenSCAP",
|
|
17
|
+
"options": [
|
|
18
|
+
{
|
|
19
|
+
"default": "xccdf_org.ssgproject.content_profile_standard",
|
|
20
|
+
"description": "Compliance profile to evaluate.",
|
|
21
|
+
"name": "profile",
|
|
22
|
+
"type": "string"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"risk": "low",
|
|
26
|
+
"schema_version": 1,
|
|
27
|
+
"version": "0.1.0"
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 backend = String(request.options?.backend ?? "splunk");
|
|
11
|
+
const child = spawn("sigma", ["convert", "--target", backend, target], { stdio: ["ignore", "pipe", "pipe"] });
|
|
12
|
+
let stdout = "";
|
|
13
|
+
let stderr = "";
|
|
14
|
+
child.stdout.on("data", (chunk) => (stdout += chunk));
|
|
15
|
+
child.stderr.on("data", (chunk) => (stderr += chunk));
|
|
16
|
+
child.on("error", (error) => {
|
|
17
|
+
emit({ type: "error", message: `Sigma failed: ${error.message}` });
|
|
18
|
+
process.exitCode = 1;
|
|
19
|
+
});
|
|
20
|
+
child.on("close", (code) => {
|
|
21
|
+
const query = stdout.replace(/\x1b\[[0-9;]*m/g, "").trim();
|
|
22
|
+
if (code !== 0 && !query) {
|
|
23
|
+
emit({ type: "error", message: `Sigma failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
24
|
+
process.exitCode = 1;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
emit({
|
|
28
|
+
type: "result",
|
|
29
|
+
summary: `Sigma converted ${target} to a ${backend} query.`,
|
|
30
|
+
data: { target, backend, query },
|
|
31
|
+
});
|
|
32
|
+
emit({ type: "done", summary: `Sigma finished: query for ${backend}.` });
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "incident-response",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Converts a Sigma rule into a backend query and reports the query.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "sigma",
|
|
9
|
+
"install_hint": "Install Sigma from your distribution packages or with pipx install pysigma.",
|
|
10
|
+
"name": "Sigma"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "incident-response/sigma",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "Sigma",
|
|
17
|
+
"options": [
|
|
18
|
+
{
|
|
19
|
+
"default": "splunk",
|
|
20
|
+
"description": "Backend to convert the rule to.",
|
|
21
|
+
"name": "backend",
|
|
22
|
+
"type": "string"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"risk": "low",
|
|
26
|
+
"schema_version": 1,
|
|
27
|
+
"version": "0.1.0"
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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("sliver-server", ["--version"], { 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: `Sliver failed: ${error.message}` });
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
});
|
|
19
|
+
child.on("close", (code) => {
|
|
20
|
+
const plain = stdout.replace(/\x1b\[[0-9;]*m/g, "");
|
|
21
|
+
const match = plain.match(/v?(\d+\.\d+\.\d+)/);
|
|
22
|
+
const version = match ? match[1] : "";
|
|
23
|
+
if (code !== 0 && !version && !plain.trim()) {
|
|
24
|
+
emit({ type: "error", message: `Sliver failed: ${stderr.trim() || `exited with ${code}`}` });
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
emit({
|
|
29
|
+
type: "result",
|
|
30
|
+
summary: version ? `Sliver server version ${version} is installed.` : "Sliver server is installed.",
|
|
31
|
+
data: { target, version },
|
|
32
|
+
});
|
|
33
|
+
emit({ type: "done", summary: version ? `Sliver finished: version ${version}.` : "Sliver finished." });
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "exploitation",
|
|
3
|
+
"core_api": "^0.1.0",
|
|
4
|
+
"description": "Checks the installed Sliver server version and reports it.",
|
|
5
|
+
"entry": "index.mjs",
|
|
6
|
+
"external_tools": [
|
|
7
|
+
{
|
|
8
|
+
"command": "sliver-server",
|
|
9
|
+
"install_hint": "Install Sliver from your distribution packages or the Sliver releases.",
|
|
10
|
+
"name": "Sliver"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"id": "exploitation/sliver",
|
|
14
|
+
"kind": "wrapper",
|
|
15
|
+
"maintenance": "active",
|
|
16
|
+
"name": "Sliver",
|
|
17
|
+
"options": [],
|
|
18
|
+
"risk": "high",
|
|
19
|
+
"schema_version": 1,
|
|
20
|
+
"version": "0.1.0"
|
|
21
|
+
}
|
package/package.json
CHANGED
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.20.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.20.0",
|
|
82
|
+
update_message: (await checkForUpdate("1.20.0")).message,
|
|
83
83
|
categories: CATEGORIES,
|
|
84
84
|
modules: modules.map(({ manifest }) => manifest),
|
|
85
85
|
external_tools: [...tools.values()],
|