netriskscan-cli 1.6.1 → 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 +28 -0
- package/README.md +235 -366
- 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 +17 -18
package/README.md
CHANGED
|
@@ -1,267 +1,193 @@
|
|
|
1
1
|
# NetRiskScan CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
**IP intelligence for products, infrastructure, and security automation.**
|
|
4
|
+
|
|
5
|
+
`netriskscan-cli` is the official command-line interface and typed TypeScript client for the [NetRiskScan Developer API](https://www.netriskscan.com/developer/docs). It helps engineering teams inspect IP addresses, enrich network context, evaluate reputation signals, and bring IP intelligence into existing applications and automated workflows.
|
|
6
|
+
|
|
7
|
+
Use the CLI for investigations and operational tasks. Use the TypeScript client or Developer API to integrate the same server-side assessment into your own product.
|
|
7
8
|
|
|
8
9
|
[](https://github.com/TeamQQ/netriskscan-cli/actions/workflows/ci.yml)
|
|
9
10
|
[](https://www.npmjs.com/package/netriskscan-cli)
|
|
10
11
|
[](https://www.netriskscan.com)
|
|
11
12
|
[](LICENSE)
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://www.netriskscan.com/pricing.html"><strong>Developer API & plans</strong></a>
|
|
16
|
+
·
|
|
17
|
+
<a href="https://www.npmjs.com/package/netriskscan-cli">npm package</a>
|
|
18
|
+
·
|
|
19
|
+
<a href="https://www.netriskscan.com/methodology.html">Scoring methodology</a>
|
|
20
|
+
·
|
|
21
|
+
<a href="https://github.com/TeamQQ/netriskscan-cli/issues">Support</a>
|
|
22
|
+
</p>
|
|
14
23
|
|
|
15
24
|
<p align="center">
|
|
16
|
-
<img src="
|
|
25
|
+
<img src="https://raw.githubusercontent.com/TeamQQ/netriskscan-cli/main/assets/netriskscan-cli-social-preview.png" alt="NetRiskScan CLI — IP Risk Intelligence for Developers" width="760" />
|
|
17
26
|
</p>
|
|
18
27
|
|
|
28
|
+
## Quick start
|
|
29
|
+
|
|
30
|
+
**Developer API requires a valid API Key.**
|
|
31
|
+
|
|
19
32
|
```bash
|
|
20
|
-
npx netriskscan-cli check
|
|
33
|
+
npx netriskscan-cli check 8.8.8.8
|
|
21
34
|
```
|
|
22
35
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[Anonymous trial](#anonymous-trial)). Add a free [API key](#getting-an-api-key) for more.
|
|
27
|
-
|
|
28
|
-
The values shown above and in the recording come from the live API and change as
|
|
29
|
-
reputation and threat data changes - see [IP risk check](#ip-risk-check) for a
|
|
30
|
-
field-by-field reference.
|
|
31
|
-
|
|
32
|
-
## Why NetRiskScan?
|
|
33
|
-
|
|
34
|
-
- Known infrastructure identification for services such as search crawlers and public
|
|
35
|
-
infrastructure, instead of treating every address as a generic business or datacenter IP
|
|
36
|
-
- Proxy, VPN, Tor, abuse, blacklist and threat signals
|
|
37
|
-
- Network-level IP geolocation (country, region, city, continent, postal code,
|
|
38
|
-
approximate coordinates, time zone)
|
|
39
|
-
- Network attribution: the operator's primary domain and the CIDR range containing the
|
|
40
|
-
address (IP Intelligence Schema 1.6.0)
|
|
41
|
-
- Public risk reasons: the server's own explanation of _why_ an address scored as it did
|
|
42
|
-
- One normalized NetRiskScan Index instead of raw provider scores - higher is cleaner
|
|
43
|
-
- `unknown` and `not applicable` states are preserved, never collapsed into "false"
|
|
44
|
-
- Anonymous daily trial: run your first check with no account, no key, no configuration
|
|
45
|
-
- Human-readable CLI output plus JSON / JSONL for scripts, batches and CI
|
|
46
|
-
|
|
47
|
-
NetRiskScan can identify known infrastructure such as search crawlers, public DNS
|
|
48
|
-
resolvers and other published infrastructure, instead of treating every address as a
|
|
49
|
-
generic business or datacenter IP. Known infrastructure does not automatically mean
|
|
50
|
-
safe - proxy, VPN, Tor, abuse and threat signals are still evaluated separately on
|
|
51
|
-
every address. NetRiskScan normalizes multiple categories of evidence into one
|
|
52
|
-
consistent assessment rather than exposing a single provider's raw score.
|
|
53
|
-
|
|
54
|
-
> NetRiskScan provides diagnostic network intelligence. Results should not be treated as
|
|
55
|
-
> proof of malicious activity and should not be used as the sole basis for legal,
|
|
56
|
-
> employment, credit, identity, or other high-impact decisions.
|
|
57
|
-
|
|
58
|
-
Powered by the [NetRiskScan Developer API](#developer-api).
|
|
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.
|
|
59
39
|
|
|
60
|
-
##
|
|
40
|
+
## Product overview
|
|
61
41
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
- [Installation](#installation)
|
|
68
|
-
- [Anonymous trial](#anonymous-trial)
|
|
69
|
-
- [Getting an API key](#getting-an-api-key)
|
|
70
|
-
- [Quick start](#quick-start)
|
|
71
|
-
- [IP risk check](#ip-risk-check)
|
|
72
|
-
- [Usage & quota](#usage--quota)
|
|
73
|
-
- [Batch processing](#batch-processing)
|
|
74
|
-
- [JSON output](#json-output)
|
|
75
|
-
- [JSONL output](#jsonl-output)
|
|
76
|
-
- [CI/CD](#cicd)
|
|
77
|
-
- [Environment variables](#environment-variables)
|
|
78
|
-
- [Exit codes](#exit-codes)
|
|
79
|
-
- [API errors](#api-errors)
|
|
80
|
-
- [Rate limits & quota](#rate-limits--quota)
|
|
81
|
-
- [SDK usage](#sdk-usage)
|
|
82
|
-
- [Security](#security)
|
|
83
|
-
- [Developer API](#developer-api)
|
|
84
|
-
- [FAQ](#faq)
|
|
85
|
-
- [Official resources](#official-resources)
|
|
86
|
-
- [Contributing](#contributing)
|
|
87
|
-
- [License](#license)
|
|
42
|
+
NetRiskScan turns an IP address into structured network intelligence through one Developer API. The CLI is the fastest way to evaluate the service from a terminal; the bundled TypeScript client provides a direct integration path for Node.js applications.
|
|
43
|
+
|
|
44
|
+
The CLI does not calculate a separate score or invent classifications locally. Risk assessment, signal evaluation, and enrichment are performed by the NetRiskScan API. The client presents the server response in human-readable or machine-readable form.
|
|
45
|
+
|
|
46
|
+
**Important score semantics:** the NetRiskScan Index is a cleanliness-oriented score. A higher Index means a cleaner address; it is not a threat score.
|
|
88
47
|
|
|
89
|
-
##
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
## Features
|
|
117
|
-
|
|
118
|
-
- `check` and `batch` with no API key at all, via the anonymous daily trial
|
|
119
|
-
- `check`, `usage`, and client-side `batch` commands
|
|
120
|
-
- IPv4 and IPv6 support
|
|
121
|
-
- Proxy type classification (residential, ISP, mobile, datacenter) for detected proxies,
|
|
122
|
-
and verified search crawler identity (Googlebot, Bingbot, Applebot, ...)
|
|
123
|
-
- IP geolocation (country, region, city, continent, postal code, approximate
|
|
124
|
-
coordinates) and server-generated risk reasons in `check`, `--json` and `--jsonl`
|
|
125
|
-
- Network owner domain and CIDR range (IP Intelligence Schema 1.6.0 - purely additive,
|
|
126
|
-
older servers still fully supported)
|
|
127
|
-
- Human-readable terminal output, `--json`, and `--jsonl` (batch) modes
|
|
128
|
-
- Correct three-state handling of risk flags (`true` / `false` / `null` - never coerced)
|
|
129
|
-
- CI-friendly exit codes and `--fail-below` / `--fail-on` policy gates
|
|
130
|
-
- Automatic retry with backoff on `429` / `503`, respecting `Retry-After`
|
|
131
|
-
- Rate limit and quota visibility via `--verbose`
|
|
132
|
-
- Zero telemetry
|
|
133
|
-
- A typed `NetRiskScanClient` SDK you can import directly in Node.js/TypeScript
|
|
134
|
-
|
|
135
|
-
## Use Cases
|
|
136
|
-
|
|
137
|
-
- Manual investigation of a suspicious IP during an incident or support ticket
|
|
138
|
-
- Checking a new VPS or server's IP reputation before deployment or DNS cutover - a
|
|
139
|
-
quick VPS IP reputation checker for ops and security teams
|
|
140
|
-
- Screening proxy, VPN and Tor traffic in login, checkout or signup flows
|
|
141
|
-
- Running a bulk IP reputation checker over log exports or CIDR-derived IP lists with
|
|
142
|
-
`batch`
|
|
143
|
-
- Gating a CI/CD pipeline or deploy job on `--fail-below` / `--fail-on` before trusting
|
|
144
|
-
an IP
|
|
145
|
-
- One step in an OSINT IP lookup workflow alongside other tools - NetRiskScan reports
|
|
146
|
-
network intelligence signals, not a full OSINT investigation platform
|
|
147
|
-
- Piping `--json` / `--jsonl` output into shell scripts, SIEM ingestion or log pipelines
|
|
48
|
+
## Use cases
|
|
49
|
+
|
|
50
|
+
NetRiskScan can provide IP intelligence as an input to existing product and security workflows:
|
|
51
|
+
|
|
52
|
+
- **Account and transaction risk workflows** — enrich signup, login, checkout, and account-review events with proxy, VPN, Tor, datacenter, scanner, and abuse signals.
|
|
53
|
+
- **Traffic classification** — distinguish network and anonymity characteristics when evaluating incoming connections.
|
|
54
|
+
- **Infrastructure validation** — review VPS, hosting, and IP-pool reputation before deployment, migration, or provider changes.
|
|
55
|
+
- **Security operations** — add network attribution and server-returned risk reasons to incident triage, support investigations, and log analysis.
|
|
56
|
+
- **Automation and CI/CD** — screen IP lists, consume JSON/JSONL output, and apply explicit policy gates with stable exit codes.
|
|
57
|
+
|
|
58
|
+
NetRiskScan provides diagnostic network intelligence, not a complete fraud engine or an automatic verdict. Combine its signals with your own application context and decision policies.
|
|
59
|
+
|
|
60
|
+
## Intelligence returned
|
|
61
|
+
|
|
62
|
+
The Developer API provides a normalized assessment and supporting network context:
|
|
63
|
+
|
|
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. |
|
|
72
|
+
|
|
73
|
+
Fields are returned only when the API can resolve them. Unknown or unavailable values are not silently converted into negative signals.
|
|
148
74
|
|
|
149
75
|
## Installation
|
|
150
76
|
|
|
151
|
-
|
|
77
|
+
Requires **Node.js 20 or later**.
|
|
78
|
+
|
|
79
|
+
Run on demand with `npx`:
|
|
152
80
|
|
|
153
81
|
```bash
|
|
154
82
|
npx netriskscan-cli check 1.1.1.1
|
|
155
83
|
```
|
|
156
84
|
|
|
157
|
-
Or install
|
|
85
|
+
Or install globally:
|
|
158
86
|
|
|
159
87
|
```bash
|
|
160
88
|
npm install -g netriskscan-cli
|
|
161
89
|
netriskscan check 1.1.1.1
|
|
162
90
|
```
|
|
163
91
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
## Anonymous trial
|
|
167
|
-
|
|
168
|
-
`check` and `batch` work without any credentials. When no API key is configured, the CLI
|
|
169
|
-
sends **no** `Authorization` header at all, and the Developer API serves the request from
|
|
170
|
-
an anonymous daily trial metered by the caller's public IP (currently 30 requests per
|
|
171
|
-
public IP per UTC day - the allowance reported in the response is always the authority,
|
|
172
|
-
not this number).
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
npx netriskscan-cli check 8.8.8.8
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
Every anonymous response reports where you stand, and the CLI prints it verbatim:
|
|
92
|
+
The installed executable is `netriskscan`; the npm package name is `netriskscan-cli`.
|
|
179
93
|
|
|
180
|
-
|
|
181
|
-
Usage
|
|
182
|
-
Available 29
|
|
183
|
-
Daily Limit 30
|
|
184
|
-
Reset 2026-08-29 00:00 UTC
|
|
185
|
-
```
|
|
94
|
+
## Access model
|
|
186
95
|
|
|
187
|
-
|
|
188
|
-
|
|
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.
|
|
189
100
|
|
|
190
|
-
|
|
191
|
-
`429 anonymous_daily_limit_reached` and the CLI exits `5` with:
|
|
101
|
+
### Migrating from 1.x
|
|
192
102
|
|
|
193
|
-
|
|
194
|
-
|
|
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.
|
|
195
108
|
|
|
196
|
-
|
|
109
|
+
## Getting an API key
|
|
197
110
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
Reset 2026-08-29 00:00 UTC
|
|
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`.
|
|
202
114
|
|
|
203
|
-
|
|
204
|
-
|
|
115
|
+
```bash
|
|
116
|
+
npx netriskscan-cli auth save
|
|
117
|
+
npx netriskscan-cli check 8.8.8.8
|
|
205
118
|
```
|
|
206
119
|
|
|
207
|
-
|
|
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.
|
|
208
124
|
|
|
209
|
-
|
|
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. |
|
|
210
130
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
| `netriskscan check` | Optional - anonymous trial when omitted |
|
|
214
|
-
| `netriskscan batch` | Optional - anonymous trial when omitted |
|
|
215
|
-
| `netriskscan usage` | **Required** - reports Developer Account plan and billing quota |
|
|
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.
|
|
216
133
|
|
|
217
|
-
|
|
218
|
-
key that fails returns `401 invalid_api_key` and exit code `3`. The access mode is decided
|
|
219
|
-
purely by whether a key is present.
|
|
134
|
+
## CLI and TypeScript integration
|
|
220
135
|
|
|
221
|
-
|
|
136
|
+
Use the command-line interface for manual checks, operational scripts, batch screening, and CI/CD. For Node.js or TypeScript applications, the same npm package exports `NetRiskScanClient` and typed response/error definitions.
|
|
222
137
|
|
|
223
|
-
|
|
138
|
+
Install it as an application dependency:
|
|
224
139
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
- a production integration
|
|
229
|
-
|
|
230
|
-
1. Create a NetRiskScan Developer account and open the **Developer Dashboard**.
|
|
231
|
-
2. Go to **API Keys** and create one, selecting the scopes you need
|
|
232
|
-
(`ip-risk:read`, `usage:read`).
|
|
233
|
-
3. Copy the full key immediately - it is shown in full only once, right after creation.
|
|
140
|
+
```bash
|
|
141
|
+
npm install netriskscan-cli
|
|
142
|
+
```
|
|
234
143
|
|
|
235
|
-
|
|
236
|
-
you can try the real API with real data before committing to a paid plan. Current
|
|
237
|
-
pricing, rate limits, quotas, and concurrency limits are shown on the Developer
|
|
238
|
-
Dashboard's **Pricing** and **Usage** pages and are not duplicated here, since they
|
|
239
|
-
change over time.
|
|
144
|
+
Minimal integration:
|
|
240
145
|
|
|
241
|
-
|
|
242
|
-
|
|
146
|
+
```ts
|
|
147
|
+
import { NetRiskScanClient } from "netriskscan-cli";
|
|
243
148
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
149
|
+
const client = new NetRiskScanClient({
|
|
150
|
+
apiKey: process.env.NETRISKSCAN_API_KEY,
|
|
151
|
+
});
|
|
247
152
|
|
|
248
|
-
|
|
153
|
+
const { data } = await client.checkIp("1.1.1.1");
|
|
249
154
|
|
|
250
|
-
|
|
251
|
-
|
|
155
|
+
console.log("NetRiskScan Index:", data.risk.index);
|
|
156
|
+
console.log("Proxy:", data.flags.proxy);
|
|
157
|
+
console.log("VPN:", data.flags.vpn);
|
|
158
|
+
console.log("Network:", data.network.organization);
|
|
252
159
|
```
|
|
253
160
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
With an API key, for higher volume, account quota and `usage`:
|
|
161
|
+
The SDK preserves the API's response semantics, including nullable signals and optional enrichment fields. It does not reproduce the scoring model locally.
|
|
257
162
|
|
|
258
|
-
|
|
259
|
-
export NETRISKSCAN_API_KEY="nrs_live_xxx"
|
|
163
|
+
## Table of contents
|
|
260
164
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
165
|
+
- [Quick start](#quick-start)
|
|
166
|
+
- [Product overview](#product-overview)
|
|
167
|
+
- [Use cases](#use-cases)
|
|
168
|
+
- [Intelligence returned](#intelligence-returned)
|
|
169
|
+
- [Installation](#installation)
|
|
170
|
+
- [Access model](#access-model)
|
|
171
|
+
- [Getting an API key](#getting-an-api-key)
|
|
172
|
+
- [CLI and TypeScript integration](#cli-and-typescript-integration)
|
|
173
|
+
- [IP risk check](#ip-risk-check)
|
|
174
|
+
- [Usage & quota](#usage--quota)
|
|
175
|
+
- [Upgrade & billing](#upgrade--billing)
|
|
176
|
+
- [Batch processing](#batch-processing)
|
|
177
|
+
- [JSON output](#json-output)
|
|
178
|
+
- [JSONL output](#jsonl-output)
|
|
179
|
+
- [CI/CD](#cicd)
|
|
180
|
+
- [Environment variables](#environment-variables)
|
|
181
|
+
- [Exit codes](#exit-codes)
|
|
182
|
+
- [API errors](#api-errors)
|
|
183
|
+
- [Rate limits & quota](#rate-limits--quota)
|
|
184
|
+
- [SDK usage](#sdk-usage)
|
|
185
|
+
- [Security](#security)
|
|
186
|
+
- [Developer API](#developer-api)
|
|
187
|
+
- [FAQ](#faq)
|
|
188
|
+
- [Official resources](#official-resources)
|
|
189
|
+
- [Contributing](#contributing)
|
|
190
|
+
- [License](#license)
|
|
265
191
|
|
|
266
192
|
## IP risk check
|
|
267
193
|
|
|
@@ -269,8 +195,7 @@ netriskscan batch ips.txt --jsonl > results.jsonl
|
|
|
269
195
|
netriskscan check <ip> [options]
|
|
270
196
|
```
|
|
271
197
|
|
|
272
|
-
Calls
|
|
273
|
-
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.
|
|
274
199
|
|
|
275
200
|
Supports **IP Intelligence Schema 1.6.0**: `network.domain` / `network.range` and the
|
|
276
201
|
extended `location` fields (continent, postal code, approximate coordinates). The
|
|
@@ -486,55 +411,49 @@ you opt into CI policy checks with `--fail-below` (see [CI/CD](#cicd)).
|
|
|
486
411
|
|
|
487
412
|
### Options
|
|
488
413
|
|
|
489
|
-
| Option | Description
|
|
490
|
-
| ---------------------- |
|
|
491
|
-
| `--api-key <key>` | API key for this call,
|
|
492
|
-
| `--base-url <url>` | Override the API base URL (advanced)
|
|
493
|
-
| `--json` | Machine-readable JSON output (see [JSON output](#json-output))
|
|
494
|
-
| `--verbose` | Also print rate limit, quota, and request id
|
|
495
|
-
| `--debug` | Print a stack trace / extra detail on failure
|
|
496
|
-
| `--timeout <ms>` | Request timeout in milliseconds (default `10000`)
|
|
497
|
-
| `--max-retries <n>` | Max automatic retries for `429`/`503` (default `3`)
|
|
498
|
-
| `--fail-below <index>` | CI gate: exit non-zero if `risk.index` is below this threshold
|
|
499
|
-
| `--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) |
|
|
500
425
|
|
|
501
426
|
## Usage & quota
|
|
502
427
|
|
|
503
428
|
```bash
|
|
504
|
-
netriskscan usage
|
|
429
|
+
npx netriskscan-cli usage
|
|
430
|
+
npx netriskscan-cli quota
|
|
505
431
|
```
|
|
506
432
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
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).
|
|
510
437
|
|
|
511
|
-
|
|
512
|
-
|
|
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.
|
|
513
443
|
|
|
514
|
-
|
|
515
|
-
```
|
|
444
|
+
## Upgrade & billing
|
|
516
445
|
|
|
517
446
|
```bash
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
NetRiskScan Usage
|
|
521
|
-
|
|
522
|
-
Plan growth
|
|
523
|
-
|
|
524
|
-
Usage
|
|
525
|
-
Used 12,450
|
|
526
|
-
Remaining 37,550
|
|
527
|
-
Limit 50,000
|
|
528
|
-
|
|
529
|
-
Rate limit
|
|
530
|
-
Requests / minute 120
|
|
531
|
-
|
|
532
|
-
Billing period
|
|
533
|
-
2026-08-01 → 2026-09-01
|
|
447
|
+
npx netriskscan-cli upgrade
|
|
448
|
+
npx netriskscan-cli billing
|
|
534
449
|
```
|
|
535
450
|
|
|
536
|
-
|
|
537
|
-
|
|
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.
|
|
538
457
|
|
|
539
458
|
## Batch processing
|
|
540
459
|
|
|
@@ -546,13 +465,9 @@ Use `netriskscan batch` as a batch IP lookup CLI or bulk IP reputation checker:
|
|
|
546
465
|
it at a file of one IP per line and get a risk result for every address, with
|
|
547
466
|
concurrency control and JSONL output for pipelines.
|
|
548
467
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
request draws on the [anonymous trial](#anonymous-trial), and the summary reports what the
|
|
553
|
-
server says is left. It never calls `/v1/ip-risk/batch` or
|
|
554
|
-
`/v1/ip-risk/query` - those endpoints are not open and currently return
|
|
555
|
-
`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).
|
|
556
471
|
|
|
557
472
|
Input is one IP per line; blank lines and lines starting with `#` are ignored:
|
|
558
473
|
|
|
@@ -581,36 +496,20 @@ Concurrency defaults to a conservative `5` and is capped at `20` regardless of w
|
|
|
581
496
|
pass - it is never unbounded. Make sure the concurrency you choose complies with the
|
|
582
497
|
limits shown in your NetRiskScan Developer Dashboard for your plan.
|
|
583
498
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
```text
|
|
589
|
-
4 succeeded, 0 failed
|
|
590
|
-
|
|
591
|
-
Anonymous trial
|
|
592
|
-
Available 19
|
|
593
|
-
Daily Limit 30
|
|
594
|
-
```
|
|
595
|
-
|
|
596
|
-
`Available` is the **lowest** `usage.remaining` seen in the batch, because concurrent
|
|
597
|
-
responses do not arrive in the order the server charged them. If any request came back
|
|
598
|
-
`anonymous_daily_limit_reached`, it reports `0`. The CLI never rejects an input file for
|
|
599
|
-
being longer than the daily allowance: it cannot know how much of today's allowance you
|
|
600
|
-
have already spent - only the server can. `--jsonl` output is unaffected; each line's
|
|
601
|
-
`result.usage` object already carries this, and no plain text is ever mixed into the
|
|
602
|
-
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.
|
|
603
502
|
|
|
604
503
|
### Options
|
|
605
504
|
|
|
606
|
-
| Option | Description
|
|
607
|
-
| ------------------- |
|
|
608
|
-
| `--api-key <key>` | API key for this run,
|
|
609
|
-
| `--base-url <url>` | Override the API base URL (advanced)
|
|
610
|
-
| `--concurrency <n>` | Concurrent requests (default `5`, max `20`)
|
|
611
|
-
| `--jsonl` | Newline-delimited JSON output (see [JSONL output](#jsonl-output))
|
|
612
|
-
| `--timeout <ms>` | Per-request timeout in milliseconds (default `10000`)
|
|
613
|
-
| `--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`) |
|
|
614
513
|
|
|
615
514
|
## JSON output
|
|
616
515
|
|
|
@@ -704,7 +603,7 @@ One JSON object per line, one line per input IP:
|
|
|
704
603
|
|
|
705
604
|
Designed for `netriskscan batch ips.txt --jsonl > results.jsonl` and downstream
|
|
706
605
|
line-oriented processing (`jq`, `grep`, log pipelines, etc.). A failed IP never causes
|
|
707
|
-
the
|
|
606
|
+
the output for the other IPs to be dropped. A command-level failure emits one line with an `error` object.
|
|
708
607
|
|
|
709
608
|
The envelope (`ip`, `ok`, `result` / `error`) belongs to the CLI; everything under
|
|
710
609
|
`result` is the API response verbatim, so `location`, `risk.reasons` and the Schema 1.6.0
|
|
@@ -714,6 +613,17 @@ domain, range or reason columns - so use `--jsonl` when you need the full record
|
|
|
714
613
|
|
|
715
614
|
## CI/CD
|
|
716
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
|
+
|
|
717
627
|
`--fail-below` and `--fail-on` turn `check` into an IP reputation CI check: use it
|
|
718
628
|
with policy flags as a build/deploy gate:
|
|
719
629
|
|
|
@@ -733,10 +643,10 @@ Rules:
|
|
|
733
643
|
|
|
734
644
|
## Environment variables
|
|
735
645
|
|
|
736
|
-
| Variable | Description
|
|
737
|
-
| ---------------------- |
|
|
738
|
-
| `NETRISKSCAN_API_KEY` |
|
|
739
|
-
| `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. |
|
|
740
650
|
|
|
741
651
|
## Exit codes
|
|
742
652
|
|
|
@@ -747,7 +657,7 @@ Rules:
|
|
|
747
657
|
| `2` | Invalid CLI argument |
|
|
748
658
|
| `3` | Authentication / authorization failure |
|
|
749
659
|
| `4` | API request failure |
|
|
750
|
-
| `5` | Rate limit
|
|
660
|
+
| `5` | Rate limit or monthly quota exceeded |
|
|
751
661
|
| `6` | CI policy failed (`--fail-below` / `--fail-on`) |
|
|
752
662
|
| `7` | Assessment unavailable (`--fail-below` used against a `null` index) |
|
|
753
663
|
|
|
@@ -755,81 +665,50 @@ These codes are stable and part of the CLI's public contract.
|
|
|
755
665
|
|
|
756
666
|
## API errors
|
|
757
667
|
|
|
758
|
-
|
|
668
|
+
With `--json` the CLI emits an error object on stdout:
|
|
759
669
|
|
|
760
670
|
```json
|
|
761
671
|
{
|
|
762
672
|
"error": {
|
|
763
673
|
"code": "quota_exceeded",
|
|
764
|
-
"message": "
|
|
765
|
-
"
|
|
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"
|
|
766
680
|
}
|
|
767
681
|
}
|
|
768
682
|
```
|
|
769
683
|
|
|
770
|
-
The CLI prints this as:
|
|
771
|
-
|
|
772
|
-
```text
|
|
773
|
-
NetRiskScan API error
|
|
774
|
-
|
|
775
|
-
Code quota_exceeded
|
|
776
|
-
Status 429
|
|
777
|
-
Message Billing period quota exhausted.
|
|
778
|
-
Request ID req_8f3ab21c9d
|
|
779
|
-
```
|
|
780
|
-
|
|
781
684
|
Known error codes:
|
|
782
685
|
|
|
783
|
-
| HTTP status
|
|
784
|
-
|
|
|
785
|
-
| 400
|
|
786
|
-
| 400
|
|
787
|
-
| 400
|
|
788
|
-
| 401
|
|
789
|
-
| 403
|
|
790
|
-
| 403
|
|
791
|
-
| 404
|
|
792
|
-
| 404
|
|
793
|
-
| 429
|
|
794
|
-
| 429
|
|
795
|
-
|
|
|
796
|
-
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
otherwise. `anonymous_daily_limit_reached` is **never** retried, even though it is also a
|
|
801
|
-
`429`: the daily allowance cannot come back before the UTC reset, so retrying would only
|
|
802
|
-
repeat the same failure three more times. `400` / `401` / `403` / `404` are never retried
|
|
803
|
-
either.
|
|
804
|
-
|
|
805
|
-
Pass `--debug` to any command to include a stack trace on failure. Without it, errors
|
|
806
|
-
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. |
|
|
807
703
|
|
|
808
704
|
## Rate limits & quota
|
|
809
705
|
|
|
810
|
-
|
|
811
|
-
through different channels. Do not read one as the other.
|
|
812
|
-
|
|
813
|
-
### Anonymous daily trial
|
|
814
|
-
|
|
815
|
-
Reported in the response body, on every request:
|
|
816
|
-
|
|
817
|
-
| Field | Meaning |
|
|
818
|
-
| ------------------ | ---------------------------------------------------------------- |
|
|
819
|
-
| `usage.mode` | `anonymous` when the request was served by the trial |
|
|
820
|
-
| `usage.remaining` | Requests still available today - authoritative, never recomputed |
|
|
821
|
-
| `usage.dailyLimit` | The trial's daily allowance |
|
|
822
|
-
| `usage.resetAt` | When the allowance resets (UTC day boundary) |
|
|
823
|
-
|
|
824
|
-
### API key quota
|
|
825
|
-
|
|
826
|
-
Every successful `/v1/*` response carries live rate limit and quota headers, so you
|
|
827
|
-
don't need a separate call to `/v1/usage` to know where you stand:
|
|
706
|
+
Authenticated IP lookups carry rate-limit and quota headers:
|
|
828
707
|
|
|
829
708
|
| Header | Meaning |
|
|
830
709
|
| ------------------------------------------------------------------- | --------------------------------------------------- |
|
|
831
710
|
| `X-RateLimit-Limit` / `X-RateLimit-Remaining` / `X-RateLimit-Reset` | Per-minute limit |
|
|
832
|
-
| `X-Quota-Limit` / `X-Quota-Used` / `X-Quota-Remaining` |
|
|
711
|
+
| `X-Quota-Limit` / `X-Quota-Used` / `X-Quota-Remaining` | Monthly quota |
|
|
833
712
|
| `X-Request-Id` | Request trace id (echoes yours, or a generated one) |
|
|
834
713
|
| `Retry-After` | Present on `429` responses |
|
|
835
714
|
|
|
@@ -847,12 +726,10 @@ Request ID req_xxxxxxxx
|
|
|
847
726
|
|
|
848
727
|
## SDK usage
|
|
849
728
|
|
|
850
|
-
The
|
|
851
|
-
|
|
852
|
-
without changing its shape:
|
|
729
|
+
The package also exports `NetRiskScanClient` and its response and error types for direct
|
|
730
|
+
Node.js/TypeScript integration. The CLI and SDK use the same API client and response contract:
|
|
853
731
|
|
|
854
|
-
The client
|
|
855
|
-
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:
|
|
856
733
|
|
|
857
734
|
```ts
|
|
858
735
|
import { NetRiskScanClient } from "netriskscan-cli";
|
|
@@ -935,7 +812,7 @@ See [examples/](examples/) for runnable scripts.
|
|
|
935
812
|
|
|
936
813
|
## Security
|
|
937
814
|
|
|
938
|
-
-
|
|
815
|
+
- View the full saved key with auth show in an interactive terminal. Error output and browser URLs omit credentials.
|
|
939
816
|
- There is no telemetry: **the CLI does not collect usage analytics or telemetry** of any
|
|
940
817
|
kind, in any version.
|
|
941
818
|
- If `--debug` needs to show an authorization value, it is redacted
|
|
@@ -957,20 +834,14 @@ This is a completely separate system from the netriskscan.com website's internal
|
|
|
957
834
|
`/api/public/*` endpoints - different auth, different response shapes, no compatibility
|
|
958
835
|
guarantees between the two. `netriskscan-cli` only ever calls `/v1/*`.
|
|
959
836
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
- `GET /v1/ip-risk/{ip}`
|
|
963
|
-
- anonymous access supported
|
|
964
|
-
- API key optional
|
|
965
|
-
- API key requests use account quota and require `ip-risk:read`
|
|
966
|
-
- `GET /v1/usage` - requires an API key with `usage:read`
|
|
837
|
+
Endpoints called by the CLI:
|
|
967
838
|
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
`GET|POST /v1/key`, etc. are not implemented). API key creation/rotation/revocation is
|
|
971
|
-
only available through the Developer Dashboard.
|
|
839
|
+
- `GET /v1/ip-risk/{ip}` with `ip-risk:read`
|
|
840
|
+
- `GET /v1/usage` with `usage:read`
|
|
972
841
|
|
|
973
|
-
|
|
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.
|
|
974
845
|
|
|
975
846
|
See the official [Methodology](https://www.netriskscan.com/methodology.html) page for
|
|
976
847
|
how the NetRiskScan Index itself is computed (this project does not - and will not -
|
|
@@ -980,8 +851,7 @@ reimplement that logic client-side).
|
|
|
980
851
|
|
|
981
852
|
### How do I look up an IP address from the command line?
|
|
982
853
|
|
|
983
|
-
Run `netriskscan check <ip>`
|
|
984
|
-
trial. See [Quick start](#quick-start).
|
|
854
|
+
Run `npx netriskscan-cli check <ip>` with a Developer API key. See [Quick start](#quick-start).
|
|
985
855
|
|
|
986
856
|
### How do I check IP reputation from a terminal?
|
|
987
857
|
|
|
@@ -1018,8 +888,7 @@ Yes - `netriskscan check <ip> --json` prints the raw API response, and
|
|
|
1018
888
|
|
|
1019
889
|
### Does NetRiskScan CLI work without an API key?
|
|
1020
890
|
|
|
1021
|
-
|
|
1022
|
-
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).
|
|
1023
892
|
|
|
1024
893
|
## Official resources
|
|
1025
894
|
|