@daemonitor/plugins 1.1.42 → 1.1.43
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.
|
@@ -32,8 +32,8 @@ export function reportStart(today) {
|
|
|
32
32
|
}
|
|
33
33
|
export function reportUrl(account, start, end, bySite = false) {
|
|
34
34
|
const q = new URLSearchParams({ dateRange: "CUSTOM", reportingTimeZone: "ACCOUNT_TIME_ZONE", dimensions: "DATE" });
|
|
35
|
-
// DOMAIN_NAME, not OWNED_SITE_DOMAIN_NAME: the owned-site rows nest (
|
|
36
|
-
// contains www.
|
|
35
|
+
// DOMAIN_NAME, not OWNED_SITE_DOMAIN_NAME: the owned-site rows nest (example.com
|
|
36
|
+
// contains www.example.com and jobs.example.com), so they double count.
|
|
37
37
|
if (bySite)
|
|
38
38
|
q.append("dimensions", "DOMAIN_NAME");
|
|
39
39
|
for (const [k, v] of [["startDate", start], ["endDate", end]]) {
|
|
@@ -183,7 +183,7 @@ export function createAdsensePlugin() {
|
|
|
183
183
|
}
|
|
184
184
|
catch { /* totals only */ }
|
|
185
185
|
return {
|
|
186
|
-
// The account's own name
|
|
186
|
+
// The account's own name labels the service.
|
|
187
187
|
// It overrides the plugin's instance name, which only says "AdSense".
|
|
188
188
|
...(account.displayName ? { name: account.displayName } : {}),
|
|
189
189
|
accountId: account.name,
|
|
@@ -102,7 +102,7 @@ export function pagesRequest(startDate, exclude = []) {
|
|
|
102
102
|
const bareHost = (h) => h.trim().toLowerCase().replace(/^www\./, "");
|
|
103
103
|
/**
|
|
104
104
|
* A pages report -> the most viewed pages per host. `/a` and `/a/` add up, and a
|
|
105
|
-
* site name most titles end in (" |
|
|
105
|
+
* site name most titles end in (" | Example Site") comes off.
|
|
106
106
|
*/
|
|
107
107
|
export function parsePages(report) {
|
|
108
108
|
const rows = (report?.rows || []).map((r) => ({
|
|
@@ -28,7 +28,7 @@ function parseLine(line) {
|
|
|
28
28
|
const ips = tokens.filter((t) => IP_TOKEN.test(t));
|
|
29
29
|
const ip = ips.length ? ips[ips.length - 1] : (tokens[0] || "");
|
|
30
30
|
// A host in the leading field is what lets a SHARED access log (one file for
|
|
31
|
-
// every vhost
|
|
31
|
+
// every vhost) still say WHICH site was hit. A plain
|
|
32
32
|
// combined line leads with the client IP instead, so only a non-IP first
|
|
33
33
|
// token counts. When $host is itself an IP — a request made straight to the
|
|
34
34
|
// origin address — there is no site name to report and "" is correct.
|
|
@@ -196,7 +196,7 @@ export function analyze(lines, cfg, windowSec, st, rules = []) {
|
|
|
196
196
|
// batch/v1 finding so it leads.
|
|
197
197
|
// Only call it a takeover when the login status is trustworthy for this site
|
|
198
198
|
// AND the IP went on to load an admin screen successfully. Either half alone
|
|
199
|
-
//
|
|
199
|
+
// would page a false "account takeover".
|
|
200
200
|
const authed = (ip) => !st?.hideLogin && loginOkIps.has(ip) && adminOkIps.has(ip);
|
|
201
201
|
for (const [ip, count] of batchIps) {
|
|
202
202
|
if (authed(ip)) {
|
|
@@ -4,7 +4,7 @@ import { readdir } from "node:fs/promises";
|
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { createMonitoringPlugin } from "../../lib/MonitoringPlugin.js";
|
|
6
6
|
// WordPress security-posture plugin. Runs on the WP host (where the daemonitor
|
|
7
|
-
// client already runs) and polls the state that
|
|
7
|
+
// client already runs) and polls the state that WordPress intrusions tend to move
|
|
8
8
|
// through: admin accounts, page statuses, must-use plugins, and the web user's
|
|
9
9
|
// crontab. It emits raw observations only — severity and the new-admin /
|
|
10
10
|
// admin-demotion DIFFS are decided server-side in the ingest handler
|
|
@@ -16,11 +16,11 @@ import { createMonitoringPlugin } from "../../lib/MonitoringPlugin.js";
|
|
|
16
16
|
// is best-effort and isolated: one failing (e.g. crontab needs root) degrades
|
|
17
17
|
// that one field to null, it never kills the poll.
|
|
18
18
|
const pexec = promisify(execFile);
|
|
19
|
-
// Service-account naming patterns
|
|
19
|
+
// Service-account naming patterns common in WordPress intrusions. Any admin
|
|
20
20
|
// whose login/email contains one of these (case-insensitive substring) is
|
|
21
21
|
// flagged for escalation even before the new-admin diff fires.
|
|
22
22
|
const DEFAULT_SERVICE_PATTERNS = [
|
|
23
|
-
"wpsvc", "wpengine", "bot", "svc", "
|
|
23
|
+
"wpsvc", "wpengine", "bot", "svc", "wordpress-svc",
|
|
24
24
|
];
|
|
25
25
|
const DEFAULT_CRITICAL_PAGES = ["login", "home", "index", "front-page"];
|
|
26
26
|
function slug(s) {
|