netriskscan-cli 1.6.2 → 2.0.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 +21 -0
- package/README.md +139 -214
- package/dist/cli.js +865 -433
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +35 -11
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [2.0.0](https://github.com/TeamQQ/netriskscan-cli/compare/v1.6.2...v2.0.0) (2026-12-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **cli:** require API keys and add credential and quota commands ([f68ca07](https://github.com/TeamQQ/netriskscan-cli/commit/f68ca074e9fe0cdfa180ff51fbf75a4b74f4a4e2))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* **cli:** CLI lookups require a Developer API key. Set NETRISKSCAN_API_KEY in automation or save an existing key in the OS credential store.
|
|
12
|
+
|
|
13
|
+
## CLI authentication and quota migration
|
|
14
|
+
|
|
15
|
+
- CLI queries now use authenticated Developer API access and retain success payloads and numeric exit codes.
|
|
16
|
+
- Add OS credential storage with `auth save`, `auth show`, `auth status`, and `auth logout`.
|
|
17
|
+
- Add `quota` as an alias for `usage`, quota warnings, and actionable quota exhaustion errors.
|
|
18
|
+
- Add `upgrade` and `billing` browser entry points. Automatic Google credential delivery and
|
|
19
|
+
Stripe payment verification require backend CLI endpoints.
|
|
20
|
+
- Set `NETRISKSCAN_API_KEY` in CI before moving from 1.x to 2.x.
|
|
21
|
+
|
|
1
22
|
## [1.6.2](https://github.com/TeamQQ/netriskscan-cli/compare/v1.6.1...v1.6.2) (2026-11-28)
|
|
2
23
|
|
|
3
24
|
|
package/README.md
CHANGED
|
@@ -27,19 +27,15 @@ Use the CLI for investigations and operational tasks. Use the TypeScript client
|
|
|
27
27
|
|
|
28
28
|
## Quick start
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
**Developer API requires a valid API Key.**
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
npx netriskscan-cli check
|
|
33
|
+
npx netriskscan-cli check 8.8.8.8
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<p align="center">
|
|
41
|
-
<img src="https://raw.githubusercontent.com/TeamQQ/netriskscan-cli/main/demo/netriskscan-demo.gif" alt="Live terminal demonstration of netriskscan-cli checking an IP and displaying its NetRiskScan Index, network details, location, and risk signals" width="700" />
|
|
42
|
-
</p>
|
|
36
|
+
With no configured key in an interactive terminal, the CLI opens the Developer Console.
|
|
37
|
+
Select **Continue with Google**, create an API key, then [save it](#getting-an-api-key)
|
|
38
|
+
and rerun the query. With a configured key the lookup runs immediately.
|
|
43
39
|
|
|
44
40
|
## Product overview
|
|
45
41
|
|
|
@@ -65,14 +61,14 @@ NetRiskScan provides diagnostic network intelligence, not a complete fraud engin
|
|
|
65
61
|
|
|
66
62
|
The Developer API provides a normalized assessment and supporting network context:
|
|
67
63
|
|
|
68
|
-
| Data
|
|
69
|
-
|
|
|
70
|
-
| **NetRiskScan Index & band** | A normalized IP cleanliness assessment. Higher is cleaner.
|
|
71
|
-
| **Independent signals**
|
|
72
|
-
| **Network attribution**
|
|
73
|
-
| **IP geolocation**
|
|
74
|
-
| **Verified identity**
|
|
75
|
-
| **Risk reasons**
|
|
64
|
+
| Data | What it provides |
|
|
65
|
+
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| **NetRiskScan Index & band** | A normalized IP cleanliness assessment. Higher is cleaner. |
|
|
67
|
+
| **Independent signals** | Proxy, VPN, Tor, datacenter, scanner, and abuse flags. Each signal preserves `true`, `false`, or `null` (unknown). |
|
|
68
|
+
| **Network attribution** | Network type, profile, service, ASN, organization, operator domain, and containing CIDR range when resolved. |
|
|
69
|
+
| **IP geolocation** | Network-level country, region, city, continent, postal code, approximate coordinates, and time zone when available. |
|
|
70
|
+
| **Verified identity** | Known search-crawler identity, such as Googlebot, Bingbot, or Applebot, when verified by the API. |
|
|
71
|
+
| **Risk reasons** | Server-generated reason codes with category and severity. Reasons can describe positive infrastructure evidence as well as risk signals. |
|
|
76
72
|
|
|
77
73
|
Fields are returned only when the API can resolve them. Unknown or unavailable values are not silently converted into negative signals.
|
|
78
74
|
|
|
@@ -97,58 +93,43 @@ The installed executable is `netriskscan`; the npm package name is `netriskscan-
|
|
|
97
93
|
|
|
98
94
|
## Access model
|
|
99
95
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
| **Anonymous evaluation** | First lookups and quick CLI tests | `check` and `batch` can run without an API key. Requests are metered by the caller's public IP and subject to a daily allowance. |
|
|
105
|
-
| **Developer API key** | Application integration and account-level usage | Key-authenticated requests use the Developer Account's plan quota. The `usage` command requires a key. |
|
|
106
|
-
| **Paid plan** | Sustained production traffic and higher-volume workloads | Select a plan based on required quota, request rate, and concurrency. Current limits and pricing are shown in the Developer Dashboard. |
|
|
107
|
-
|
|
108
|
-
A Developer account includes a Free Plan for evaluation. For production workloads, use a plan that matches your expected traffic and operational requirements. Plan allowances, rate limits, and concurrency can change; the Developer Dashboard is the source of truth.
|
|
109
|
-
|
|
110
|
-
[Explore Developer API access and plans](https://www.netriskscan.com/pricing.html).
|
|
111
|
-
|
|
112
|
-
## Anonymous trial
|
|
113
|
-
|
|
114
|
-
The `check` and `batch` commands can be used without credentials. When no API key is configured, the CLI sends **no** `Authorization` header and the Developer API serves the request through an anonymous daily trial, metered by the caller's public IP.
|
|
115
|
-
|
|
116
|
-
The current default allowance is **30 requests per public IP per UTC day**. The allowance reported by the API response is authoritative; the CLI does not maintain a local counter or estimate remaining requests.
|
|
117
|
-
|
|
118
|
-
Use an API key when you need account-level quota, sustained usage, or billing-period usage reporting. Anonymous trial exhaustion returns `429 anonymous_daily_limit_reached`; this deterministic response is not automatically retried.
|
|
96
|
+
The CLI resolves credentials in this order: `--api-key`, `NETRISKSCAN_API_KEY`,
|
|
97
|
+
then the OS credential store. CLI lookups send `Authorization: Bearer <API_KEY>`.
|
|
98
|
+
A rejected key returns an authentication error. The Free plan and paid plans use
|
|
99
|
+
account-level quota.
|
|
119
100
|
|
|
120
|
-
|
|
121
|
-
| --- | --- |
|
|
122
|
-
| `netriskscan check` | Optional — anonymous trial is used when omitted |
|
|
123
|
-
| `netriskscan batch` | Optional — anonymous trial is used when omitted |
|
|
124
|
-
| `netriskscan usage` | Required — retrieves Developer Account plan and billing-period usage |
|
|
101
|
+
### Migrating from 1.x
|
|
125
102
|
|
|
126
|
-
|
|
103
|
+
Version 2 requires a key for all CLI lookups. For CI/CD, set `NETRISKSCAN_API_KEY`
|
|
104
|
+
before upgrading. For local use, save a key in the OS credential store. Keyed scripts
|
|
105
|
+
keep the same query commands, success payloads, and numeric exit codes. Read
|
|
106
|
+
`error.code` to distinguish failures that share an exit code. Direct JavaScript
|
|
107
|
+
`NetRiskScanClient` callers retain their existing authentication behavior.
|
|
127
108
|
|
|
128
109
|
## Getting an API key
|
|
129
110
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
2. Go to **API Keys** and create a key with the scopes required by your integration:
|
|
134
|
-
- `ip-risk:read` — IP risk and network intelligence lookups.
|
|
135
|
-
- `usage:read` — account usage reporting.
|
|
136
|
-
3. Copy the full key when it is created. It is shown in full only once.
|
|
137
|
-
|
|
138
|
-
Set the key as an environment variable instead of putting it directly in a command, source file, or shell history:
|
|
111
|
+
Sign in with Google in the [Developer Console](https://www.netriskscan.com/developer/keys).
|
|
112
|
+
Create a key with `ip-risk:read` for `check` and `batch` and `usage:read` for quota
|
|
113
|
+
and plan reads. Load the key from your secret manager into `NETRISKSCAN_API_KEY`.
|
|
139
114
|
|
|
140
115
|
```bash
|
|
141
|
-
|
|
116
|
+
npx netriskscan-cli auth save
|
|
117
|
+
npx netriskscan-cli check 8.8.8.8
|
|
142
118
|
```
|
|
143
119
|
|
|
144
|
-
|
|
120
|
+
You can also pipe a key from a secret manager into `npx netriskscan-cli auth save --stdin`.
|
|
121
|
+
The CLI saves it in Windows Credential Manager, macOS Keychain, or Linux Secret Service.
|
|
122
|
+
If the store is unavailable, supply `NETRISKSCAN_API_KEY` from your secret manager for
|
|
123
|
+
each invocation. `auth save` sets the variable within its own process.
|
|
145
124
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
netriskscan
|
|
149
|
-
|
|
125
|
+
| Command | What it does |
|
|
126
|
+
| --------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
127
|
+
| `npx netriskscan-cli auth show` | Displays the saved key and available plan details in an interactive terminal. |
|
|
128
|
+
| `npx netriskscan-cli auth status` | Verifies the selected key and shows its masked value, source, plan, and OS store status. |
|
|
129
|
+
| `npx netriskscan-cli auth logout` | Removes the local credential. Server-side revocation is available in the Developer Console. |
|
|
150
130
|
|
|
151
|
-
|
|
131
|
+
View account email and key name in the Developer Console. Automatic key delivery
|
|
132
|
+
and resuming the original command require a backend CLI authorization flow.
|
|
152
133
|
|
|
153
134
|
## CLI and TypeScript integration
|
|
154
135
|
|
|
@@ -187,11 +168,11 @@ The SDK preserves the API's response semantics, including nullable signals and o
|
|
|
187
168
|
- [Intelligence returned](#intelligence-returned)
|
|
188
169
|
- [Installation](#installation)
|
|
189
170
|
- [Access model](#access-model)
|
|
190
|
-
- [Anonymous trial](#anonymous-trial)
|
|
191
171
|
- [Getting an API key](#getting-an-api-key)
|
|
192
172
|
- [CLI and TypeScript integration](#cli-and-typescript-integration)
|
|
193
173
|
- [IP risk check](#ip-risk-check)
|
|
194
174
|
- [Usage & quota](#usage--quota)
|
|
175
|
+
- [Upgrade & billing](#upgrade--billing)
|
|
195
176
|
- [Batch processing](#batch-processing)
|
|
196
177
|
- [JSON output](#json-output)
|
|
197
178
|
- [JSONL output](#jsonl-output)
|
|
@@ -214,8 +195,7 @@ The SDK preserves the API's response semantics, including nullable signals and o
|
|
|
214
195
|
netriskscan check <ip> [options]
|
|
215
196
|
```
|
|
216
197
|
|
|
217
|
-
Calls
|
|
218
|
-
optional; without one the request uses the [anonymous trial](#anonymous-trial).
|
|
198
|
+
Calls GET /v1/ip-risk/{ip} with a Developer API key that has the ip-risk:read scope.
|
|
219
199
|
|
|
220
200
|
Supports **IP Intelligence Schema 1.6.0**: `network.domain` / `network.range` and the
|
|
221
201
|
extended `location` fields (continent, postal code, approximate coordinates). The
|
|
@@ -431,55 +411,49 @@ you opt into CI policy checks with `--fail-below` (see [CI/CD](#cicd)).
|
|
|
431
411
|
|
|
432
412
|
### Options
|
|
433
413
|
|
|
434
|
-
| Option | Description
|
|
435
|
-
| ---------------------- |
|
|
436
|
-
| `--api-key <key>` | API key for this call,
|
|
437
|
-
| `--base-url <url>` | Override the API base URL (advanced)
|
|
438
|
-
| `--json` | Machine-readable JSON output (see [JSON output](#json-output))
|
|
439
|
-
| `--verbose` | Also print rate limit, quota, and request id
|
|
440
|
-
| `--debug` | Print a stack trace / extra detail on failure
|
|
441
|
-
| `--timeout <ms>` | Request timeout in milliseconds (default `10000`)
|
|
442
|
-
| `--max-retries <n>` | Max automatic retries for `429`/`503` (default `3`)
|
|
443
|
-
| `--fail-below <index>` | CI gate: exit non-zero if `risk.index` is below this threshold
|
|
444
|
-
| `--fail-on <flag>` | CI gate: exit non-zero if the given flag is `true` (repeatable)
|
|
414
|
+
| Option | Description |
|
|
415
|
+
| ---------------------- | ------------------------------------------------------------------------ |
|
|
416
|
+
| `--api-key <key>` | API key for this call, overrides the environment and OS credential store |
|
|
417
|
+
| `--base-url <url>` | Override the API base URL (advanced) |
|
|
418
|
+
| `--json` | Machine-readable JSON output (see [JSON output](#json-output)) |
|
|
419
|
+
| `--verbose` | Also print rate limit, quota, and request id |
|
|
420
|
+
| `--debug` | Print a stack trace / extra detail on failure |
|
|
421
|
+
| `--timeout <ms>` | Request timeout in milliseconds (default `10000`) |
|
|
422
|
+
| `--max-retries <n>` | Max automatic retries for `429`/`503` (default `3`) |
|
|
423
|
+
| `--fail-below <index>` | CI gate: exit non-zero if `risk.index` is below this threshold |
|
|
424
|
+
| `--fail-on <flag>` | CI gate: exit non-zero if the given flag is `true` (repeatable) |
|
|
445
425
|
|
|
446
426
|
## Usage & quota
|
|
447
427
|
|
|
448
428
|
```bash
|
|
449
|
-
netriskscan usage
|
|
429
|
+
npx netriskscan-cli usage
|
|
430
|
+
npx netriskscan-cli quota
|
|
450
431
|
```
|
|
451
432
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
433
|
+
Both commands call `GET /v1/usage` with a key that has `usage:read`. They show the
|
|
434
|
+
current plan, monthly limit, used and remaining units, percentage used, period
|
|
435
|
+
start and reset time, and requests per minute. View subscription status and batch
|
|
436
|
+
entitlement in the [Developer Console](https://www.netriskscan.com/developer/billing).
|
|
455
437
|
|
|
456
|
-
|
|
457
|
-
|
|
438
|
+
Human lookup output warns at 80% and 95% using the lookup's quota headers. The CLI
|
|
439
|
+
suppresses repeats by key, reported limit, and threshold. It rearms warnings when it
|
|
440
|
+
observes usage below the threshold or learns a new quota period from `usage`.
|
|
441
|
+
At exhaustion the CLI displays quota details, reset time when available, and an
|
|
442
|
+
upgrade link. `check --json` includes these details in the error object.
|
|
458
443
|
|
|
459
|
-
|
|
460
|
-
```
|
|
444
|
+
## Upgrade & billing
|
|
461
445
|
|
|
462
446
|
```bash
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
NetRiskScan Usage
|
|
466
|
-
|
|
467
|
-
Plan growth
|
|
468
|
-
|
|
469
|
-
Usage
|
|
470
|
-
Used 12,450
|
|
471
|
-
Remaining 37,550
|
|
472
|
-
Limit 50,000
|
|
473
|
-
|
|
474
|
-
Rate limit
|
|
475
|
-
Requests / minute 120
|
|
476
|
-
|
|
477
|
-
Billing period
|
|
478
|
-
2026-08-01 → 2026-09-01
|
|
447
|
+
npx netriskscan-cli upgrade
|
|
448
|
+
npx netriskscan-cli billing
|
|
479
449
|
```
|
|
480
450
|
|
|
481
|
-
|
|
482
|
-
|
|
451
|
+
`upgrade` opens the official plans page. `billing` opens the Developer Console for
|
|
452
|
+
subscriptions, invoices, and payment management. Sign in with the developer account
|
|
453
|
+
that owns the CLI key. After checkout, run `npx netriskscan-cli quota` with the same
|
|
454
|
+
key to read the effective plan and limits. Confirming payment from the CLI requires a
|
|
455
|
+
backend billing transaction API. CI, pipelines, and `--json` mode return a browser
|
|
456
|
+
action URL with a nonzero exit status.
|
|
483
457
|
|
|
484
458
|
## Batch processing
|
|
485
459
|
|
|
@@ -491,13 +465,9 @@ Use `netriskscan batch` as a batch IP lookup CLI or bulk IP reputation checker:
|
|
|
491
465
|
it at a file of one IP per line and get a risk result for every address, with
|
|
492
466
|
concurrency control and JSONL output for pipelines.
|
|
493
467
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
request draws on the [anonymous trial](#anonymous-trial), and the summary reports what the
|
|
498
|
-
server says is left. It never calls `/v1/ip-risk/batch` or
|
|
499
|
-
`/v1/ip-risk/query` - those endpoints are not open and currently return
|
|
500
|
-
`404 feature_not_available`.
|
|
468
|
+
The CLI sends one authenticated `GET /v1/ip-risk/{ip}` request per valid address
|
|
469
|
+
and retains input order. The separate server-side batch endpoint is documented in
|
|
470
|
+
the [Developer API reference](https://www.netriskscan.com/developer/docs).
|
|
501
471
|
|
|
502
472
|
Input is one IP per line; blank lines and lines starting with `#` are ignored:
|
|
503
473
|
|
|
@@ -526,36 +496,20 @@ Concurrency defaults to a conservative `5` and is capped at `20` regardless of w
|
|
|
526
496
|
pass - it is never unbounded. Make sure the concurrency you choose complies with the
|
|
527
497
|
limits shown in your NetRiskScan Developer Dashboard for your plan.
|
|
528
498
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
```text
|
|
534
|
-
4 succeeded, 0 failed
|
|
535
|
-
|
|
536
|
-
Anonymous trial
|
|
537
|
-
Available 19
|
|
538
|
-
Daily Limit 30
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
`Available` is the **lowest** `usage.remaining` seen in the batch, because concurrent
|
|
542
|
-
responses do not arrive in the order the server charged them. If any request came back
|
|
543
|
-
`anonymous_daily_limit_reached`, it reports `0`. The CLI never rejects an input file for
|
|
544
|
-
being longer than the daily allowance: it cannot know how much of today's allowance you
|
|
545
|
-
have already spent - only the server can. `--jsonl` output is unaffected; each line's
|
|
546
|
-
`result.usage` object already carries this, and no plain text is ever mixed into the
|
|
547
|
-
stream.
|
|
499
|
+
After a definitive credential or monthly quota refusal, the CLI stops starting
|
|
500
|
+
lookups. In-flight lookups can finish. Every IP retains its result row. Unstarted
|
|
501
|
+
lookups report `attempted: false` and can be selected for a later run.
|
|
548
502
|
|
|
549
503
|
### Options
|
|
550
504
|
|
|
551
|
-
| Option | Description
|
|
552
|
-
| ------------------- |
|
|
553
|
-
| `--api-key <key>` | API key for this run,
|
|
554
|
-
| `--base-url <url>` | Override the API base URL (advanced)
|
|
555
|
-
| `--concurrency <n>` | Concurrent requests (default `5`, max `20`)
|
|
556
|
-
| `--jsonl` | Newline-delimited JSON output (see [JSONL output](#jsonl-output))
|
|
557
|
-
| `--timeout <ms>` | Per-request timeout in milliseconds (default `10000`)
|
|
558
|
-
| `--max-retries <n>` | Max automatic retries per request for `429`/`503` (default `3`)
|
|
505
|
+
| Option | Description |
|
|
506
|
+
| ------------------- | ----------------------------------------------------------------------- |
|
|
507
|
+
| `--api-key <key>` | API key for this run, overrides the environment and OS credential store |
|
|
508
|
+
| `--base-url <url>` | Override the API base URL (advanced) |
|
|
509
|
+
| `--concurrency <n>` | Concurrent requests (default `5`, max `20`) |
|
|
510
|
+
| `--jsonl` | Newline-delimited JSON output (see [JSONL output](#jsonl-output)) |
|
|
511
|
+
| `--timeout <ms>` | Per-request timeout in milliseconds (default `10000`) |
|
|
512
|
+
| `--max-retries <n>` | Max automatic retries per request for `429`/`503` (default `3`) |
|
|
559
513
|
|
|
560
514
|
## JSON output
|
|
561
515
|
|
|
@@ -649,7 +603,7 @@ One JSON object per line, one line per input IP:
|
|
|
649
603
|
|
|
650
604
|
Designed for `netriskscan batch ips.txt --jsonl > results.jsonl` and downstream
|
|
651
605
|
line-oriented processing (`jq`, `grep`, log pipelines, etc.). A failed IP never causes
|
|
652
|
-
the
|
|
606
|
+
the output for the other IPs to be dropped. A command-level failure emits one line with an `error` object.
|
|
653
607
|
|
|
654
608
|
The envelope (`ip`, `ok`, `result` / `error`) belongs to the CLI; everything under
|
|
655
609
|
`result` is the API response verbatim, so `location`, `risk.reasons` and the Schema 1.6.0
|
|
@@ -659,6 +613,17 @@ domain, range or reason columns - so use `--jsonl` when you need the full record
|
|
|
659
613
|
|
|
660
614
|
## CI/CD
|
|
661
615
|
|
|
616
|
+
Configure `NETRISKSCAN_API_KEY` as a masked secret in your CI provider. For GitHub Actions:
|
|
617
|
+
|
|
618
|
+
```yaml
|
|
619
|
+
- run: npx --yes netriskscan-cli check 8.8.8.8 --json --fail-below 60
|
|
620
|
+
env:
|
|
621
|
+
NETRISKSCAN_API_KEY: ${{ secrets.NETRISKSCAN_API_KEY }}
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
JSON, JSONL, CI, and non-TTY invocations skip browser setup. A missing key fails
|
|
625
|
+
with exit code `3` and the machine-readable code `api_key_required`.
|
|
626
|
+
|
|
662
627
|
`--fail-below` and `--fail-on` turn `check` into an IP reputation CI check: use it
|
|
663
628
|
with policy flags as a build/deploy gate:
|
|
664
629
|
|
|
@@ -678,10 +643,10 @@ Rules:
|
|
|
678
643
|
|
|
679
644
|
## Environment variables
|
|
680
645
|
|
|
681
|
-
| Variable | Description
|
|
682
|
-
| ---------------------- |
|
|
683
|
-
| `NETRISKSCAN_API_KEY` |
|
|
684
|
-
| `NETRISKSCAN_BASE_URL` | Advanced:
|
|
646
|
+
| Variable | Description |
|
|
647
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
648
|
+
| `NETRISKSCAN_API_KEY` | Developer API key from your secret manager. Takes precedence over the OS credential store. |
|
|
649
|
+
| `NETRISKSCAN_BASE_URL` | Advanced: set an alternate API base URL. Only explicitly supplied keys are used with alternate endpoints. |
|
|
685
650
|
|
|
686
651
|
## Exit codes
|
|
687
652
|
|
|
@@ -692,7 +657,7 @@ Rules:
|
|
|
692
657
|
| `2` | Invalid CLI argument |
|
|
693
658
|
| `3` | Authentication / authorization failure |
|
|
694
659
|
| `4` | API request failure |
|
|
695
|
-
| `5` | Rate limit
|
|
660
|
+
| `5` | Rate limit or monthly quota exceeded |
|
|
696
661
|
| `6` | CI policy failed (`--fail-below` / `--fail-on`) |
|
|
697
662
|
| `7` | Assessment unavailable (`--fail-below` used against a `null` index) |
|
|
698
663
|
|
|
@@ -700,81 +665,50 @@ These codes are stable and part of the CLI's public contract.
|
|
|
700
665
|
|
|
701
666
|
## API errors
|
|
702
667
|
|
|
703
|
-
|
|
668
|
+
With `--json` the CLI emits an error object on stdout:
|
|
704
669
|
|
|
705
670
|
```json
|
|
706
671
|
{
|
|
707
672
|
"error": {
|
|
708
673
|
"code": "quota_exceeded",
|
|
709
|
-
"message": "
|
|
710
|
-
"
|
|
674
|
+
"message": "API quota exceeded.",
|
|
675
|
+
"status": 429,
|
|
676
|
+
"requestId": "req_8f3ab21c9d",
|
|
677
|
+
"quota": { "used": 5000, "limit": 5000, "remaining": 0 },
|
|
678
|
+
"resetAt": "2027-01-01T00:00:00Z",
|
|
679
|
+
"upgradeUrl": "https://www.netriskscan.com/pricing.html"
|
|
711
680
|
}
|
|
712
681
|
}
|
|
713
682
|
```
|
|
714
683
|
|
|
715
|
-
The CLI prints this as:
|
|
716
|
-
|
|
717
|
-
```text
|
|
718
|
-
NetRiskScan API error
|
|
719
|
-
|
|
720
|
-
Code quota_exceeded
|
|
721
|
-
Status 429
|
|
722
|
-
Message Billing period quota exhausted.
|
|
723
|
-
Request ID req_8f3ab21c9d
|
|
724
|
-
```
|
|
725
|
-
|
|
726
684
|
Known error codes:
|
|
727
685
|
|
|
728
|
-
| HTTP status
|
|
729
|
-
|
|
|
730
|
-
| 400
|
|
731
|
-
| 400
|
|
732
|
-
| 400
|
|
733
|
-
| 401
|
|
734
|
-
| 403
|
|
735
|
-
| 403
|
|
736
|
-
| 404
|
|
737
|
-
| 404
|
|
738
|
-
| 429
|
|
739
|
-
| 429
|
|
740
|
-
|
|
|
741
|
-
|
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
otherwise. `anonymous_daily_limit_reached` is **never** retried, even though it is also a
|
|
746
|
-
`429`: the daily allowance cannot come back before the UTC reset, so retrying would only
|
|
747
|
-
repeat the same failure three more times. `400` / `401` / `403` / `404` are never retried
|
|
748
|
-
either.
|
|
749
|
-
|
|
750
|
-
Pass `--debug` to any command to include a stack trace on failure. Without it, errors
|
|
751
|
-
are shown as a clean summary - never a raw stack dump.
|
|
686
|
+
| HTTP status | `error.code` | Meaning |
|
|
687
|
+
| --------------------------------------------------------------------------- | ------------------------- | ----------------------------------------------------------------------------- |
|
|
688
|
+
| 400 | `invalid_ip` | The address is not a valid IPv4/IPv6 address |
|
|
689
|
+
| 400 | `invalid_request` | Unsupported query parameter, or request too large |
|
|
690
|
+
| 400 | `unsupported_parameter` | e.g. `forceRefresh` / `force_refresh` / `refresh` - not supported |
|
|
691
|
+
| 401 | `invalid_api_key` | Missing/malformed `Authorization` header, or key doesn't exist |
|
|
692
|
+
| 403 | `api_key_disabled` | Key revoked/expired, or account/plan unavailable |
|
|
693
|
+
| 403 | `scope_not_allowed` | Key lacks the scope required for this endpoint |
|
|
694
|
+
| 404 | `not_found` | Unknown path |
|
|
695
|
+
| 404 | `feature_not_available` | Endpoint is unavailable |
|
|
696
|
+
| 429 | `rate_limit_exceeded` | Per-minute request limit exceeded |
|
|
697
|
+
| 429 | `quota_exceeded` | Monthly quota exhausted |
|
|
698
|
+
| 503 | `temporarily_unavailable` | Transient rate-limit and service errors may be retried using `Retry-After` or |
|
|
699
|
+
| exponential backoff. Monthly exhaustion (`quota_exceeded` in OpenAPI, also |
|
|
700
|
+
| recognized as `monthly_quota_exceeded`) and authentication errors are never |
|
|
701
|
+
| retried. Use `error.code` to distinguish failures that share an exit code. |
|
|
702
|
+
| Pass `--debug` to `check` or `usage` for technical details in human output. |
|
|
752
703
|
|
|
753
704
|
## Rate limits & quota
|
|
754
705
|
|
|
755
|
-
|
|
756
|
-
through different channels. Do not read one as the other.
|
|
757
|
-
|
|
758
|
-
### Anonymous daily trial
|
|
759
|
-
|
|
760
|
-
Reported in the response body, on every request:
|
|
761
|
-
|
|
762
|
-
| Field | Meaning |
|
|
763
|
-
| ------------------ | ---------------------------------------------------------------- |
|
|
764
|
-
| `usage.mode` | `anonymous` when the request was served by the trial |
|
|
765
|
-
| `usage.remaining` | Requests still available today - authoritative, never recomputed |
|
|
766
|
-
| `usage.dailyLimit` | The trial's daily allowance |
|
|
767
|
-
| `usage.resetAt` | When the allowance resets (UTC day boundary) |
|
|
768
|
-
|
|
769
|
-
### API key quota
|
|
770
|
-
|
|
771
|
-
Every successful `/v1/*` response carries live rate limit and quota headers, so you
|
|
772
|
-
don't need a separate call to `/v1/usage` to know where you stand:
|
|
706
|
+
Authenticated IP lookups carry rate-limit and quota headers:
|
|
773
707
|
|
|
774
708
|
| Header | Meaning |
|
|
775
709
|
| ------------------------------------------------------------------- | --------------------------------------------------- |
|
|
776
710
|
| `X-RateLimit-Limit` / `X-RateLimit-Remaining` / `X-RateLimit-Reset` | Per-minute limit |
|
|
777
|
-
| `X-Quota-Limit` / `X-Quota-Used` / `X-Quota-Remaining` |
|
|
711
|
+
| `X-Quota-Limit` / `X-Quota-Used` / `X-Quota-Remaining` | Monthly quota |
|
|
778
712
|
| `X-Request-Id` | Request trace id (echoes yours, or a generated one) |
|
|
779
713
|
| `Retry-After` | Present on `429` responses |
|
|
780
714
|
|
|
@@ -795,8 +729,7 @@ Request ID req_xxxxxxxx
|
|
|
795
729
|
The package also exports `NetRiskScanClient` and its response and error types for direct
|
|
796
730
|
Node.js/TypeScript integration. The CLI and SDK use the same API client and response contract:
|
|
797
731
|
|
|
798
|
-
The client
|
|
799
|
-
header and uses the anonymous trial:
|
|
732
|
+
The programmatic client still uses the Developer API's anonymous trial when you call checkIp() without a key. CLI commands require a key:
|
|
800
733
|
|
|
801
734
|
```ts
|
|
802
735
|
import { NetRiskScanClient } from "netriskscan-cli";
|
|
@@ -879,7 +812,7 @@ See [examples/](examples/) for runnable scripts.
|
|
|
879
812
|
|
|
880
813
|
## Security
|
|
881
814
|
|
|
882
|
-
-
|
|
815
|
+
- View the full saved key with auth show in an interactive terminal. Error output and browser URLs omit credentials.
|
|
883
816
|
- There is no telemetry: **the CLI does not collect usage analytics or telemetry** of any
|
|
884
817
|
kind, in any version.
|
|
885
818
|
- If `--debug` needs to show an authorization value, it is redacted
|
|
@@ -901,20 +834,14 @@ This is a completely separate system from the netriskscan.com website's internal
|
|
|
901
834
|
`/api/public/*` endpoints - different auth, different response shapes, no compatibility
|
|
902
835
|
guarantees between the two. `netriskscan-cli` only ever calls `/v1/*`.
|
|
903
836
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
- `GET /v1/ip-risk/{ip}`
|
|
907
|
-
- anonymous access supported
|
|
908
|
-
- API key optional
|
|
909
|
-
- API key requests use account quota and require `ip-risk:read`
|
|
910
|
-
- `GET /v1/usage` - requires an API key with `usage:read`
|
|
837
|
+
Endpoints called by the CLI:
|
|
911
838
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
`GET|POST /v1/key`, etc. are not implemented). API key creation/rotation/revocation is
|
|
915
|
-
only available through the Developer Dashboard.
|
|
839
|
+
- `GET /v1/ip-risk/{ip}` with `ip-risk:read`
|
|
840
|
+
- `GET /v1/usage` with `usage:read`
|
|
916
841
|
|
|
917
|
-
|
|
842
|
+
The [OpenAPI contract](https://www.netriskscan.com/assets/paid-api-v1.yaml) also
|
|
843
|
+
documents the server-side batch endpoint. Key creation, rotation, and revocation
|
|
844
|
+
are available in the Developer Console.
|
|
918
845
|
|
|
919
846
|
See the official [Methodology](https://www.netriskscan.com/methodology.html) page for
|
|
920
847
|
how the NetRiskScan Index itself is computed (this project does not - and will not -
|
|
@@ -924,8 +851,7 @@ reimplement that logic client-side).
|
|
|
924
851
|
|
|
925
852
|
### How do I look up an IP address from the command line?
|
|
926
853
|
|
|
927
|
-
Run `netriskscan check <ip>`
|
|
928
|
-
trial. See [Quick start](#quick-start).
|
|
854
|
+
Run `npx netriskscan-cli check <ip>` with a Developer API key. See [Quick start](#quick-start).
|
|
929
855
|
|
|
930
856
|
### How do I check IP reputation from a terminal?
|
|
931
857
|
|
|
@@ -962,8 +888,7 @@ Yes - `netriskscan check <ip> --json` prints the raw API response, and
|
|
|
962
888
|
|
|
963
889
|
### Does NetRiskScan CLI work without an API key?
|
|
964
890
|
|
|
965
|
-
|
|
966
|
-
key. `usage` always requires a key. See [Anonymous trial](#anonymous-trial).
|
|
891
|
+
The CLI requires a valid Developer API key. [Create and save one](#getting-an-api-key).
|
|
967
892
|
|
|
968
893
|
## Official resources
|
|
969
894
|
|