@profullstack/threatcrush 0.13.48 → 0.13.50
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 +242 -102
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +16550 -15270
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
|
-
ThreatCrush is a security daemon that runs on your server, **reading your logs and watching inbound connections** for live attacks. It checks every nginx request against 96 OWASP CRS rules (paranoia level 1) + 1 ThreatCrush rule with CRS anomaly scoring, runs
|
|
45
|
+
ThreatCrush is a security daemon that runs on your server, **reading your logs and watching inbound connections** for live attacks. It checks every nginx request against 96 OWASP CRS rules (paranoia level 1) + 1 ThreatCrush rule with CRS anomaly scoring, runs 18 detection rules over auth, web and network events, auto-bans attackers, scans your codebase, spot-checks your URLs, and alerts you in real-time.
|
|
46
46
|
|
|
47
47
|
```
|
|
48
48
|
$ threatcrush monitor
|
package/dist/daemon.js
CHANGED
|
@@ -7,7 +7,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
-
|
|
10
|
+
try {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
throw mod = 0, e;
|
|
14
|
+
}
|
|
11
15
|
};
|
|
12
16
|
var __copyProps = (to, from, except, desc) => {
|
|
13
17
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -11580,11 +11584,43 @@ async function cloudFetch(path, init = {}) {
|
|
|
11580
11584
|
var import_node_fs19 = require("fs");
|
|
11581
11585
|
var import_node_path13 = require("path");
|
|
11582
11586
|
|
|
11583
|
-
// ../../node_modules/.pnpm/chalk@
|
|
11587
|
+
// ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/utilities.js
|
|
11588
|
+
function stringReplaceAll(string, substring, postfix) {
|
|
11589
|
+
let index = string.indexOf(substring);
|
|
11590
|
+
if (index === -1) {
|
|
11591
|
+
return string;
|
|
11592
|
+
}
|
|
11593
|
+
const substringLength = substring.length;
|
|
11594
|
+
let endIndex = 0;
|
|
11595
|
+
let returnValue = "";
|
|
11596
|
+
do {
|
|
11597
|
+
returnValue += string.slice(endIndex, index) + substring + postfix;
|
|
11598
|
+
endIndex = index + substringLength;
|
|
11599
|
+
index = string.indexOf(substring, endIndex);
|
|
11600
|
+
} while (index !== -1);
|
|
11601
|
+
returnValue += string.slice(endIndex);
|
|
11602
|
+
return returnValue;
|
|
11603
|
+
}
|
|
11604
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
11605
|
+
let endIndex = 0;
|
|
11606
|
+
let returnValue = "";
|
|
11607
|
+
do {
|
|
11608
|
+
const isGotCR = string[index - 1] === "\r";
|
|
11609
|
+
returnValue += string.slice(endIndex, isGotCR ? index - 1 : index) + prefix + (isGotCR ? "\r\n" : "\n") + postfix;
|
|
11610
|
+
endIndex = index + 1;
|
|
11611
|
+
index = string.indexOf("\n", endIndex);
|
|
11612
|
+
} while (index !== -1);
|
|
11613
|
+
returnValue += string.slice(endIndex);
|
|
11614
|
+
return returnValue;
|
|
11615
|
+
}
|
|
11616
|
+
|
|
11617
|
+
// ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
11584
11618
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
11619
|
+
var ANSI_UNDERLINE_OFFSET = 20;
|
|
11585
11620
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
11586
11621
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
11587
11622
|
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
11623
|
+
var wrapUnderlineAnsi = (code) => `\x1B[58;5;${code < 90 ? code - 30 : code - 90 + 8}m`;
|
|
11588
11624
|
var styles = {
|
|
11589
11625
|
modifier: {
|
|
11590
11626
|
reset: [0, 0],
|
|
@@ -11593,6 +11629,11 @@ var styles = {
|
|
|
11593
11629
|
dim: [2, 22],
|
|
11594
11630
|
italic: [3, 23],
|
|
11595
11631
|
underline: [4, 24],
|
|
11632
|
+
// Extended underline styles (`SGR 4:x` sub-parameters). Not in upstream `ansi-styles`.
|
|
11633
|
+
underlineDouble: ["4:2", 24],
|
|
11634
|
+
underlineCurly: ["4:3", 24],
|
|
11635
|
+
underlineDotted: ["4:4", 24],
|
|
11636
|
+
underlineDashed: ["4:5", 24],
|
|
11596
11637
|
overline: [53, 55],
|
|
11597
11638
|
inverse: [7, 27],
|
|
11598
11639
|
hidden: [8, 28],
|
|
@@ -11643,11 +11684,36 @@ var styles = {
|
|
|
11643
11684
|
bgMagentaBright: [105, 49],
|
|
11644
11685
|
bgCyanBright: [106, 49],
|
|
11645
11686
|
bgWhiteBright: [107, 49]
|
|
11687
|
+
},
|
|
11688
|
+
// Underline color (`SGR 58`/`59`). Not in upstream `ansi-styles`.
|
|
11689
|
+
underlineColor: {
|
|
11690
|
+
underlineBlack: ["58;5;0", 59],
|
|
11691
|
+
underlineRed: ["58;5;1", 59],
|
|
11692
|
+
underlineGreen: ["58;5;2", 59],
|
|
11693
|
+
underlineYellow: ["58;5;3", 59],
|
|
11694
|
+
underlineBlue: ["58;5;4", 59],
|
|
11695
|
+
underlineMagenta: ["58;5;5", 59],
|
|
11696
|
+
underlineCyan: ["58;5;6", 59],
|
|
11697
|
+
underlineWhite: ["58;5;7", 59],
|
|
11698
|
+
// Bright color
|
|
11699
|
+
underlineBlackBright: ["58;5;8", 59],
|
|
11700
|
+
underlineGray: ["58;5;8", 59],
|
|
11701
|
+
// Alias of `underlineBlackBright`
|
|
11702
|
+
underlineGrey: ["58;5;8", 59],
|
|
11703
|
+
// Alias of `underlineBlackBright`
|
|
11704
|
+
underlineRedBright: ["58;5;9", 59],
|
|
11705
|
+
underlineGreenBright: ["58;5;10", 59],
|
|
11706
|
+
underlineYellowBright: ["58;5;11", 59],
|
|
11707
|
+
underlineBlueBright: ["58;5;12", 59],
|
|
11708
|
+
underlineMagentaBright: ["58;5;13", 59],
|
|
11709
|
+
underlineCyanBright: ["58;5;14", 59],
|
|
11710
|
+
underlineWhiteBright: ["58;5;15", 59]
|
|
11646
11711
|
}
|
|
11647
11712
|
};
|
|
11648
11713
|
var modifierNames = Object.keys(styles.modifier);
|
|
11649
11714
|
var foregroundColorNames = Object.keys(styles.color);
|
|
11650
11715
|
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
11716
|
+
var underlineColorNames = Object.keys(styles.underlineColor);
|
|
11651
11717
|
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
11652
11718
|
function assembleStyles() {
|
|
11653
11719
|
const codes = /* @__PURE__ */ new Map();
|
|
@@ -11658,7 +11724,7 @@ function assembleStyles() {
|
|
|
11658
11724
|
close: `\x1B[${style[1]}m`
|
|
11659
11725
|
};
|
|
11660
11726
|
group[styleName] = styles[styleName];
|
|
11661
|
-
codes.set(style[0], style[1]);
|
|
11727
|
+
codes.set(Number.parseInt(style[0], 10), style[1]);
|
|
11662
11728
|
}
|
|
11663
11729
|
Object.defineProperty(styles, groupName, {
|
|
11664
11730
|
value: group,
|
|
@@ -11671,12 +11737,16 @@ function assembleStyles() {
|
|
|
11671
11737
|
});
|
|
11672
11738
|
styles.color.close = "\x1B[39m";
|
|
11673
11739
|
styles.bgColor.close = "\x1B[49m";
|
|
11740
|
+
styles.underlineColor.close = "\x1B[59m";
|
|
11674
11741
|
styles.color.ansi = wrapAnsi16();
|
|
11675
11742
|
styles.color.ansi256 = wrapAnsi256();
|
|
11676
11743
|
styles.color.ansi16m = wrapAnsi16m();
|
|
11677
11744
|
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
11678
11745
|
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
11679
11746
|
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
11747
|
+
styles.underlineColor.ansi = wrapUnderlineAnsi;
|
|
11748
|
+
styles.underlineColor.ansi256 = wrapAnsi256(ANSI_UNDERLINE_OFFSET);
|
|
11749
|
+
styles.underlineColor.ansi16m = wrapAnsi16m(ANSI_UNDERLINE_OFFSET);
|
|
11680
11750
|
Object.defineProperties(styles, {
|
|
11681
11751
|
rgbToAnsi256: {
|
|
11682
11752
|
value(red, green, blue) {
|
|
@@ -11695,7 +11765,7 @@ function assembleStyles() {
|
|
|
11695
11765
|
},
|
|
11696
11766
|
hexToRgb: {
|
|
11697
11767
|
value(hex) {
|
|
11698
|
-
const matches = /[
|
|
11768
|
+
const matches = /[\da-f]{6}|[\da-f]{3}/i.exec(hex.toString(16));
|
|
11699
11769
|
if (!matches) {
|
|
11700
11770
|
return [0, 0, 0];
|
|
11701
11771
|
}
|
|
@@ -11705,7 +11775,7 @@ function assembleStyles() {
|
|
|
11705
11775
|
}
|
|
11706
11776
|
const integer = Number.parseInt(colorString, 16);
|
|
11707
11777
|
return [
|
|
11708
|
-
/* eslint-disable no-bitwise */
|
|
11778
|
+
/* eslint-disable no-bitwise -- We need the speed */
|
|
11709
11779
|
integer >> 16 & 255,
|
|
11710
11780
|
integer >> 8 & 255,
|
|
11711
11781
|
integer & 255
|
|
@@ -11766,7 +11836,7 @@ function assembleStyles() {
|
|
|
11766
11836
|
var ansiStyles = assembleStyles();
|
|
11767
11837
|
var ansi_styles_default = ansiStyles;
|
|
11768
11838
|
|
|
11769
|
-
// ../../node_modules/.pnpm/chalk@
|
|
11839
|
+
// ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/supports-color/index.js
|
|
11770
11840
|
var import_node_process = __toESM(require("process"), 1);
|
|
11771
11841
|
var import_node_os3 = __toESM(require("os"), 1);
|
|
11772
11842
|
var import_node_tty = __toESM(require("tty"), 1);
|
|
@@ -11783,16 +11853,23 @@ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || has
|
|
|
11783
11853
|
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
11784
11854
|
flagForceColor = 1;
|
|
11785
11855
|
}
|
|
11856
|
+
function hasNumericForceColor() {
|
|
11857
|
+
return /^\d+$/.test(env.FORCE_COLOR);
|
|
11858
|
+
}
|
|
11786
11859
|
function envForceColor() {
|
|
11787
|
-
if ("FORCE_COLOR" in env) {
|
|
11788
|
-
|
|
11789
|
-
return 1;
|
|
11790
|
-
}
|
|
11791
|
-
if (env.FORCE_COLOR === "false") {
|
|
11792
|
-
return 0;
|
|
11793
|
-
}
|
|
11794
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
11860
|
+
if (!("FORCE_COLOR" in env)) {
|
|
11861
|
+
return;
|
|
11795
11862
|
}
|
|
11863
|
+
if (env.FORCE_COLOR === "false") {
|
|
11864
|
+
return 0;
|
|
11865
|
+
}
|
|
11866
|
+
if (env.FORCE_COLOR === "true" || env.FORCE_COLOR.length === 0) {
|
|
11867
|
+
return 1;
|
|
11868
|
+
}
|
|
11869
|
+
if (!hasNumericForceColor()) {
|
|
11870
|
+
return;
|
|
11871
|
+
}
|
|
11872
|
+
return Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
11796
11873
|
}
|
|
11797
11874
|
function translateLevel(level) {
|
|
11798
11875
|
if (level === 0) {
|
|
@@ -11822,6 +11899,9 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
11822
11899
|
return 2;
|
|
11823
11900
|
}
|
|
11824
11901
|
}
|
|
11902
|
+
if (forceColor !== void 0 && hasNumericForceColor()) {
|
|
11903
|
+
return forceColor;
|
|
11904
|
+
}
|
|
11825
11905
|
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
11826
11906
|
return 1;
|
|
11827
11907
|
}
|
|
@@ -11849,7 +11929,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
11849
11929
|
return min;
|
|
11850
11930
|
}
|
|
11851
11931
|
if ("TEAMCITY_VERSION" in env) {
|
|
11852
|
-
return /^(9\.
|
|
11932
|
+
return /^(?:9\.0*[1-9]\d*\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
11853
11933
|
}
|
|
11854
11934
|
if (env.COLORTERM === "truecolor") {
|
|
11855
11935
|
return 3;
|
|
@@ -11864,7 +11944,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
11864
11944
|
return 3;
|
|
11865
11945
|
}
|
|
11866
11946
|
if ("TERM_PROGRAM" in env) {
|
|
11867
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
11947
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".", 1)[0], 10);
|
|
11868
11948
|
switch (env.TERM_PROGRAM) {
|
|
11869
11949
|
case "iTerm.app": {
|
|
11870
11950
|
return version >= 3 ? 3 : 2;
|
|
@@ -11874,7 +11954,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
11874
11954
|
}
|
|
11875
11955
|
}
|
|
11876
11956
|
}
|
|
11877
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
11957
|
+
if (/-256(?:color)?$/i.test(env.TERM)) {
|
|
11878
11958
|
return 2;
|
|
11879
11959
|
}
|
|
11880
11960
|
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
@@ -11898,54 +11978,34 @@ var supportsColor = {
|
|
|
11898
11978
|
};
|
|
11899
11979
|
var supports_color_default = supportsColor;
|
|
11900
11980
|
|
|
11901
|
-
// ../../node_modules/.pnpm/chalk@
|
|
11902
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
11903
|
-
let index = string.indexOf(substring);
|
|
11904
|
-
if (index === -1) {
|
|
11905
|
-
return string;
|
|
11906
|
-
}
|
|
11907
|
-
const substringLength = substring.length;
|
|
11908
|
-
let endIndex = 0;
|
|
11909
|
-
let returnValue = "";
|
|
11910
|
-
do {
|
|
11911
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
11912
|
-
endIndex = index + substringLength;
|
|
11913
|
-
index = string.indexOf(substring, endIndex);
|
|
11914
|
-
} while (index !== -1);
|
|
11915
|
-
returnValue += string.slice(endIndex);
|
|
11916
|
-
return returnValue;
|
|
11917
|
-
}
|
|
11918
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
11919
|
-
let endIndex = 0;
|
|
11920
|
-
let returnValue = "";
|
|
11921
|
-
do {
|
|
11922
|
-
const gotCR = string[index - 1] === "\r";
|
|
11923
|
-
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
11924
|
-
endIndex = index + 1;
|
|
11925
|
-
index = string.indexOf("\n", endIndex);
|
|
11926
|
-
} while (index !== -1);
|
|
11927
|
-
returnValue += string.slice(endIndex);
|
|
11928
|
-
return returnValue;
|
|
11929
|
-
}
|
|
11930
|
-
|
|
11931
|
-
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
11981
|
+
// ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/index.js
|
|
11932
11982
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
11933
11983
|
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
11934
11984
|
var STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
11935
11985
|
var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
11936
|
-
var
|
|
11937
|
-
"ansi",
|
|
11938
|
-
"ansi",
|
|
11939
|
-
"ansi256",
|
|
11940
|
-
"ansi16m"
|
|
11941
|
-
];
|
|
11986
|
+
var LEVEL = /* @__PURE__ */ Symbol("LEVEL");
|
|
11942
11987
|
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
11988
|
+
var assertValidLevel = (level) => {
|
|
11989
|
+
if (!Number.isSafeInteger(level) || level < 0 || level > 3) {
|
|
11990
|
+
throw new Error("The `level` should be an integer from 0 to 3");
|
|
11991
|
+
}
|
|
11992
|
+
};
|
|
11993
|
+
var levelDescriptor = {
|
|
11994
|
+
enumerable: true,
|
|
11995
|
+
get() {
|
|
11996
|
+
return this[LEVEL];
|
|
11997
|
+
},
|
|
11998
|
+
set(level) {
|
|
11999
|
+
assertValidLevel(level);
|
|
12000
|
+
this[LEVEL] = level;
|
|
12001
|
+
}
|
|
12002
|
+
};
|
|
11943
12003
|
var applyOptions = (object, options = {}) => {
|
|
11944
|
-
if (options.level
|
|
11945
|
-
|
|
12004
|
+
if (options.level !== void 0) {
|
|
12005
|
+
assertValidLevel(options.level);
|
|
11946
12006
|
}
|
|
11947
12007
|
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
11948
|
-
object
|
|
12008
|
+
object[LEVEL] = options.level === void 0 ? colorLevel : options.level;
|
|
11949
12009
|
};
|
|
11950
12010
|
var chalkFactory = (options) => {
|
|
11951
12011
|
const chalk2 = (...strings) => strings.join(" ");
|
|
@@ -11973,56 +12033,59 @@ styles2.visible = {
|
|
|
11973
12033
|
return builder;
|
|
11974
12034
|
}
|
|
11975
12035
|
};
|
|
11976
|
-
var
|
|
12036
|
+
var createModelConverters = (model, type) => {
|
|
12037
|
+
const style = ansi_styles_default[type];
|
|
11977
12038
|
if (model === "rgb") {
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
|
|
11981
|
-
if (level === "ansi256") {
|
|
11982
|
-
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
11983
|
-
}
|
|
11984
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
12039
|
+
const ansi2 = (red, green, blue) => style.ansi(ansi_styles_default.rgbToAnsi(red, green, blue));
|
|
12040
|
+
const ansi256 = (red, green, blue) => style.ansi256(ansi_styles_default.rgbToAnsi256(red, green, blue));
|
|
12041
|
+
return [ansi2, ansi2, ansi256, style.ansi16m];
|
|
11985
12042
|
}
|
|
11986
12043
|
if (model === "hex") {
|
|
11987
|
-
|
|
12044
|
+
const ansi2 = (hex) => style.ansi(ansi_styles_default.hexToAnsi(hex));
|
|
12045
|
+
const ansi256 = (hex) => style.ansi256(ansi_styles_default.hexToAnsi256(hex));
|
|
12046
|
+
return [ansi2, ansi2, ansi256, (hex) => style.ansi16m(...ansi_styles_default.hexToRgb(hex))];
|
|
11988
12047
|
}
|
|
11989
|
-
|
|
12048
|
+
const ansi = (code) => style.ansi(ansi_styles_default.ansi256ToAnsi(code));
|
|
12049
|
+
return [ansi, ansi, style.ansi256, style.ansi256];
|
|
11990
12050
|
};
|
|
11991
12051
|
var usedModels = ["rgb", "hex", "ansi256"];
|
|
11992
12052
|
for (const model of usedModels) {
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
return
|
|
12009
|
-
}
|
|
12010
|
-
}
|
|
12011
|
-
}
|
|
12053
|
+
const capitalizedModel = model[0].toUpperCase() + model.slice(1);
|
|
12054
|
+
for (const [styleName, type] of [
|
|
12055
|
+
[model, "color"],
|
|
12056
|
+
["bg" + capitalizedModel, "bgColor"],
|
|
12057
|
+
["underline" + capitalizedModel, "underlineColor"]
|
|
12058
|
+
]) {
|
|
12059
|
+
const { close } = ansi_styles_default[type];
|
|
12060
|
+
const converters = createModelConverters(model, type);
|
|
12061
|
+
styles2[styleName] = {
|
|
12062
|
+
get() {
|
|
12063
|
+
const styleFunction = function(first, second, third) {
|
|
12064
|
+
const open = converters[this.level](first, second, third);
|
|
12065
|
+
return createBuilder(this, createStyler(open, close, this[STYLER]), this[IS_EMPTY]);
|
|
12066
|
+
};
|
|
12067
|
+
Object.defineProperty(this, styleName, { value: styleFunction });
|
|
12068
|
+
return styleFunction;
|
|
12069
|
+
}
|
|
12070
|
+
};
|
|
12071
|
+
}
|
|
12012
12072
|
}
|
|
12013
|
-
var proto = Object.defineProperties(
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12073
|
+
var proto = Object.defineProperties(
|
|
12074
|
+
() => {
|
|
12075
|
+
},
|
|
12076
|
+
{
|
|
12077
|
+
...styles2,
|
|
12078
|
+
level: {
|
|
12079
|
+
enumerable: true,
|
|
12080
|
+
get() {
|
|
12081
|
+
return this[GENERATOR].level;
|
|
12082
|
+
},
|
|
12083
|
+
set(level) {
|
|
12084
|
+
this[GENERATOR].level = level;
|
|
12085
|
+
}
|
|
12023
12086
|
}
|
|
12024
12087
|
}
|
|
12025
|
-
|
|
12088
|
+
);
|
|
12026
12089
|
var createStyler = (open, close, parent) => {
|
|
12027
12090
|
let openAll;
|
|
12028
12091
|
let closeAll;
|
|
@@ -12042,15 +12105,23 @@ var createStyler = (open, close, parent) => {
|
|
|
12042
12105
|
};
|
|
12043
12106
|
};
|
|
12044
12107
|
var createBuilder = (self, _styler, _isEmpty) => {
|
|
12045
|
-
const builder = (...arguments_) =>
|
|
12108
|
+
const builder = (...arguments_) => {
|
|
12109
|
+
if (arguments_.length === 1) {
|
|
12110
|
+
return applyStyle(builder, "" + arguments_[0]);
|
|
12111
|
+
}
|
|
12112
|
+
if (arguments_.length === 2) {
|
|
12113
|
+
return applyStyle(builder, `${arguments_[0] ?? ""} ${arguments_[1] ?? ""}`);
|
|
12114
|
+
}
|
|
12115
|
+
return applyStyle(builder, arguments_.join(" "));
|
|
12116
|
+
};
|
|
12046
12117
|
Object.setPrototypeOf(builder, proto);
|
|
12047
|
-
builder[GENERATOR] = self;
|
|
12118
|
+
builder[GENERATOR] = self[GENERATOR] ?? self;
|
|
12048
12119
|
builder[STYLER] = _styler;
|
|
12049
12120
|
builder[IS_EMPTY] = _isEmpty;
|
|
12050
12121
|
return builder;
|
|
12051
12122
|
};
|
|
12052
12123
|
var applyStyle = (self, string) => {
|
|
12053
|
-
if (self
|
|
12124
|
+
if (self[GENERATOR][LEVEL] <= 0 || !string) {
|
|
12054
12125
|
return self[IS_EMPTY] ? "" : string;
|
|
12055
12126
|
}
|
|
12056
12127
|
let styler = self[STYLER];
|
|
@@ -12070,7 +12141,7 @@ var applyStyle = (self, string) => {
|
|
|
12070
12141
|
}
|
|
12071
12142
|
return openAll + string + closeAll;
|
|
12072
12143
|
};
|
|
12073
|
-
Object.defineProperties(createChalk.prototype, styles2);
|
|
12144
|
+
Object.defineProperties(createChalk.prototype, { ...styles2, level: levelDescriptor });
|
|
12074
12145
|
var chalk = createChalk();
|
|
12075
12146
|
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
12076
12147
|
var source_default = chalk;
|
|
@@ -18297,6 +18368,75 @@ var DEFAULT_RULES = [
|
|
|
18297
18368
|
},
|
|
18298
18369
|
enabled: true
|
|
18299
18370
|
},
|
|
18371
|
+
{
|
|
18372
|
+
// The slow twin of paywall-hammering. A caller that paces itself under 30 a
|
|
18373
|
+
// minute never trips that rule, yet twenty 402s in ten minutes from one
|
|
18374
|
+
// address is not a reader deciding whether to pay: it has been told the
|
|
18375
|
+
// price twenty times and kept walking. DataForSeoBot took ~21k pages a day
|
|
18376
|
+
// from ONE address on watchnews.now (2026-10-19), about 15 a minute.
|
|
18377
|
+
//
|
|
18378
|
+
// A podcast app polling a paid feed, or a person who hit the free limit and
|
|
18379
|
+
// clicks a few more links, stays far under this. FCrDNS-verified search
|
|
18380
|
+
// crawlers are spared by remediation whatever they trip, and every ban
|
|
18381
|
+
// follows the ladder, so a first offence is minutes, not days.
|
|
18382
|
+
id: "paywall-ignored",
|
|
18383
|
+
title: "Paywall Ignored",
|
|
18384
|
+
description: "One source kept requesting after twenty 402 Payment Required answers in ten minutes",
|
|
18385
|
+
version: "1.0.0",
|
|
18386
|
+
category: "web",
|
|
18387
|
+
severity: "high",
|
|
18388
|
+
source_types: ["log-watcher", "web"],
|
|
18389
|
+
match: {
|
|
18390
|
+
field: "message",
|
|
18391
|
+
operator: "regex",
|
|
18392
|
+
value: "Client error 402:"
|
|
18393
|
+
},
|
|
18394
|
+
threshold: 20,
|
|
18395
|
+
window_seconds: 600,
|
|
18396
|
+
cooldown_seconds: 600,
|
|
18397
|
+
tags: ["web", "scraper", "x402", "paywall"],
|
|
18398
|
+
remediation: {
|
|
18399
|
+
action: "block",
|
|
18400
|
+
description: "Block a caller that keeps requesting after being told the price"
|
|
18401
|
+
},
|
|
18402
|
+
enabled: true
|
|
18403
|
+
},
|
|
18404
|
+
{
|
|
18405
|
+
// A crawler that names itself as a scraper (a headless browser, an SEO
|
|
18406
|
+
// reseller) and is refused with a 402 has its answer; a fifth one inside five
|
|
18407
|
+
// minutes from the same address means it is ignoring it. The gateway charges
|
|
18408
|
+
// these by name (x402-gateway 0.8: HEADLESS_AGENTS + SCRAPER_AGENTS) and the
|
|
18409
|
+
// resellers are refused in robots.txt too, so nothing welcome matches here.
|
|
18410
|
+
// Search crawlers (Googlebot, bingbot, Applebot) are deliberately absent.
|
|
18411
|
+
id: "paywall-declared-scraper",
|
|
18412
|
+
title: "Declared Scraper Ignoring the Paywall",
|
|
18413
|
+
description: "A self-declared scraper or headless browser keeps requesting after 402 answers",
|
|
18414
|
+
version: "1.0.0",
|
|
18415
|
+
category: "web",
|
|
18416
|
+
severity: "high",
|
|
18417
|
+
source_types: ["log-watcher", "web"],
|
|
18418
|
+
match: {
|
|
18419
|
+
field: "message",
|
|
18420
|
+
operator: "regex",
|
|
18421
|
+
value: "Client error 402:",
|
|
18422
|
+
and: [
|
|
18423
|
+
{
|
|
18424
|
+
field: "ua",
|
|
18425
|
+
operator: "regex",
|
|
18426
|
+
value: "(Lightpanda|HeadlessChrome|PhantomJS|AhrefsBot|SemrushBot|MJ12bot|DataForSeoBot|DotBot|BLEXBot|serpstatbot|Barkrowler)"
|
|
18427
|
+
}
|
|
18428
|
+
]
|
|
18429
|
+
},
|
|
18430
|
+
threshold: 5,
|
|
18431
|
+
window_seconds: 300,
|
|
18432
|
+
cooldown_seconds: 600,
|
|
18433
|
+
tags: ["web", "scraper", "x402", "paywall", "headless"],
|
|
18434
|
+
remediation: {
|
|
18435
|
+
action: "block",
|
|
18436
|
+
description: "Block a declared scraper that keeps requesting after being told the price"
|
|
18437
|
+
},
|
|
18438
|
+
enabled: true
|
|
18439
|
+
},
|
|
18300
18440
|
{
|
|
18301
18441
|
// The distributed twin of paywall-hammering. A proxy swarm asks once per
|
|
18302
18442
|
// address — 189k 402s across 111k IPs, ~1.7 each, observed on dev2's
|
|
@@ -18760,7 +18900,7 @@ var import_node_net10 = require("net");
|
|
|
18760
18900
|
|
|
18761
18901
|
// src/daemon/firewall/crawlers.ts
|
|
18762
18902
|
var import_node_dns = require("dns");
|
|
18763
|
-
var CRAWLER_DOMAINS = ["googlebot.com", "google.com", "search.msn.com"];
|
|
18903
|
+
var CRAWLER_DOMAINS = ["googlebot.com", "google.com", "search.msn.com", "applebot.apple.com"];
|
|
18764
18904
|
var systemResolver = {
|
|
18765
18905
|
reverse: (ip) => import_node_dns.promises.reverse(ip),
|
|
18766
18906
|
lookup: async (host) => (await import_node_dns.promises.lookup(host, { all: true })).map((a) => a.address)
|