@profullstack/threatcrush 0.13.3 → 0.13.4

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 CHANGED
@@ -42,20 +42,28 @@
42
42
 
43
43
  ---
44
44
 
45
- ThreatCrush is a security daemon that runs on your server, monitoring **every connection on every port**. It detects live attacks, scans your codebase, pentests your APIs, and alerts you in real-time.
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 21 attack signatures, runs 12 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
49
49
 
50
- [12:03:41] ✓ Monitoring all ports · nginx · sshd · postgres
51
- [12:03:42] ✓ Loaded 1,247 attack signatures
52
- [12:03:45] ⚠ SQLi attempt — :443 185.43.21.8 → /api/users?id=1 OR 1=1
53
- [12:03:47] ✗ SSH brute force — :22 91.232.105.3 → 47 failed attempts
54
- [12:03:50] ⚠ Port scan — 45.33.32.156 scanning :21-:8080 (SYN flood)
55
- [12:03:52] ⚠ DNS tunneling — :53 suspicious TXT queries from 103.44.8.2
56
- [12:04:01] ✓ 3,891 connections analyzed · 4 threats · 1 blocked
50
+ 2026-09-25 12:03:41 [INFO] Starting foreground monitor...
51
+ 2026-09-25 12:03:41 [INFO] Monitoring 3 log source(s):
52
+ ● ssh-guard → /var/log/auth.log
53
+ ● log-watcher → /var/log/nginx/access.log
54
+ ● log-watcher → /var/log/syslog
55
+
56
+ Press Ctrl+C to stop
57
+
58
+ 2026-09-25 12:03:45 [CRITICAL] [log-watcher] Attack detected [SQLI]: GET /api/users?id=1%20OR%201=1 (185.43.21.8)
59
+ 2026-09-25 12:03:46 [CRITICAL] [log-watcher] Attack detected [PATH_TRAVERSAL]: GET /../../etc/passwd (185.43.21.8)
60
+ 2026-09-25 12:03:47 [HIGH] [ssh-guard] Failed SSH login for root from 91.232.105.3 (91.232.105.3)
61
+ 2026-09-25 12:03:48 [HIGH] [ssh-guard] Invalid SSH user attempt: admin123 from 103.77.88.99 (103.77.88.99)
62
+ 2026-09-25 12:03:52 [LOW] [log-watcher] Client error 404: GET /wp-login.php (203.0.113.9)
57
63
  ```
58
64
 
65
+ `monitor` tails your logs in the foreground. The daemon (`threatcrush start`) adds the connection poller, DNS monitor, journald, the rule engine and auto-ban.
66
+
59
67
  ## Install
60
68
 
61
69
  **Preferred install:**
@@ -91,11 +99,11 @@ bun add -g @profullstack/threatcrush
91
99
 
92
100
  ```bash
93
101
  threatcrush # Get started
94
- threatcrush monitor # Real-time security monitoring (all ports)
102
+ threatcrush monitor # Watch nginx, auth & syslog for attacks (foreground)
95
103
  threatcrush tui # Interactive dashboard (htop for security)
96
104
  threatcrush scan ./src # Scan code for vulnerabilities & secrets
97
105
  threatcrush scan . --format sarif --output out.sarif --fail-on critical,high
98
- threatcrush pentest URL # Penetration test a URL/API
106
+ threatcrush pentest URL # Quick web security checks against a URL
99
107
  threatcrush init # Auto-detect services, generate config
100
108
  threatcrush status # Show daemon status & loaded modules
101
109
  threatcrush modules # Manage security modules
@@ -107,10 +115,10 @@ threatcrush update # Upgrade the CLI using the supported path
107
115
 
108
116
  | Feature | Description |
109
117
  |---------|-------------|
110
- | 🔍 **Live Attack Detection** | Monitors all inbound connections on every port. Detects SQLi, XSS, brute force, SSH attacks, port scans, DNS tunneling. |
118
+ | 🔍 **Live Attack Detection** | Tails nginx, auth, syslog and journald, and polls inbound connections to the ports you serve. Detects SQLi, XSS, path traversal, RFI, SSH brute force, port scans, SYN floods, DNS tunneling. |
111
119
  | 🛡️ **Code Security Scanner** | Scan your codebase for vulnerabilities, hardcoded secrets, and misconfigurations. |
112
- | 💥 **Pentest Engine** | Automated penetration testing on your URLs and APIs. |
113
- | 🔀 **Network Monitor** | Watches all TCP/UDP traffic across every port — HTTP, SSH, DNS, FTP, databases. |
120
+ | 💥 **Pentest Checks** | `threatcrush pentest URL` spot-checks security headers, CSP, CORS, cookie flags, server banners, directory listings and error leaks, then probes for SQL errors, path traversal and unsafe HTTP methods. |
121
+ | 🔀 **Network Monitor** | Polls conntrack/`ss` every 5 s for inbound TCP connections to your listening ports. Flags port scans (10+ ports in 30 s) and SYN floods (50+ half-open from one source). No packet capture. |
114
122
  | 🔔 **Real-time Alerts** | Slack, email, webhook notifications the instant a threat is detected. |
115
123
  | ⚙️ **systemd Daemon** | Runs as a background service on your server. Auto-starts on boot, monitors 24/7. |
116
124
  | 📊 **TUI Dashboard** | Interactive terminal dashboard — htop for security. |
@@ -124,21 +132,22 @@ threatcrush modules list # List installed
124
132
  threatcrush modules install ssh-guard # Install a module
125
133
  threatcrush modules install docker-monitor
126
134
  threatcrush store search "firewall" # Search marketplace
127
- threatcrush store publish ./my-module # Publish your own
135
+ threatcrush store publish https://github.com/you/my-module # Publish your own
128
136
  ```
129
137
 
130
- ### Core Modules (included)
131
-
132
- | Module | What it monitors |
133
- |--------|-----------------|
134
- | `network-monitor` | All TCP/UDP traffic, port scans, SYN floods |
135
- | `log-watcher` | nginx, Apache, syslog, journald |
136
- | `ssh-guard` | Failed logins, brute force, tunneling |
137
- | `code-scanner` | Vulnerabilities, secrets, dependency CVEs |
138
- | `pentest-engine` | SQLi, XSS, SSRF, API fuzzing |
139
- | `dns-monitor` | DNS tunneling, DGA detection |
140
- | `firewall-rules` | Auto-blocks via iptables/nftables |
141
- | `alert-system` | Slack, Discord, email, webhook, PagerDuty |
138
+ ### Built in
139
+
140
+ | Component | What it covers |
141
+ |-----------|----------------|
142
+ | `log-watcher` | nginx access log + syslog — 21 attack signatures (SQLi, XSS, path traversal, RFI) on every request |
143
+ | `ssh-guard` | auth.log / secure — failed logins, brute force, root logins, user enumeration |
144
+ | `user-journal` | journald — the systemd journal |
145
+ | `network-monitor` | Inbound connections to your listening ports — port scans, SYN floods |
146
+ | `dns-monitor` | Resolver logs (systemd-resolved, dnsmasq, bind, Pi-hole) — DNS tunneling, DGA detection |
147
+ | `threatcrush scan` | Vulnerabilities, secrets, dependency CVEs (OSV.dev, with `--deps`) |
148
+ | `threatcrush pentest` | Header, CORS, cookie, SQL-error, path-traversal and HTTP-method checks |
149
+ | auto-defend | Bans via fail2ban, nftables or iptables |
150
+ | alerts | Slack, Discord, email, webhook, PagerDuty |
142
151
 
143
152
  ### Community Modules
144
153
 
package/dist/daemon.js CHANGED
@@ -8804,6 +8804,38 @@ var DEFAULT_RULES = [
8804
8804
  },
8805
8805
  enabled: true
8806
8806
  },
8807
+ {
8808
+ // A 402 is a paywall saying "pay first". A caller that means to pay gets
8809
+ // one and pays; a podcast app polling a paid feed gets a handful an hour.
8810
+ // Thirty in a minute from one address is a scraper that ignores the answer
8811
+ // and keeps walking URLs: GoogleOther did ~40/min per IP against r4ck's
8812
+ // /api/v1/search on dev2, 2026-09-25. `web-scanner-detection` saw it too,
8813
+ // but it is `medium`, and auto-defence bans at `high` and above, so it fired
8814
+ // every minute and never banned. This one is `high` on purpose.
8815
+ //
8816
+ // It cannot see a proxy swarm that asks once per address; nothing per-IP can.
8817
+ id: "paywall-hammering",
8818
+ title: "Paywall Hammering",
8819
+ description: "Repeated 402 Payment Required responses to the same source",
8820
+ version: "1.0.0",
8821
+ category: "web",
8822
+ severity: "high",
8823
+ source_types: ["log-watcher", "web"],
8824
+ match: {
8825
+ field: "message",
8826
+ operator: "regex",
8827
+ value: "Client error 402:"
8828
+ },
8829
+ threshold: 30,
8830
+ window_seconds: 60,
8831
+ cooldown_seconds: 600,
8832
+ tags: ["web", "scraper", "x402", "paywall"],
8833
+ remediation: {
8834
+ action: "block",
8835
+ description: "Block a scraper that keeps walking a paywall without paying"
8836
+ },
8837
+ enabled: true
8838
+ },
8807
8839
  {
8808
8840
  id: "port-scan-indicator",
8809
8841
  title: "Port Scan Indicators",