@profullstack/threatcrush 0.13.15 → 0.13.16
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/daemon.js +33 -0
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +79 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13056,20 +13056,27 @@ function initialState(now = Date.now()) {
|
|
|
13056
13056
|
busy: false,
|
|
13057
13057
|
moduleIndex: 0,
|
|
13058
13058
|
moduleFilter: null,
|
|
13059
|
+
sourceFilter: null,
|
|
13059
13060
|
showNoise: false
|
|
13060
13061
|
};
|
|
13061
13062
|
}
|
|
13062
13063
|
function isNoise(event) {
|
|
13063
|
-
|
|
13064
|
+
if (event.severity !== "low" && event.severity !== "info") return false;
|
|
13065
|
+
if (/^Client error 4\d\d:/.test(event.message)) return true;
|
|
13066
|
+
return /\b(veth|docker|br-|cni|cali|flannel|vxlan)[\w.-]*: entered (promiscuous|allmulticast) mode|\(unregistering\): left (promiscuous|allmulticast) mode/.test(event.message);
|
|
13067
|
+
}
|
|
13068
|
+
function matchesFilters(state, e) {
|
|
13069
|
+
return (!state.moduleFilter || e.module === state.moduleFilter) && (!state.sourceFilter || e.source_ip === state.sourceFilter);
|
|
13064
13070
|
}
|
|
13065
13071
|
function visibleEvents(state) {
|
|
13066
|
-
return state.events.filter(
|
|
13067
|
-
(e) => (!state.moduleFilter || e.module === state.moduleFilter) && (state.showNoise || !isNoise(e))
|
|
13068
|
-
);
|
|
13072
|
+
return state.events.filter((e) => matchesFilters(state, e) && (state.showNoise || !isNoise(e)));
|
|
13069
13073
|
}
|
|
13070
13074
|
function hiddenNoise(state) {
|
|
13071
13075
|
if (state.showNoise) return 0;
|
|
13072
|
-
return state.events.filter((e) => (
|
|
13076
|
+
return state.events.filter((e) => matchesFilters(state, e) && isNoise(e)).length;
|
|
13077
|
+
}
|
|
13078
|
+
function hasFilter(state) {
|
|
13079
|
+
return Boolean(state.moduleFilter || state.sourceFilter);
|
|
13073
13080
|
}
|
|
13074
13081
|
function isBanned(state, ip) {
|
|
13075
13082
|
return state.bans.some((b) => b.ip === ip);
|
|
@@ -13206,6 +13213,14 @@ function reducer(state, action) {
|
|
|
13206
13213
|
}
|
|
13207
13214
|
case "clear_module_filter":
|
|
13208
13215
|
return { ...state, moduleFilter: null, scrollBack: 0 };
|
|
13216
|
+
case "toggle_source_filter": {
|
|
13217
|
+
const ip = selectedIp(state);
|
|
13218
|
+
if (!ip) return state;
|
|
13219
|
+
const sourceFilter = state.sourceFilter === ip ? null : ip;
|
|
13220
|
+
return { ...state, sourceFilter, scrollBack: 0 };
|
|
13221
|
+
}
|
|
13222
|
+
case "clear_source_filter":
|
|
13223
|
+
return { ...state, sourceFilter: null, scrollBack: 0 };
|
|
13209
13224
|
case "toggle_noise":
|
|
13210
13225
|
return { ...state, showNoise: !state.showNoise, scrollBack: 0 };
|
|
13211
13226
|
case "counters":
|
|
@@ -13241,6 +13256,7 @@ function reducer(state, action) {
|
|
|
13241
13256
|
firewall: state.firewall,
|
|
13242
13257
|
focus: state.focus,
|
|
13243
13258
|
moduleFilter: state.moduleFilter,
|
|
13259
|
+
sourceFilter: state.sourceFilter,
|
|
13244
13260
|
moduleIndex: state.moduleIndex,
|
|
13245
13261
|
showNoise: state.showNoise
|
|
13246
13262
|
};
|
|
@@ -13536,13 +13552,17 @@ function noiseNote(state) {
|
|
|
13536
13552
|
const hidden = hiddenNoise(state);
|
|
13537
13553
|
return hidden > 0 ? `${hidden} routine 4xx hidden \xB7 n shows` : void 0;
|
|
13538
13554
|
}
|
|
13555
|
+
function filterLabel(state) {
|
|
13556
|
+
return [state.moduleFilter, state.sourceFilter ? `src ${state.sourceFilter}` : null].filter(Boolean).join(" \xB7 ");
|
|
13557
|
+
}
|
|
13539
13558
|
function feedPanel(parent, state, theme, options) {
|
|
13540
13559
|
const following = state.scrollBack === 0;
|
|
13541
13560
|
const shown = visibleEvents(state);
|
|
13542
|
-
const filtered = state
|
|
13561
|
+
const filtered = hasFilter(state);
|
|
13562
|
+
const label = filterLabel(state);
|
|
13543
13563
|
parent.panel(
|
|
13544
13564
|
{
|
|
13545
|
-
title: filtered ? ` LIVE EVENTS \xB7 ${
|
|
13565
|
+
title: filtered ? ` LIVE EVENTS \xB7 ${label} ` : " LIVE EVENTS ",
|
|
13546
13566
|
size: "2.4fr",
|
|
13547
13567
|
border: "rounded",
|
|
13548
13568
|
borderColor: state.connection === "live" ? theme.borderFocused : theme.border,
|
|
@@ -13554,7 +13574,7 @@ function feedPanel(parent, state, theme, options) {
|
|
|
13554
13574
|
(panel) => {
|
|
13555
13575
|
if (filtered && shown.length === 0 && state.events.length > 0) {
|
|
13556
13576
|
panel.spacer(1);
|
|
13557
|
-
panel.text(`No events from ${
|
|
13577
|
+
panel.text(`No events from ${label} yet.`, { fg: theme.muted, align: "center" });
|
|
13558
13578
|
panel.spacer(1);
|
|
13559
13579
|
panel.label("esc shows everything again", { fg: theme.muted, align: "center" });
|
|
13560
13580
|
return;
|
|
@@ -13607,7 +13627,7 @@ function threatsPanel(parent, state, theme, options) {
|
|
|
13607
13627
|
border: "rounded",
|
|
13608
13628
|
borderColor: focused ? theme.borderFocused : theme.border,
|
|
13609
13629
|
titleColor: theme.primary,
|
|
13610
|
-
subtitle: focused ? "b ban \xB7 u unban" : void 0,
|
|
13630
|
+
subtitle: focused ? "click filters feed \xB7 b ban \xB7 u unban" : void 0,
|
|
13611
13631
|
subtitleColor: theme.muted,
|
|
13612
13632
|
padding: [0, 1]
|
|
13613
13633
|
},
|
|
@@ -13632,12 +13652,13 @@ function threatsPanel(parent, state, theme, options) {
|
|
|
13632
13652
|
onSelectRow: options.onThreatSelect,
|
|
13633
13653
|
columns: [
|
|
13634
13654
|
{
|
|
13635
|
-
//
|
|
13636
|
-
//
|
|
13655
|
+
// ▶ marks the source the feed is filtered to; otherwise the glyph
|
|
13656
|
+
// says whether this source is banned, protected, or neither — which
|
|
13657
|
+
// decides what the b key will do to it.
|
|
13637
13658
|
key: "ip",
|
|
13638
13659
|
width: 2,
|
|
13639
|
-
render: (s) => isBanned(state, s.ip) ? "\u2716" : isProtectedRow(state, s.ip) ? "\u26CA" : " ",
|
|
13640
|
-
color: (s) => isBanned(state, s.ip) ? severityColors.critical : isProtectedRow(state, s.ip) ? theme.success : theme.muted
|
|
13660
|
+
render: (s) => state.sourceFilter === s.ip ? "\u25B6" : isBanned(state, s.ip) ? "\u2716" : isProtectedRow(state, s.ip) ? "\u26CA" : " ",
|
|
13661
|
+
color: (s) => state.sourceFilter === s.ip ? theme.primary : isBanned(state, s.ip) ? severityColors.critical : isProtectedRow(state, s.ip) ? theme.success : theme.muted
|
|
13641
13662
|
},
|
|
13642
13663
|
{ key: "ip", width: "fill", color: () => theme.foreground },
|
|
13643
13664
|
{
|
|
@@ -13702,7 +13723,7 @@ function bansPanel(parent, state, theme, options) {
|
|
|
13702
13723
|
}
|
|
13703
13724
|
if (state.bans.length === 0) {
|
|
13704
13725
|
panel.label("nothing banned", { fg: theme.muted });
|
|
13705
|
-
panel.label(fw.dry_run ? "dry-run: bans are simulated" : "bans:
|
|
13726
|
+
panel.label(fw.dry_run ? "dry-run: bans are simulated" : "bans: 5m \u2192 10m \u2192 20m \u2192 40m", {
|
|
13706
13727
|
fg: fw.dry_run ? severityColors.medium : theme.muted
|
|
13707
13728
|
});
|
|
13708
13729
|
return;
|
|
@@ -13767,7 +13788,7 @@ function footer(ui, state, theme) {
|
|
|
13767
13788
|
{ key: "q", label: "quit" },
|
|
13768
13789
|
{ key: "tab", label: state.focus },
|
|
13769
13790
|
{ key: "\u2191\u2193", label: onFeed ? "scroll" : "select" },
|
|
13770
|
-
...state.focus === "modules" ? [{ key: "\u23CE", label: state.moduleFilter ? "unfilter" : "filter" }] : [{ key: "b", label: "ban" }, { key: "u", label: "unban" }],
|
|
13791
|
+
...state.focus === "modules" ? [{ key: "\u23CE", label: state.moduleFilter ? "unfilter" : "filter" }] : state.focus === "threats" || state.focus === "bans" ? [{ key: "\u23CE", label: state.sourceFilter ? "unfilter" : "filter" }, { key: "b", label: "ban" }, { key: "u", label: "unban" }] : [{ key: "b", label: "ban" }, { key: "u", label: "unban" }],
|
|
13771
13792
|
{ key: "p", label: state.paused ? "resume" : "pause" },
|
|
13772
13793
|
{ key: "r", label: "reset" },
|
|
13773
13794
|
{ key: "n", label: state.showNoise ? "hide 4xx" : "show 4xx" }
|
|
@@ -13781,6 +13802,7 @@ function footer(ui, state, theme) {
|
|
|
13781
13802
|
color: severityColors.medium
|
|
13782
13803
|
},
|
|
13783
13804
|
{ label: state.moduleFilter ? `filter: ${state.moduleFilter}` : "", color: theme.primary },
|
|
13805
|
+
{ label: state.sourceFilter ? `src: ${state.sourceFilter}` : "", color: theme.primary },
|
|
13784
13806
|
{
|
|
13785
13807
|
label: state.firewall ? `${state.bans.length} banned${state.firewall.dry_run ? " (dry-run)" : ""}` : "",
|
|
13786
13808
|
color: state.firewall?.dry_run ? severityColors.medium : theme.muted
|
|
@@ -14015,7 +14037,8 @@ async function startDashboard(options = {}) {
|
|
|
14015
14037
|
app.on("key", (event) => {
|
|
14016
14038
|
switch (event.key) {
|
|
14017
14039
|
case "escape":
|
|
14018
|
-
if (state.
|
|
14040
|
+
if (state.sourceFilter) dispatch({ type: "clear_source_filter" });
|
|
14041
|
+
else if (state.moduleFilter) dispatch({ type: "clear_module_filter" });
|
|
14019
14042
|
else quit();
|
|
14020
14043
|
break;
|
|
14021
14044
|
case "q":
|
|
@@ -14024,7 +14047,8 @@ async function startDashboard(options = {}) {
|
|
|
14024
14047
|
break;
|
|
14025
14048
|
case "enter":
|
|
14026
14049
|
case "return":
|
|
14027
|
-
dispatch({ type: "toggle_module_filter" });
|
|
14050
|
+
if (state.focus === "modules") dispatch({ type: "toggle_module_filter" });
|
|
14051
|
+
else if (state.focus === "threats" || state.focus === "bans") dispatch({ type: "toggle_source_filter" });
|
|
14028
14052
|
break;
|
|
14029
14053
|
case "p":
|
|
14030
14054
|
case "space":
|
|
@@ -14073,15 +14097,18 @@ async function startDashboard(options = {}) {
|
|
|
14073
14097
|
renderDashboard(ui, state, theme, {
|
|
14074
14098
|
demo: options.demo,
|
|
14075
14099
|
onFeedScroll: (delta) => dispatch({ type: "scroll", delta: -delta }),
|
|
14076
|
-
// One click
|
|
14077
|
-
//
|
|
14100
|
+
// One click focuses the panel, picks the row, and filters the feed to that
|
|
14101
|
+
// source — "what has this one IP done" in a single click. Clicking the
|
|
14102
|
+
// same row again clears the filter.
|
|
14078
14103
|
onThreatSelect: (row) => {
|
|
14079
14104
|
dispatch({ type: "focus", focus: "threats" });
|
|
14080
14105
|
dispatch({ type: "select_at", index: row });
|
|
14106
|
+
dispatch({ type: "toggle_source_filter" });
|
|
14081
14107
|
},
|
|
14082
14108
|
onBanSelect: (row) => {
|
|
14083
14109
|
dispatch({ type: "focus", focus: "bans" });
|
|
14084
14110
|
dispatch({ type: "select_at", index: row });
|
|
14111
|
+
dispatch({ type: "toggle_source_filter" });
|
|
14085
14112
|
},
|
|
14086
14113
|
// One click on a module both selects it and pins the feed to it; a
|
|
14087
14114
|
// second click on the same module releases the feed.
|
|
@@ -33830,6 +33857,39 @@ var DEFAULT_RULES = [
|
|
|
33830
33857
|
description: "Block source IP performing exploit probes"
|
|
33831
33858
|
},
|
|
33832
33859
|
enabled: true
|
|
33860
|
+
},
|
|
33861
|
+
{
|
|
33862
|
+
// A real network card entering promiscuous mode can mean someone is
|
|
33863
|
+
// sniffing traffic on the host. The kernel also logs this constantly for
|
|
33864
|
+
// container veth/bridge interfaces, which is normal (a bridge port must be
|
|
33865
|
+
// promiscuous to forward frames), so the negative lookahead excludes every
|
|
33866
|
+
// virtual interface kind and only a physical/primary NIC trips this.
|
|
33867
|
+
id: "nic-promiscuous-mode",
|
|
33868
|
+
title: "Network Interface Entered Promiscuous Mode",
|
|
33869
|
+
description: "A non-virtual network interface entered promiscuous mode, which can indicate packet sniffing",
|
|
33870
|
+
version: "1.0.0",
|
|
33871
|
+
category: "system",
|
|
33872
|
+
severity: "medium",
|
|
33873
|
+
source_types: ["user-journal", "system"],
|
|
33874
|
+
match: {
|
|
33875
|
+
field: "message",
|
|
33876
|
+
operator: "regex",
|
|
33877
|
+
// "[kernel] enp11s0: entered promiscuous mode" trips; veth*, docker*,
|
|
33878
|
+
// br-*, bridge, lo, tap*, vxlan*, cni*, cali*, flannel*, virbr*, kube*
|
|
33879
|
+
// and tailscale* do not.
|
|
33880
|
+
value: "\\b(?!veth|docker|br-|bridge|lo:|lo\\b|tap|vxlan|cni|cali|flannel|virbr|kube|tailscale)[A-Za-z][\\w.-]*: entered promiscuous mode"
|
|
33881
|
+
},
|
|
33882
|
+
threshold: 1,
|
|
33883
|
+
window_seconds: 60,
|
|
33884
|
+
// A legitimate tcpdump flaps it; do not re-alert for an hour.
|
|
33885
|
+
cooldown_seconds: 3600,
|
|
33886
|
+
tags: ["system", "network", "sniffing", "host-integrity"],
|
|
33887
|
+
remediation: {
|
|
33888
|
+
// Host integrity, no attacker address to ban — surface it, do not block.
|
|
33889
|
+
action: "alert",
|
|
33890
|
+
description: "Confirm whether a capture tool or new bridge is expected on this host"
|
|
33891
|
+
},
|
|
33892
|
+
enabled: true
|
|
33833
33893
|
}
|
|
33834
33894
|
];
|
|
33835
33895
|
|