@profullstack/threatcrush 0.13.47 → 0.13.49

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
@@ -39448,6 +39448,12 @@ async function useOrganization(slug) {
39448
39448
  var import_node_readline2 = __toESM(require("readline"));
39449
39449
  var import_node_os9 = require("os");
39450
39450
  init_cli_config();
39451
+ function connectionStatus(server, now = Date.now()) {
39452
+ const seen = server.last_seen ? Date.parse(server.last_seen) : NaN;
39453
+ const online = Number.isFinite(seen) && now - seen <= 3 * 60 * 1e3;
39454
+ if (!online) return "offline";
39455
+ return server.status === "unreachable" ? "unreachable" : "online";
39456
+ }
39451
39457
  async function serversCommand(options) {
39452
39458
  const { action, name, org } = options;
39453
39459
  if (action === "list" || !action) {
@@ -39620,7 +39626,8 @@ async function listServers(orgSlug) {
39620
39626
  console.log(source_default.dim(" Link this machine: threatcrush servers link\n"));
39621
39627
  return;
39622
39628
  }
39623
- for (const server of servers) {
39629
+ for (const raw of servers) {
39630
+ const server = { ...raw, status: connectionStatus(raw) };
39624
39631
  const statusColor = server.status === "online" ? source_default.green : server.status === "unreachable" ? source_default.red : source_default.gray;
39625
39632
  const statusDot = server.status === "online" ? "\u25CF" : "\u25CB";
39626
39633
  const self = server.id === config.server_id ? source_default.cyan(" (this machine)") : "";
@@ -44493,6 +44500,75 @@ var DEFAULT_RULES = [
44493
44500
  },
44494
44501
  enabled: true
44495
44502
  },
44503
+ {
44504
+ // The slow twin of paywall-hammering. A caller that paces itself under 30 a
44505
+ // minute never trips that rule, yet twenty 402s in ten minutes from one
44506
+ // address is not a reader deciding whether to pay: it has been told the
44507
+ // price twenty times and kept walking. DataForSeoBot took ~21k pages a day
44508
+ // from ONE address on watchnews.now (2026-10-19), about 15 a minute.
44509
+ //
44510
+ // A podcast app polling a paid feed, or a person who hit the free limit and
44511
+ // clicks a few more links, stays far under this. FCrDNS-verified search
44512
+ // crawlers are spared by remediation whatever they trip, and every ban
44513
+ // follows the ladder, so a first offence is minutes, not days.
44514
+ id: "paywall-ignored",
44515
+ title: "Paywall Ignored",
44516
+ description: "One source kept requesting after twenty 402 Payment Required answers in ten minutes",
44517
+ version: "1.0.0",
44518
+ category: "web",
44519
+ severity: "high",
44520
+ source_types: ["log-watcher", "web"],
44521
+ match: {
44522
+ field: "message",
44523
+ operator: "regex",
44524
+ value: "Client error 402:"
44525
+ },
44526
+ threshold: 20,
44527
+ window_seconds: 600,
44528
+ cooldown_seconds: 600,
44529
+ tags: ["web", "scraper", "x402", "paywall"],
44530
+ remediation: {
44531
+ action: "block",
44532
+ description: "Block a caller that keeps requesting after being told the price"
44533
+ },
44534
+ enabled: true
44535
+ },
44536
+ {
44537
+ // A crawler that names itself as a scraper (a headless browser, an SEO
44538
+ // reseller) and is refused with a 402 has its answer; a fifth one inside five
44539
+ // minutes from the same address means it is ignoring it. The gateway charges
44540
+ // these by name (x402-gateway 0.8: HEADLESS_AGENTS + SCRAPER_AGENTS) and the
44541
+ // resellers are refused in robots.txt too, so nothing welcome matches here.
44542
+ // Search crawlers (Googlebot, bingbot, Applebot) are deliberately absent.
44543
+ id: "paywall-declared-scraper",
44544
+ title: "Declared Scraper Ignoring the Paywall",
44545
+ description: "A self-declared scraper or headless browser keeps requesting after 402 answers",
44546
+ version: "1.0.0",
44547
+ category: "web",
44548
+ severity: "high",
44549
+ source_types: ["log-watcher", "web"],
44550
+ match: {
44551
+ field: "message",
44552
+ operator: "regex",
44553
+ value: "Client error 402:",
44554
+ and: [
44555
+ {
44556
+ field: "ua",
44557
+ operator: "regex",
44558
+ value: "(Lightpanda|HeadlessChrome|PhantomJS|AhrefsBot|SemrushBot|MJ12bot|DataForSeoBot|DotBot|BLEXBot|serpstatbot|Barkrowler)"
44559
+ }
44560
+ ]
44561
+ },
44562
+ threshold: 5,
44563
+ window_seconds: 300,
44564
+ cooldown_seconds: 600,
44565
+ tags: ["web", "scraper", "x402", "paywall", "headless"],
44566
+ remediation: {
44567
+ action: "block",
44568
+ description: "Block a declared scraper that keeps requesting after being told the price"
44569
+ },
44570
+ enabled: true
44571
+ },
44496
44572
  {
44497
44573
  // The distributed twin of paywall-hammering. A proxy swarm asks once per
44498
44574
  // address — 189k 402s across 111k IPs, ~1.7 each, observed on dev2's
@@ -44958,7 +45034,7 @@ init_backoff();
44958
45034
 
44959
45035
  // src/daemon/firewall/crawlers.ts
44960
45036
  var import_node_dns = require("dns");
44961
- var CRAWLER_DOMAINS = ["googlebot.com", "google.com", "search.msn.com"];
45037
+ var CRAWLER_DOMAINS = ["googlebot.com", "google.com", "search.msn.com", "applebot.apple.com"];
44962
45038
  var systemResolver = {
44963
45039
  reverse: (ip) => import_node_dns.promises.reverse(ip),
44964
45040
  lookup: async (host) => (await import_node_dns.promises.lookup(host, { all: true })).map((a) => a.address)