@profullstack/threatcrush 0.13.19 → 0.13.20

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/dist/index.js CHANGED
@@ -13057,23 +13057,29 @@ function initialState(now = Date.now()) {
13057
13057
  moduleIndex: 0,
13058
13058
  moduleFilter: null,
13059
13059
  sourceFilter: null,
13060
- showNoise: false
13060
+ showNoise: false,
13061
+ muteCron: false
13061
13062
  };
13062
13063
  }
13063
- function isNoise(event) {
13064
+ function isCronLine(event) {
13065
+ if (event.severity !== "low" && event.severity !== "info") return false;
13066
+ return /\[CRON\] \([^)]+\) CMD /.test(event.message);
13067
+ }
13068
+ function isNoise(event, muteCron = false) {
13064
13069
  if (event.severity !== "low" && event.severity !== "info") return false;
13065
13070
  if (/^Client error 4\d\d:/.test(event.message)) return true;
13071
+ if (muteCron && isCronLine(event)) return true;
13066
13072
  return /\b(veth|docker|br-|cni|cali|flannel|vxlan)[\w.-]*: entered (promiscuous|allmulticast) mode|\(unregistering\): left (promiscuous|allmulticast) mode/.test(event.message);
13067
13073
  }
13068
13074
  function matchesFilters(state, e) {
13069
13075
  return (!state.moduleFilter || e.module === state.moduleFilter) && (!state.sourceFilter || e.source_ip === state.sourceFilter);
13070
13076
  }
13071
13077
  function visibleEvents(state) {
13072
- return state.events.filter((e) => matchesFilters(state, e) && (state.showNoise || !isNoise(e)));
13078
+ return state.events.filter((e) => matchesFilters(state, e) && (state.showNoise || !isNoise(e, state.muteCron)));
13073
13079
  }
13074
13080
  function hiddenNoise(state) {
13075
13081
  if (state.showNoise) return 0;
13076
- return state.events.filter((e) => matchesFilters(state, e) && isNoise(e)).length;
13082
+ return state.events.filter((e) => matchesFilters(state, e) && isNoise(e, state.muteCron)).length;
13077
13083
  }
13078
13084
  function hasFilter(state) {
13079
13085
  return Boolean(state.moduleFilter || state.sourceFilter);
@@ -13223,6 +13229,8 @@ function reducer(state, action) {
13223
13229
  return { ...state, sourceFilter: null, scrollBack: 0 };
13224
13230
  case "toggle_noise":
13225
13231
  return { ...state, showNoise: !state.showNoise, scrollBack: 0 };
13232
+ case "toggle_cron":
13233
+ return { ...state, muteCron: !state.muteCron, scrollBack: 0 };
13226
13234
  case "counters":
13227
13235
  return {
13228
13236
  ...state,
@@ -13258,7 +13266,8 @@ function reducer(state, action) {
13258
13266
  moduleFilter: state.moduleFilter,
13259
13267
  sourceFilter: state.sourceFilter,
13260
13268
  moduleIndex: state.moduleIndex,
13261
- showNoise: state.showNoise
13269
+ showNoise: state.showNoise,
13270
+ muteCron: state.muteCron
13262
13271
  };
13263
13272
  }
13264
13273
  }
@@ -13550,7 +13559,9 @@ function severityPanel(parent, state, theme) {
13550
13559
  }
13551
13560
  function noiseNote(state) {
13552
13561
  const hidden = hiddenNoise(state);
13553
- return hidden > 0 ? `${hidden} routine 4xx hidden \xB7 n shows` : void 0;
13562
+ if (hidden === 0) return void 0;
13563
+ const keys = state.muteCron ? "n/c show" : "n shows";
13564
+ return `${hidden} routine hidden \xB7 ${keys}`;
13554
13565
  }
13555
13566
  function filterLabel(state) {
13556
13567
  return [state.moduleFilter, state.sourceFilter ? `src ${state.sourceFilter}` : null].filter(Boolean).join(" \xB7 ");
@@ -13791,7 +13802,10 @@ function footer(ui, state, theme) {
13791
13802
  ...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" }],
13792
13803
  { key: "p", label: state.paused ? "resume" : "pause" },
13793
13804
  { key: "r", label: "reset" },
13794
- { key: "n", label: state.showNoise ? "hide 4xx" : "show 4xx" }
13805
+ { key: "n", label: state.showNoise ? "hide 4xx" : "show 4xx" },
13806
+ // Only offer the cron toggle once a cron line has actually shown up, or
13807
+ // while it is muting, so the hint never advertises a key with nothing to act on.
13808
+ ...state.muteCron || state.events.some(isCronLine) ? [{ key: "c", label: state.muteCron ? "show cron" : "mute cron" }] : []
13795
13809
  ],
13796
13810
  right: [
13797
13811
  // The notice is the answer to "did my keypress do anything", so it takes
@@ -14060,6 +14074,9 @@ async function startDashboard(options = {}) {
14060
14074
  case "n":
14061
14075
  dispatch({ type: "toggle_noise" });
14062
14076
  break;
14077
+ case "c":
14078
+ dispatch({ type: "toggle_cron" });
14079
+ break;
14063
14080
  case "tab":
14064
14081
  dispatch({ type: "focus_next" });
14065
14082
  break;