@chainpatrol/cli 1.17.2 → 1.18.0
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @chainpatrol/cli
|
|
2
2
|
|
|
3
|
+
## 1.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 34e7f89: `/metrics/takedown-time` can now be narrowed to several asset types at once, either
|
|
8
|
+
individually (`assetTypes`) or by the app's asset-type filter groups
|
|
9
|
+
(`assetTypeGroups`, e.g. `DOMAINS`, `SOCIALS`). It also returns `overall`: one
|
|
10
|
+
median pooled across every takedown in scope, which cannot be worked out from the
|
|
11
|
+
per-asset-type medians. The CLI exposes these as `chainpatrol metrics takedown-time
|
|
12
|
+
--asset-type <list> --asset-group <list>` and prints the overall median first.
|
|
13
|
+
Server-side work in @chainpatrol/validation, @chainpatrol/external-trpc and
|
|
14
|
+
@chainpatrol/metrics supports this; those are private packages.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 3c71e43: Time-to-takedown results carry `excludedAssetTypes`: the asset types the API left out because no asset-type filter was given (crypto addresses by default). `chainpatrol metrics takedown-time` and `takedown-time-trend` now label the unfiltered median "all asset types except ADDRESS" instead of "all asset types", and their help explains the default.
|
|
19
|
+
- Updated dependencies [3c71e43]
|
|
20
|
+
- Updated dependencies [34e7f89]
|
|
21
|
+
- Updated dependencies [3c71e43]
|
|
22
|
+
- @chainpatrol/sdk@1.18.0
|
|
23
|
+
- @chainpatrol/mcp@1.16.0
|
|
24
|
+
|
|
3
25
|
## 1.17.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/cli.js
CHANGED
|
@@ -361,14 +361,20 @@ var HELP = {
|
|
|
361
361
|
]
|
|
362
362
|
},
|
|
363
363
|
"metrics takedown-time": {
|
|
364
|
-
description: "Median time from takedown start to completion, per asset type. Defaults to the trailing 3 months if no date range is given.",
|
|
365
|
-
usage: "chainpatrol metrics takedown-time --org <slug> [--from ISO --to ISO|--this-week]",
|
|
364
|
+
description: "Median time from takedown start to completion: one overall median pooled across every takedown in scope, plus one per asset type. Narrow to asset types or to the app's asset-type groups (Domains, Socials, \u2026). Defaults to the trailing 3 months if no date range is given. Crypto addresses (ADDRESS) are left out unless you ask for them with --asset-type ADDRESS or --asset-group CRYPTO: an address is reported on many sites at once, and how long its takedown takes depends on how many platforms are covered.",
|
|
365
|
+
usage: "chainpatrol metrics takedown-time --org <slug> [--from ISO --to ISO|--this-week] [--asset-type URL,TWITTER] [--asset-group DOMAINS,SOCIALS]",
|
|
366
366
|
options: [
|
|
367
367
|
"--org <slug> Organization slug",
|
|
368
368
|
"--from <iso> Start date (ISO 8601)",
|
|
369
369
|
"--to <iso> End date (ISO 8601); a date-only value covers the whole day",
|
|
370
370
|
"--this-week Use the current ISO week (overrides default)",
|
|
371
|
-
"--brand <ids> Comma-separated brand IDs"
|
|
371
|
+
"--brand <ids> Comma-separated brand IDs",
|
|
372
|
+
"--asset-type <types> Comma-separated asset types to include",
|
|
373
|
+
"--asset-group <list> Comma-separated asset-type groups to include: DOMAINS, SOCIALS, APP_STORES, ADS, EXTENSIONS, CRYPTO, EMAIL, PACKAGES, OTHER. Unioned with --asset-type"
|
|
374
|
+
],
|
|
375
|
+
examples: [
|
|
376
|
+
"chainpatrol metrics takedown-time --org acme --asset-group DOMAINS",
|
|
377
|
+
"chainpatrol metrics takedown-time --org acme --asset-group SOCIALS --asset-type EMAIL"
|
|
372
378
|
]
|
|
373
379
|
},
|
|
374
380
|
"metrics time-to-detection": {
|
|
@@ -383,7 +389,7 @@ var HELP = {
|
|
|
383
389
|
]
|
|
384
390
|
},
|
|
385
391
|
"metrics takedown-time-trend": {
|
|
386
|
-
description: "Median time from takedown start to completion bucketed by month, over a trailing window, with the month-over-month change.",
|
|
392
|
+
description: "Median time from takedown start to completion bucketed by month, over a trailing window, with the month-over-month change. Crypto addresses (ADDRESS) are left out of the pooled series unless you pass --asset-type ADDRESS.",
|
|
387
393
|
usage: "chainpatrol metrics takedown-time-trend --org <slug> [--months 12] [--asset-type TWITTER,URL]",
|
|
388
394
|
options: [
|
|
389
395
|
"--org <slug> Organization slug",
|
|
@@ -1095,6 +1101,7 @@ ${getTopLevelHelp()}
|
|
|
1095
1101
|
pendingApprovalService: { type: "string" },
|
|
1096
1102
|
query: { type: "string" },
|
|
1097
1103
|
assetType: { type: "string" },
|
|
1104
|
+
assetGroup: { type: "string" },
|
|
1098
1105
|
takedownStatus: { type: "string" },
|
|
1099
1106
|
livenessStatus: { type: "string" },
|
|
1100
1107
|
nextPage: { type: "string" },
|
|
@@ -1622,13 +1629,15 @@ async function main() {
|
|
|
1622
1629
|
break;
|
|
1623
1630
|
}
|
|
1624
1631
|
if (subcommand === "takedown-time" || subcommand === "takedownTime") {
|
|
1625
|
-
const { runMetricsTakedownTime } = await import("./takedown-time-
|
|
1632
|
+
const { runMetricsTakedownTime } = await import("./takedown-time-35OTRJWA.js");
|
|
1626
1633
|
await runMetricsTakedownTime({
|
|
1627
1634
|
org,
|
|
1628
1635
|
from: cli.flags.from,
|
|
1629
1636
|
to: cli.flags.to,
|
|
1630
1637
|
thisWeek: cli.flags.thisWeek,
|
|
1631
1638
|
brandIds: parseBrandIds(),
|
|
1639
|
+
assetTypes: parseCsvList(cli.flags.assetType),
|
|
1640
|
+
assetTypeGroups: parseCsvList(cli.flags.assetGroup),
|
|
1632
1641
|
json: jsonMode,
|
|
1633
1642
|
outputFormat: cliContext.outputFormat
|
|
1634
1643
|
});
|
|
@@ -1648,7 +1657,7 @@ async function main() {
|
|
|
1648
1657
|
break;
|
|
1649
1658
|
}
|
|
1650
1659
|
if (subcommand === "takedown-time-trend" || subcommand === "takedownTimeTrend") {
|
|
1651
|
-
const { runMetricsTakedownTimeTrend } = await import("./takedown-time-trend-
|
|
1660
|
+
const { runMetricsTakedownTimeTrend } = await import("./takedown-time-trend-3PWWE2D3.js");
|
|
1652
1661
|
await runMetricsTakedownTimeTrend({
|
|
1653
1662
|
org,
|
|
1654
1663
|
months: cli.flags.months,
|
|
@@ -26,12 +26,26 @@ function formatDuration(hours) {
|
|
|
26
26
|
}
|
|
27
27
|
return `${(hours / 24).toFixed(1)}d`;
|
|
28
28
|
}
|
|
29
|
+
function formatMedian(label, row) {
|
|
30
|
+
return `${label}: ${formatDuration(row.medianTakedownHours)} (${row.count} takedowns)`;
|
|
31
|
+
}
|
|
32
|
+
function describeAssetTypeScope(assetTypes, assetTypeGroups, excludedAssetTypes = []) {
|
|
33
|
+
const parts = [...assetTypeGroups ?? [], ...assetTypes ?? []];
|
|
34
|
+
if (parts.length > 0) {
|
|
35
|
+
return parts.join(", ");
|
|
36
|
+
}
|
|
37
|
+
return excludedAssetTypes.length > 0 ? `all asset types except ${excludedAssetTypes.join(", ")}` : "all asset types";
|
|
38
|
+
}
|
|
29
39
|
async function runMetricsTakedownTime(options) {
|
|
30
40
|
const range = resolveDateRange({
|
|
31
41
|
from: options.from,
|
|
32
42
|
to: options.to,
|
|
33
43
|
thisWeek: options.thisWeek
|
|
34
44
|
});
|
|
45
|
+
const assetTypes = options.assetTypes?.map((assetType) => assetType.toUpperCase());
|
|
46
|
+
const assetTypeGroups = options.assetTypeGroups?.map(
|
|
47
|
+
(group) => group.toUpperCase()
|
|
48
|
+
);
|
|
35
49
|
const client = options.apiClient ?? createApiClient();
|
|
36
50
|
const result = await client.getMetricsTakedownTime({
|
|
37
51
|
slug: options.org,
|
|
@@ -41,8 +55,16 @@ async function runMetricsTakedownTime(options) {
|
|
|
41
55
|
// day off.
|
|
42
56
|
startDate: options.from ?? range.startDate,
|
|
43
57
|
endDate: options.to ?? range.endDate,
|
|
44
|
-
brandIds: options.brandIds
|
|
58
|
+
brandIds: options.brandIds,
|
|
59
|
+
assetTypes,
|
|
60
|
+
assetTypeGroups
|
|
45
61
|
});
|
|
62
|
+
const scope = describeAssetTypeScope(
|
|
63
|
+
assetTypes,
|
|
64
|
+
assetTypeGroups,
|
|
65
|
+
result.excludedAssetTypes
|
|
66
|
+
);
|
|
67
|
+
const overallLabel = `Overall (${scope})`;
|
|
46
68
|
const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
|
|
47
69
|
printOutput({
|
|
48
70
|
outputFormat,
|
|
@@ -52,12 +74,14 @@ async function runMetricsTakedownTime(options) {
|
|
|
52
74
|
"",
|
|
53
75
|
`- Range: ${range.startDate} \u2192 ${range.endDate}`,
|
|
54
76
|
"",
|
|
55
|
-
...result.
|
|
56
|
-
|
|
57
|
-
)
|
|
77
|
+
...result.overall ? [`- ${formatMedian(overallLabel, result.overall)}`, ""] : [],
|
|
78
|
+
...result.byAssetType.map((row) => `- ${formatMedian(row.assetType, row)}`)
|
|
58
79
|
].join("\n"),
|
|
59
80
|
csv: toCsvRows(
|
|
60
|
-
|
|
81
|
+
[
|
|
82
|
+
...result.overall ? [{ ...result.overall, assetType: "ALL" }] : [],
|
|
83
|
+
...result.byAssetType
|
|
84
|
+
].map((row) => ({
|
|
61
85
|
rangeLabel: range.label,
|
|
62
86
|
startDate: range.startDate,
|
|
63
87
|
endDate: range.endDate,
|
|
@@ -72,17 +96,19 @@ async function runMetricsTakedownTime(options) {
|
|
|
72
96
|
console.log(`Median time to takedown for ${options.org} \u2014 ${range.label}`);
|
|
73
97
|
console.log(`Range: ${range.startDate} \u2192 ${range.endDate}`);
|
|
74
98
|
if (result.byAssetType.length === 0) {
|
|
75
|
-
console.log(
|
|
99
|
+
console.log(`No completed takedowns in this range for ${scope}.`);
|
|
76
100
|
return;
|
|
77
101
|
}
|
|
102
|
+
if (result.overall) {
|
|
103
|
+
console.log(formatMedian(overallLabel, result.overall));
|
|
104
|
+
}
|
|
78
105
|
for (const row of result.byAssetType) {
|
|
79
|
-
console.log(
|
|
80
|
-
`${row.assetType}: ${formatDuration(row.medianTakedownHours)} (${row.count} takedowns)`
|
|
81
|
-
);
|
|
106
|
+
console.log(formatMedian(row.assetType, row));
|
|
82
107
|
}
|
|
83
108
|
}
|
|
84
109
|
});
|
|
85
110
|
}
|
|
86
111
|
export {
|
|
112
|
+
describeAssetTypeScope,
|
|
87
113
|
runMetricsTakedownTime
|
|
88
114
|
};
|
|
@@ -40,7 +40,8 @@ async function runMetricsTakedownTimeTrend(options) {
|
|
|
40
40
|
assetTypes: options.assetTypes,
|
|
41
41
|
brandIds: options.brandIds
|
|
42
42
|
});
|
|
43
|
-
const
|
|
43
|
+
const excluded = result.excludedAssetTypes ?? [];
|
|
44
|
+
const seriesLabel = (assetType) => assetType ?? (excluded.length > 0 ? `All asset types except ${excluded.join(", ")}` : "All asset types");
|
|
44
45
|
const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
|
|
45
46
|
printOutput({
|
|
46
47
|
outputFormat,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@chainpatrol/cli",
|
|
3
3
|
"description": "The official ChainPatrol CLI — terminal interface for threat detection",
|
|
4
4
|
"author": "Umar Ahmed <umar@chainpatrol.io>",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.18.0",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"homepage": "https://chainpatrol.com/docs/cli",
|
|
8
8
|
"keywords": [
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"lint": "npx oxlint ."
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@chainpatrol/mcp": "1.
|
|
37
|
-
"@chainpatrol/sdk": "1.
|
|
36
|
+
"@chainpatrol/mcp": "1.16.0",
|
|
37
|
+
"@chainpatrol/sdk": "1.18.0",
|
|
38
38
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
39
39
|
"ink": "^7.0.1",
|
|
40
40
|
"meow": "^14.1.0",
|