netriskscan-cli 2.0.0 → 2.1.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 +13 -0
- package/README.md +38 -35
- package/dist/cli.js +520 -44
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +3 -12
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [2.1.0](https://github.com/TeamQQ/netriskscan-cli/compare/v2.0.0...v2.1.0) (2026-12-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **cli:** complete Google sign-in and resume authenticated queries ([f32bbbb](https://github.com/TeamQQ/netriskscan-cli/commit/f32bbbbb1e23a5e7db664115b1e3ab2eb133c0ac))
|
|
7
|
+
|
|
8
|
+
## Google authorization
|
|
9
|
+
|
|
10
|
+
- Start the official Google authorization flow when a terminal query needs a key.
|
|
11
|
+
- Save the exchanged key in the OS credential store and resume the original request.
|
|
12
|
+
- Add `auth login`, `auth key`, and monthly usage details in `auth status`.
|
|
13
|
+
|
|
1
14
|
# [2.0.0](https://github.com/TeamQQ/netriskscan-cli/compare/v1.6.2...v2.0.0) (2026-12-02)
|
|
2
15
|
|
|
3
16
|
|
package/README.md
CHANGED
|
@@ -33,9 +33,11 @@ Use the CLI for investigations and operational tasks. Use the TypeScript client
|
|
|
33
33
|
npx netriskscan-cli check 8.8.8.8
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
With no configured key in an interactive terminal, the CLI opens
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
With no configured key in an interactive terminal, the CLI opens NetRiskScan's Google
|
|
37
|
+
authorization page. Click **Continue with Google**, enter the eight-character confirmation
|
|
38
|
+
code shown in the terminal, and approve the installation. NetRiskScan sets up a developer
|
|
39
|
+
account when needed and issues the API key. The CLI saves the key in the OS credential
|
|
40
|
+
store and continues your original query. With a configured key the lookup runs immediately.
|
|
39
41
|
|
|
40
42
|
## Product overview
|
|
41
43
|
|
|
@@ -100,17 +102,26 @@ account-level quota.
|
|
|
100
102
|
|
|
101
103
|
### Migrating from 1.x
|
|
102
104
|
|
|
103
|
-
Version 2 requires a key for all CLI lookups.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
`NetRiskScanClient` callers retain their existing authentication behavior.
|
|
105
|
+
Version 2 requires a key for all CLI lookups. Set `NETRISKSCAN_API_KEY` in CI/CD.
|
|
106
|
+
Interactive Google sign-in can save a key locally. Existing authenticated scripts use
|
|
107
|
+
the same query commands, success payloads, and numeric exit codes. Read `error.code`
|
|
108
|
+
to distinguish failures that share an exit code.
|
|
108
109
|
|
|
109
110
|
## Getting an API key
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
To authorize the CLI before running a query, run:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npx netriskscan-cli auth login
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
If the system browser cannot open, the CLI prints the authorization link and
|
|
119
|
+
confirmation code. Open the link in a browser on any device and keep the terminal
|
|
120
|
+
running. The terminal waits up to ten minutes. Press Ctrl+C to cancel.
|
|
121
|
+
|
|
122
|
+
For a key you already manage in the [Developer Console](https://www.netriskscan.com/developer/keys),
|
|
123
|
+
use `ip-risk:read` for `check` and `batch` and `usage:read` for quota and plan
|
|
124
|
+
reads. Load the key from your secret manager into `NETRISKSCAN_API_KEY`.
|
|
114
125
|
|
|
115
126
|
```bash
|
|
116
127
|
npx netriskscan-cli auth save
|
|
@@ -124,12 +135,18 @@ each invocation. `auth save` sets the variable within its own process.
|
|
|
124
135
|
|
|
125
136
|
| Command | What it does |
|
|
126
137
|
| --------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
127
|
-
| `npx netriskscan-cli auth
|
|
128
|
-
| `npx netriskscan-cli auth status` | Verifies the selected key and shows its masked value,
|
|
138
|
+
| `npx netriskscan-cli auth key` | Reveals the stored key in an interactive terminal. `auth show` is also supported. |
|
|
139
|
+
| `npx netriskscan-cli auth status` | Verifies the selected key and shows its masked value, storage, plan, and monthly usage. |
|
|
129
140
|
| `npx netriskscan-cli auth logout` | Removes the local credential. Server-side revocation is available in the Developer Console. |
|
|
130
141
|
|
|
131
|
-
|
|
132
|
-
|
|
142
|
+
The CLI displays the newly saved key once after authorization. Treat it as a sensitive
|
|
143
|
+
credential. View your Google email and key name in the Developer Console.
|
|
144
|
+
|
|
145
|
+
The [Developer API authorization contract](https://www.netriskscan.com/assets/paid-api-v1.yaml)
|
|
146
|
+
uses browser confirmation, PKCE-protected polling, and RSA-encrypted key delivery.
|
|
147
|
+
The OS credential store holds the key and any pending delivery proof. If you remove
|
|
148
|
+
the local key while the installation's server key is still active, revoke that key
|
|
149
|
+
in the Developer Console before authorizing a replacement.
|
|
133
150
|
|
|
134
151
|
## CLI and TypeScript integration
|
|
135
152
|
|
|
@@ -729,24 +746,7 @@ Request ID req_xxxxxxxx
|
|
|
729
746
|
The package also exports `NetRiskScanClient` and its response and error types for direct
|
|
730
747
|
Node.js/TypeScript integration. The CLI and SDK use the same API client and response contract:
|
|
731
748
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
```ts
|
|
735
|
-
import { NetRiskScanClient } from "netriskscan-cli";
|
|
736
|
-
|
|
737
|
-
const client = new NetRiskScanClient();
|
|
738
|
-
|
|
739
|
-
const { data } = await client.checkIp("1.1.1.1");
|
|
740
|
-
console.log(data.risk.index);
|
|
741
|
-
|
|
742
|
-
if (data.usage?.mode === "anonymous") {
|
|
743
|
-
console.log("available:", data.usage.remaining);
|
|
744
|
-
}
|
|
745
|
-
```
|
|
746
|
-
|
|
747
|
-
Pass `apiKey` to use Developer Account quota instead. `getUsage()` is account data and
|
|
748
|
-
always requires a key - without one it throws `NetRiskScanConfigError` before any request
|
|
749
|
-
is made:
|
|
749
|
+
Supply `apiKey` to use the Developer API and read the account's quota:
|
|
750
750
|
|
|
751
751
|
```ts
|
|
752
752
|
import { NetRiskScanClient, NetRiskScanApiError } from "netriskscan-cli";
|
|
@@ -812,7 +812,8 @@ See [examples/](examples/) for runnable scripts.
|
|
|
812
812
|
|
|
813
813
|
## Security
|
|
814
814
|
|
|
815
|
-
-
|
|
815
|
+
- The interactive CLI displays a newly saved key once after Google authorization.
|
|
816
|
+
Use `auth key` to view a saved key again. Error output and browser URLs omit the API key.
|
|
816
817
|
- There is no telemetry: **the CLI does not collect usage analytics or telemetry** of any
|
|
817
818
|
kind, in any version.
|
|
818
819
|
- If `--debug` needs to show an authorization value, it is redacted
|
|
@@ -838,6 +839,7 @@ Endpoints called by the CLI:
|
|
|
838
839
|
|
|
839
840
|
- `GET /v1/ip-risk/{ip}` with `ip-risk:read`
|
|
840
841
|
- `GET /v1/usage` with `usage:read`
|
|
842
|
+
- `POST /v1/cli/authorization` and its poll, exchange, and acknowledge endpoints for Google sign-in
|
|
841
843
|
|
|
842
844
|
The [OpenAPI contract](https://www.netriskscan.com/assets/paid-api-v1.yaml) also
|
|
843
845
|
documents the server-side batch endpoint. Key creation, rotation, and revocation
|
|
@@ -888,7 +890,8 @@ Yes - `netriskscan check <ip> --json` prints the raw API response, and
|
|
|
888
890
|
|
|
889
891
|
### Does NetRiskScan CLI work without an API key?
|
|
890
892
|
|
|
891
|
-
The CLI
|
|
893
|
+
The CLI obtains a key through [interactive Google authorization](#getting-an-api-key).
|
|
894
|
+
For CI and machine output, set `NETRISKSCAN_API_KEY` before running the command.
|
|
892
895
|
|
|
893
896
|
## Official resources
|
|
894
897
|
|