@censys/platform-sdk 0.4.3 → 0.5.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/FUNCTIONS.md +0 -1
- package/README.md +17 -2
- package/docs/sdks/collections/README.md +12 -6
- package/docs/sdks/globaldata/README.md +347 -6
- package/docs/sdks/threathunting/README.md +248 -0
- package/examples/globalDataSearch.example.ts +0 -1
- package/examples/package-lock.json +5 -6
- package/funcs/globalDataCreateTrackedScan.d.ts +18 -0
- package/funcs/globalDataCreateTrackedScan.d.ts.map +1 -0
- package/funcs/globalDataCreateTrackedScan.js +132 -0
- package/funcs/globalDataCreateTrackedScan.js.map +1 -0
- package/funcs/globalDataGetHostObservationsWithCertificate.d.ts +18 -0
- package/funcs/globalDataGetHostObservationsWithCertificate.d.ts.map +1 -0
- package/funcs/globalDataGetHostObservationsWithCertificate.js +141 -0
- package/funcs/globalDataGetHostObservationsWithCertificate.js.map +1 -0
- package/funcs/globalDataGetTrackedScan.d.ts +19 -0
- package/funcs/globalDataGetTrackedScan.d.ts.map +1 -0
- package/funcs/globalDataGetTrackedScan.js +137 -0
- package/funcs/globalDataGetTrackedScan.js.map +1 -0
- package/funcs/globalDataGetTrackedScanThreatHunting.d.ts +19 -0
- package/funcs/globalDataGetTrackedScanThreatHunting.d.ts.map +1 -0
- package/funcs/globalDataGetTrackedScanThreatHunting.js +137 -0
- package/funcs/globalDataGetTrackedScanThreatHunting.js.map +1 -0
- package/funcs/threatHuntingCreateTrackedScan.d.ts +18 -0
- package/funcs/threatHuntingCreateTrackedScan.d.ts.map +1 -0
- package/funcs/threatHuntingCreateTrackedScan.js +129 -0
- package/funcs/threatHuntingCreateTrackedScan.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +4 -4
- package/lib/config.js +4 -4
- package/models/components/elasticsearch.d.ts +3 -0
- package/models/components/elasticsearch.d.ts.map +1 -1
- package/models/components/elasticsearch.js +5 -0
- package/models/components/elasticsearch.js.map +1 -1
- package/models/components/elasticsearcherrormessage.d.ts +33 -0
- package/models/components/elasticsearcherrormessage.d.ts.map +1 -0
- package/models/components/elasticsearcherrormessage.js +73 -0
- package/models/components/elasticsearcherrormessage.js.map +1 -0
- package/models/components/hostobservationrange.d.ts +39 -0
- package/models/components/hostobservationrange.d.ts.map +1 -0
- package/models/components/hostobservationrange.js +92 -0
- package/models/components/hostobservationrange.js.map +1 -0
- package/models/components/hostobservationresponse.d.ts +34 -0
- package/models/components/hostobservationresponse.d.ts.map +1 -0
- package/models/components/hostobservationresponse.js +85 -0
- package/models/components/hostobservationresponse.js.map +1 -0
- package/models/components/httpfavicon.d.ts +5 -0
- package/models/components/httpfavicon.d.ts.map +1 -1
- package/models/components/httpfavicon.js +4 -0
- package/models/components/httpfavicon.js.map +1 -1
- package/models/components/index.d.ts +14 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +14 -0
- package/models/components/index.js.map +1 -1
- package/models/components/responseenvelopehostobservationresponse.d.ts +30 -0
- package/models/components/responseenvelopehostobservationresponse.d.ts.map +1 -0
- package/models/components/responseenvelopehostobservationresponse.js +70 -0
- package/models/components/responseenvelopehostobservationresponse.js.map +1 -0
- package/models/components/responseenvelopetrackedscan.d.ts +30 -0
- package/models/components/responseenvelopetrackedscan.d.ts.map +1 -0
- package/models/components/responseenvelopetrackedscan.js +70 -0
- package/models/components/responseenvelopetrackedscan.js.map +1 -0
- package/models/components/scansdiscoveryinputbody.d.ts +172 -0
- package/models/components/scansdiscoveryinputbody.d.ts.map +1 -0
- package/models/components/scansdiscoveryinputbody.js +233 -0
- package/models/components/scansdiscoveryinputbody.js.map +1 -0
- package/models/components/scansrescaninputbody.d.ts +214 -0
- package/models/components/scansrescaninputbody.d.ts.map +1 -0
- package/models/components/scansrescaninputbody.js +268 -0
- package/models/components/scansrescaninputbody.js.map +1 -0
- package/models/components/screenshot.d.ts +2 -0
- package/models/components/screenshot.d.ts.map +1 -1
- package/models/components/screenshot.js +11 -0
- package/models/components/screenshot.js.map +1 -1
- package/models/components/searchaggregateinputbody.d.ts +5 -0
- package/models/components/searchaggregateinputbody.d.ts.map +1 -1
- package/models/components/searchaggregateinputbody.js +4 -0
- package/models/components/searchaggregateinputbody.js.map +1 -1
- package/models/components/searchvaluecountsinputbody.d.ts +5 -0
- package/models/components/searchvaluecountsinputbody.d.ts.map +1 -1
- package/models/components/searchvaluecountsinputbody.js +2 -0
- package/models/components/searchvaluecountsinputbody.js.map +1 -1
- package/models/components/serviceid.d.ts +70 -0
- package/models/components/serviceid.d.ts.map +1 -0
- package/models/components/serviceid.js +106 -0
- package/models/components/serviceid.js.map +1 -0
- package/models/components/trackedscan.d.ts +39 -0
- package/models/components/trackedscan.d.ts.map +1 -0
- package/models/components/trackedscan.js +90 -0
- package/models/components/trackedscan.js.map +1 -0
- package/models/components/trackedscanscantarget.d.ts +39 -0
- package/models/components/trackedscanscantarget.d.ts.map +1 -0
- package/models/components/trackedscanscantarget.js +94 -0
- package/models/components/trackedscanscantarget.js.map +1 -0
- package/models/components/trackedscanscantargethostnameport.d.ts +31 -0
- package/models/components/trackedscanscantargethostnameport.d.ts.map +1 -0
- package/models/components/trackedscanscantargethostnameport.js +71 -0
- package/models/components/trackedscanscantargethostnameport.js.map +1 -0
- package/models/components/trackedscanscantargethostport.d.ts +31 -0
- package/models/components/trackedscanscantargethostport.d.ts.map +1 -0
- package/models/components/trackedscanscantargethostport.js +71 -0
- package/models/components/trackedscanscantargethostport.js.map +1 -0
- package/models/components/trackedscantask.d.ts +74 -0
- package/models/components/trackedscantask.d.ts.map +1 -0
- package/models/components/trackedscantask.js +106 -0
- package/models/components/trackedscantask.js.map +1 -0
- package/models/components/weborigin.d.ts +31 -0
- package/models/components/weborigin.d.ts.map +1 -0
- package/models/components/weborigin.js +71 -0
- package/models/components/weborigin.js.map +1 -0
- package/models/operations/index.d.ts +5 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +5 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/v3globaldatagethostobservationswithcertificate.d.ts +124 -0
- package/models/operations/v3globaldatagethostobservationswithcertificate.d.ts.map +1 -0
- package/models/operations/v3globaldatagethostobservationswithcertificate.js +178 -0
- package/models/operations/v3globaldatagethostobservationswithcertificate.js.map +1 -0
- package/models/operations/v3globaldatascansget.d.ts +94 -0
- package/models/operations/v3globaldatascansget.d.ts.map +1 -0
- package/models/operations/v3globaldatascansget.js +157 -0
- package/models/operations/v3globaldatascansget.js.map +1 -0
- package/models/operations/v3globaldatascansrescan.d.ts +91 -0
- package/models/operations/v3globaldatascansrescan.d.ts.map +1 -0
- package/models/operations/v3globaldatascansrescan.js +157 -0
- package/models/operations/v3globaldatascansrescan.js.map +1 -0
- package/models/operations/v3threathuntingscansdiscovery.d.ts +91 -0
- package/models/operations/v3threathuntingscansdiscovery.d.ts.map +1 -0
- package/models/operations/v3threathuntingscansdiscovery.js +157 -0
- package/models/operations/v3threathuntingscansdiscovery.js.map +1 -0
- package/models/operations/v3threathuntingscansget.d.ts +94 -0
- package/models/operations/v3threathuntingscansget.d.ts.map +1 -0
- package/models/operations/v3threathuntingscansget.js +157 -0
- package/models/operations/v3threathuntingscansget.js.map +1 -0
- package/package.json +4 -5
- package/sdk/globaldata.d.ts +30 -0
- package/sdk/globaldata.d.ts.map +1 -1
- package/sdk/globaldata.js +42 -0
- package/sdk/globaldata.js.map +1 -1
- package/sdk/threathunting.d.ts +23 -0
- package/sdk/threathunting.d.ts.map +1 -1
- package/sdk/threathunting.js +32 -0
- package/sdk/threathunting.js.map +1 -1
- package/src/funcs/globalDataCreateTrackedScan.ts +185 -0
- package/src/funcs/globalDataGetHostObservationsWithCertificate.ts +201 -0
- package/src/funcs/globalDataGetTrackedScan.ts +191 -0
- package/src/funcs/globalDataGetTrackedScanThreatHunting.ts +191 -0
- package/src/funcs/threatHuntingCreateTrackedScan.ts +188 -0
- package/src/lib/config.ts +4 -4
- package/src/models/components/elasticsearch.ts +12 -0
- package/src/models/components/elasticsearcherrormessage.ts +74 -0
- package/src/models/components/hostobservationrange.ts +99 -0
- package/src/models/components/hostobservationresponse.ts +91 -0
- package/src/models/components/httpfavicon.ts +9 -0
- package/src/models/components/index.ts +14 -0
- package/src/models/components/responseenvelopehostobservationresponse.ts +83 -0
- package/src/models/components/responseenvelopetrackedscan.ts +74 -0
- package/src/models/components/scansdiscoveryinputbody.ts +385 -0
- package/src/models/components/scansrescaninputbody.ts +428 -0
- package/src/models/components/screenshot.ts +13 -0
- package/src/models/components/searchaggregateinputbody.ts +9 -0
- package/src/models/components/searchvaluecountsinputbody.ts +7 -0
- package/src/models/components/serviceid.ts +116 -0
- package/src/models/components/trackedscan.ts +101 -0
- package/src/models/components/trackedscanscantarget.ts +117 -0
- package/src/models/components/trackedscanscantargethostnameport.ts +73 -0
- package/src/models/components/trackedscanscantargethostport.ts +72 -0
- package/src/models/components/trackedscantask.ts +114 -0
- package/src/models/components/weborigin.ts +66 -0
- package/src/models/operations/index.ts +5 -0
- package/src/models/operations/v3globaldatagethostobservationswithcertificate.ts +317 -0
- package/src/models/operations/v3globaldatascansget.ts +232 -0
- package/src/models/operations/v3globaldatascansrescan.ts +229 -0
- package/src/models/operations/v3threathuntingscansdiscovery.ts +238 -0
- package/src/models/operations/v3threathuntingscansget.ts +232 -0
- package/src/sdk/globaldata.ts +76 -0
- package/src/sdk/threathunting.ts +56 -0
|
@@ -9,13 +9,17 @@ Endpoints related to the Global Data product
|
|
|
9
9
|
|
|
10
10
|
* [getCertificates](#getcertificates) - Get multiple certificates
|
|
11
11
|
* [getCertificate](#getcertificate) - Get a certificate
|
|
12
|
+
* [getHostObservationsWithCertificate](#gethostobservationswithcertificate) - Get Host Observations With Certificate
|
|
12
13
|
* [getHosts](#gethosts) - Get multiple hosts
|
|
13
14
|
* [getHost](#gethost) - Get a host
|
|
14
15
|
* [getHostTimeline](#gethosttimeline) - Get host event history
|
|
15
16
|
* [getWebProperties](#getwebproperties) - Get multiple web properties
|
|
16
17
|
* [getWebProperty](#getwebproperty) - Get a web property
|
|
18
|
+
* [createTrackedScan](#createtrackedscan) - Create a tracked rescan
|
|
19
|
+
* [getTrackedScan](#gettrackedscan) - Get tracked scan details
|
|
17
20
|
* [aggregate](#aggregate) - Aggregate results for a search query
|
|
18
21
|
* [search](#search) - Run a search query
|
|
22
|
+
* [getTrackedScanThreatHunting](#gettrackedscanthreathunting) - Get tracked scan details
|
|
19
23
|
|
|
20
24
|
## getCertificates
|
|
21
25
|
|
|
@@ -23,6 +27,7 @@ Retrieve information about multiple certificates. A certificate ID is its SHA-25
|
|
|
23
27
|
|
|
24
28
|
### Example Usage
|
|
25
29
|
|
|
30
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-asset-certificate-list" method="get" path="/v3/global/asset/certificate" -->
|
|
26
31
|
```typescript
|
|
27
32
|
import { SDK } from "@censys/platform-sdk";
|
|
28
33
|
|
|
@@ -102,6 +107,7 @@ Retrieve information about a single certificate. A certificate ID is its SHA-256
|
|
|
102
107
|
|
|
103
108
|
### Example Usage
|
|
104
109
|
|
|
110
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-asset-certificate" method="get" path="/v3/global/asset/certificate/{certificate_id}" -->
|
|
105
111
|
```typescript
|
|
106
112
|
import { SDK } from "@censys/platform-sdk";
|
|
107
113
|
|
|
@@ -171,12 +177,99 @@ run();
|
|
|
171
177
|
| errors.ErrorModel | 401, 403 | application/problem+json |
|
|
172
178
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
173
179
|
|
|
180
|
+
## getHostObservationsWithCertificate
|
|
181
|
+
|
|
182
|
+
Retrieve historical observations of hosts associated with a certificate fingerprint. Useful for threat hunting, detection engineering, and timeline generation.
|
|
183
|
+
|
|
184
|
+
### Example Usage
|
|
185
|
+
|
|
186
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-get-host-observations-with-certificate" method="get" path="/v3/global/asset/certificate/{certificate_id}/observations/hosts" -->
|
|
187
|
+
```typescript
|
|
188
|
+
import { SDK } from "@censys/platform-sdk";
|
|
189
|
+
|
|
190
|
+
const sdk = new SDK({
|
|
191
|
+
organizationId: "11111111-2222-3333-4444-555555555555",
|
|
192
|
+
personalAccessToken: "<YOUR_BEARER_TOKEN_HERE>",
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
async function run() {
|
|
196
|
+
const result = await sdk.globalData.getHostObservationsWithCertificate({
|
|
197
|
+
certificateId: "55af8a301eb51abdaf7c31bec951638fe5a99d5d92117eca2be493026613fa46",
|
|
198
|
+
startTime: "2023-01-01T00:00:00Z",
|
|
199
|
+
endTime: "2023-12-31T23:59:59Z",
|
|
200
|
+
port: 443,
|
|
201
|
+
protocol: "TCP",
|
|
202
|
+
pageSize: 50,
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
console.log(result);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
run();
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Standalone function
|
|
212
|
+
|
|
213
|
+
The standalone function version of this method:
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import { SDKCore } from "@censys/platform-sdk/core.js";
|
|
217
|
+
import { globalDataGetHostObservationsWithCertificate } from "@censys/platform-sdk/funcs/globalDataGetHostObservationsWithCertificate.js";
|
|
218
|
+
|
|
219
|
+
// Use `SDKCore` for best tree-shaking performance.
|
|
220
|
+
// You can create one instance of it to use across an application.
|
|
221
|
+
const sdk = new SDKCore({
|
|
222
|
+
organizationId: "11111111-2222-3333-4444-555555555555",
|
|
223
|
+
personalAccessToken: "<YOUR_BEARER_TOKEN_HERE>",
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
async function run() {
|
|
227
|
+
const res = await globalDataGetHostObservationsWithCertificate(sdk, {
|
|
228
|
+
certificateId: "55af8a301eb51abdaf7c31bec951638fe5a99d5d92117eca2be493026613fa46",
|
|
229
|
+
startTime: "2023-01-01T00:00:00Z",
|
|
230
|
+
endTime: "2023-12-31T23:59:59Z",
|
|
231
|
+
port: 443,
|
|
232
|
+
protocol: "TCP",
|
|
233
|
+
pageSize: 50,
|
|
234
|
+
});
|
|
235
|
+
if (res.ok) {
|
|
236
|
+
const { value: result } = res;
|
|
237
|
+
console.log(result);
|
|
238
|
+
} else {
|
|
239
|
+
console.log("globalDataGetHostObservationsWithCertificate failed:", res.error);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
run();
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Parameters
|
|
247
|
+
|
|
248
|
+
| Parameter | Type | Required | Description |
|
|
249
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
250
|
+
| `request` | [operations.V3GlobaldataGetHostObservationsWithCertificateRequest](../../models/operations/v3globaldatagethostobservationswithcertificaterequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
251
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
252
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
253
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
254
|
+
|
|
255
|
+
### Response
|
|
256
|
+
|
|
257
|
+
**Promise\<[operations.V3GlobaldataGetHostObservationsWithCertificateResponse](../../models/operations/v3globaldatagethostobservationswithcertificateresponse.md)\>**
|
|
258
|
+
|
|
259
|
+
### Errors
|
|
260
|
+
|
|
261
|
+
| Error Type | Status Code | Content Type |
|
|
262
|
+
| ------------------------ | ------------------------ | ------------------------ |
|
|
263
|
+
| errors.ErrorModel | 401, 403 | application/problem+json |
|
|
264
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
265
|
+
|
|
174
266
|
## getHosts
|
|
175
267
|
|
|
176
268
|
Retrieve information about multiple hosts. A host ID is its IP address.
|
|
177
269
|
|
|
178
270
|
### Example Usage
|
|
179
271
|
|
|
272
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-asset-host-list" method="get" path="/v3/global/asset/host" -->
|
|
180
273
|
```typescript
|
|
181
274
|
import { SDK } from "@censys/platform-sdk";
|
|
182
275
|
|
|
@@ -256,6 +349,7 @@ Retrieve information about a single host. A host ID is its IP address.
|
|
|
256
349
|
|
|
257
350
|
### Example Usage
|
|
258
351
|
|
|
352
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-asset-host" method="get" path="/v3/global/asset/host/{host_id}" -->
|
|
259
353
|
```typescript
|
|
260
354
|
import { SDK } from "@censys/platform-sdk";
|
|
261
355
|
|
|
@@ -333,6 +427,7 @@ Retrieve event history for a host. A host ID is its IP address.
|
|
|
333
427
|
|
|
334
428
|
### Example Usage
|
|
335
429
|
|
|
430
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-asset-host-timeline" method="get" path="/v3/global/asset/host/{host_id}/timeline" -->
|
|
336
431
|
```typescript
|
|
337
432
|
import { SDK } from "@censys/platform-sdk";
|
|
338
433
|
|
|
@@ -412,6 +507,7 @@ Retrieve information about multiple web properties. Web properties are identifie
|
|
|
412
507
|
|
|
413
508
|
### Example Usage
|
|
414
509
|
|
|
510
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-asset-webproperty-list" method="get" path="/v3/global/asset/webproperty" -->
|
|
415
511
|
```typescript
|
|
416
512
|
import { SDK } from "@censys/platform-sdk";
|
|
417
513
|
|
|
@@ -491,6 +587,7 @@ Retrieve information about a single web property. Web properties are identified
|
|
|
491
587
|
|
|
492
588
|
### Example Usage
|
|
493
589
|
|
|
590
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-asset-webproperty" method="get" path="/v3/global/asset/webproperty/{webproperty_id}" -->
|
|
494
591
|
```typescript
|
|
495
592
|
import { SDK } from "@censys/platform-sdk";
|
|
496
593
|
|
|
@@ -562,12 +659,180 @@ run();
|
|
|
562
659
|
| errors.ErrorModel | 401, 403 | application/problem+json |
|
|
563
660
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
564
661
|
|
|
662
|
+
## createTrackedScan
|
|
663
|
+
|
|
664
|
+
Create a new tracked rescan for a known service or web property. Rescans are used to update information for previously discovered targets. The scan will be queued. The response will contain a scan ID that you can use with the [get tracked scan details endpoint](https://docs.censys.com/reference/v3-globaldata-scans-get#/) to monitor its status and results.<br><br>This endpoint is available to all Enterprise customers.
|
|
665
|
+
|
|
666
|
+
### Example Usage
|
|
667
|
+
|
|
668
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-scans-rescan" method="post" path="/v3/global/scans/rescan" -->
|
|
669
|
+
```typescript
|
|
670
|
+
import { SDK } from "@censys/platform-sdk";
|
|
671
|
+
|
|
672
|
+
const sdk = new SDK({
|
|
673
|
+
organizationId: "11111111-2222-3333-4444-555555555555",
|
|
674
|
+
personalAccessToken: "<YOUR_BEARER_TOKEN_HERE>",
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
async function run() {
|
|
678
|
+
const result = await sdk.globalData.createTrackedScan({
|
|
679
|
+
scansRescanInputBody: {
|
|
680
|
+
target: {
|
|
681
|
+
webOrigin: {
|
|
682
|
+
hostname: "censys.io",
|
|
683
|
+
port: 443,
|
|
684
|
+
},
|
|
685
|
+
},
|
|
686
|
+
},
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
console.log(result);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
run();
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
### Standalone function
|
|
696
|
+
|
|
697
|
+
The standalone function version of this method:
|
|
698
|
+
|
|
699
|
+
```typescript
|
|
700
|
+
import { SDKCore } from "@censys/platform-sdk/core.js";
|
|
701
|
+
import { globalDataCreateTrackedScan } from "@censys/platform-sdk/funcs/globalDataCreateTrackedScan.js";
|
|
702
|
+
|
|
703
|
+
// Use `SDKCore` for best tree-shaking performance.
|
|
704
|
+
// You can create one instance of it to use across an application.
|
|
705
|
+
const sdk = new SDKCore({
|
|
706
|
+
organizationId: "11111111-2222-3333-4444-555555555555",
|
|
707
|
+
personalAccessToken: "<YOUR_BEARER_TOKEN_HERE>",
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
async function run() {
|
|
711
|
+
const res = await globalDataCreateTrackedScan(sdk, {
|
|
712
|
+
scansRescanInputBody: {
|
|
713
|
+
target: {
|
|
714
|
+
webOrigin: {
|
|
715
|
+
hostname: "censys.io",
|
|
716
|
+
port: 443,
|
|
717
|
+
},
|
|
718
|
+
},
|
|
719
|
+
},
|
|
720
|
+
});
|
|
721
|
+
if (res.ok) {
|
|
722
|
+
const { value: result } = res;
|
|
723
|
+
console.log(result);
|
|
724
|
+
} else {
|
|
725
|
+
console.log("globalDataCreateTrackedScan failed:", res.error);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
run();
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
### Parameters
|
|
733
|
+
|
|
734
|
+
| Parameter | Type | Required | Description |
|
|
735
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
736
|
+
| `request` | [operations.V3GlobaldataScansRescanRequest](../../models/operations/v3globaldatascansrescanrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
737
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
738
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
739
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
740
|
+
|
|
741
|
+
### Response
|
|
742
|
+
|
|
743
|
+
**Promise\<[operations.V3GlobaldataScansRescanResponse](../../models/operations/v3globaldatascansrescanresponse.md)\>**
|
|
744
|
+
|
|
745
|
+
### Errors
|
|
746
|
+
|
|
747
|
+
| Error Type | Status Code | Content Type |
|
|
748
|
+
| ------------------------ | ------------------------ | ------------------------ |
|
|
749
|
+
| errors.ErrorModel | 401, 403 | application/problem+json |
|
|
750
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
751
|
+
|
|
752
|
+
## getTrackedScan
|
|
753
|
+
|
|
754
|
+
Retrieve the current status and results of a tracked scan by its ID.
|
|
755
|
+
This endpoint works for both discovery scans and rescans.
|
|
756
|
+
|
|
757
|
+
### Example Usage
|
|
758
|
+
|
|
759
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-scans-get" method="get" path="/v3/global/scans/{scan_id}" -->
|
|
760
|
+
```typescript
|
|
761
|
+
import { SDK } from "@censys/platform-sdk";
|
|
762
|
+
|
|
763
|
+
const sdk = new SDK({
|
|
764
|
+
organizationId: "11111111-2222-3333-4444-555555555555",
|
|
765
|
+
personalAccessToken: "<YOUR_BEARER_TOKEN_HERE>",
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
async function run() {
|
|
769
|
+
const result = await sdk.globalData.getTrackedScan({
|
|
770
|
+
scanId: "5f39588f-d4c5-48e5-8894-0bb5918c28fa",
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
console.log(result);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
run();
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
### Standalone function
|
|
780
|
+
|
|
781
|
+
The standalone function version of this method:
|
|
782
|
+
|
|
783
|
+
```typescript
|
|
784
|
+
import { SDKCore } from "@censys/platform-sdk/core.js";
|
|
785
|
+
import { globalDataGetTrackedScan } from "@censys/platform-sdk/funcs/globalDataGetTrackedScan.js";
|
|
786
|
+
|
|
787
|
+
// Use `SDKCore` for best tree-shaking performance.
|
|
788
|
+
// You can create one instance of it to use across an application.
|
|
789
|
+
const sdk = new SDKCore({
|
|
790
|
+
organizationId: "11111111-2222-3333-4444-555555555555",
|
|
791
|
+
personalAccessToken: "<YOUR_BEARER_TOKEN_HERE>",
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
async function run() {
|
|
795
|
+
const res = await globalDataGetTrackedScan(sdk, {
|
|
796
|
+
scanId: "5f39588f-d4c5-48e5-8894-0bb5918c28fa",
|
|
797
|
+
});
|
|
798
|
+
if (res.ok) {
|
|
799
|
+
const { value: result } = res;
|
|
800
|
+
console.log(result);
|
|
801
|
+
} else {
|
|
802
|
+
console.log("globalDataGetTrackedScan failed:", res.error);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
run();
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
### Parameters
|
|
810
|
+
|
|
811
|
+
| Parameter | Type | Required | Description |
|
|
812
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
813
|
+
| `request` | [operations.V3GlobaldataScansGetRequest](../../models/operations/v3globaldatascansgetrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
814
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
815
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
816
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
817
|
+
|
|
818
|
+
### Response
|
|
819
|
+
|
|
820
|
+
**Promise\<[operations.V3GlobaldataScansGetResponse](../../models/operations/v3globaldatascansgetresponse.md)\>**
|
|
821
|
+
|
|
822
|
+
### Errors
|
|
823
|
+
|
|
824
|
+
| Error Type | Status Code | Content Type |
|
|
825
|
+
| ------------------------ | ------------------------ | ------------------------ |
|
|
826
|
+
| errors.ErrorModel | 401, 403 | application/problem+json |
|
|
827
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
828
|
+
|
|
565
829
|
## aggregate
|
|
566
830
|
|
|
567
831
|
Aggregate results for a Platform search query. This functionality is equivalent to the [Report Builder](https://docs.censys.com/docs/platform-report-builder#/) in the Platform web UI.
|
|
568
832
|
|
|
569
833
|
### Example Usage
|
|
570
834
|
|
|
835
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-search-aggregate" method="post" path="/v3/global/search/aggregate" -->
|
|
571
836
|
```typescript
|
|
572
837
|
import { SDK } from "@censys/platform-sdk";
|
|
573
838
|
|
|
@@ -579,9 +844,9 @@ const sdk = new SDK({
|
|
|
579
844
|
async function run() {
|
|
580
845
|
const result = await sdk.globalData.aggregate({
|
|
581
846
|
searchAggregateInputBody: {
|
|
582
|
-
field: "
|
|
847
|
+
field: "host.services.port",
|
|
583
848
|
numberOfBuckets: 100,
|
|
584
|
-
query: "
|
|
849
|
+
query: "host.services.protocol=SSH",
|
|
585
850
|
},
|
|
586
851
|
});
|
|
587
852
|
|
|
@@ -609,9 +874,9 @@ const sdk = new SDKCore({
|
|
|
609
874
|
async function run() {
|
|
610
875
|
const res = await globalDataAggregate(sdk, {
|
|
611
876
|
searchAggregateInputBody: {
|
|
612
|
-
field: "
|
|
877
|
+
field: "host.services.port",
|
|
613
878
|
numberOfBuckets: 100,
|
|
614
|
-
query: "
|
|
879
|
+
query: "host.services.protocol=SSH",
|
|
615
880
|
},
|
|
616
881
|
});
|
|
617
882
|
if (res.ok) {
|
|
@@ -651,6 +916,7 @@ Run a search query across Censys data. Reference the [documentation on Censys Qu
|
|
|
651
916
|
|
|
652
917
|
### Example Usage
|
|
653
918
|
|
|
919
|
+
<!-- UsageSnippet language="typescript" operationID="v3-globaldata-search-query" method="post" path="/v3/global/search/query" -->
|
|
654
920
|
```typescript
|
|
655
921
|
import { SDK } from "@censys/platform-sdk";
|
|
656
922
|
|
|
@@ -666,7 +932,6 @@ async function run() {
|
|
|
666
932
|
"host.ip",
|
|
667
933
|
],
|
|
668
934
|
pageSize: 1,
|
|
669
|
-
pageToken: "<next_page_token>",
|
|
670
935
|
query: "host.services: (protocol=SSH and not port: 22)",
|
|
671
936
|
},
|
|
672
937
|
});
|
|
@@ -699,7 +964,6 @@ async function run() {
|
|
|
699
964
|
"host.ip",
|
|
700
965
|
],
|
|
701
966
|
pageSize: 1,
|
|
702
|
-
pageToken: "<next_page_token>",
|
|
703
967
|
query: "host.services: (protocol=SSH and not port: 22)",
|
|
704
968
|
},
|
|
705
969
|
});
|
|
@@ -729,6 +993,83 @@ run();
|
|
|
729
993
|
|
|
730
994
|
### Errors
|
|
731
995
|
|
|
996
|
+
| Error Type | Status Code | Content Type |
|
|
997
|
+
| ------------------------ | ------------------------ | ------------------------ |
|
|
998
|
+
| errors.ErrorModel | 401, 403 | application/problem+json |
|
|
999
|
+
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
1000
|
+
|
|
1001
|
+
## getTrackedScanThreatHunting
|
|
1002
|
+
|
|
1003
|
+
Retrieve the current status and results of a tracked scan by its ID.
|
|
1004
|
+
This endpoint works for both discovery scans and rescans.
|
|
1005
|
+
|
|
1006
|
+
### Example Usage
|
|
1007
|
+
|
|
1008
|
+
<!-- UsageSnippet language="typescript" operationID="v3-threathunting-scans-get" method="get" path="/v3/threat-hunting/scans/{scan_id}" -->
|
|
1009
|
+
```typescript
|
|
1010
|
+
import { SDK } from "@censys/platform-sdk";
|
|
1011
|
+
|
|
1012
|
+
const sdk = new SDK({
|
|
1013
|
+
organizationId: "11111111-2222-3333-4444-555555555555",
|
|
1014
|
+
personalAccessToken: "<YOUR_BEARER_TOKEN_HERE>",
|
|
1015
|
+
});
|
|
1016
|
+
|
|
1017
|
+
async function run() {
|
|
1018
|
+
const result = await sdk.globalData.getTrackedScanThreatHunting({
|
|
1019
|
+
scanId: "cd62e794-9f12-4c2f-b5b3-153853aaf8d9",
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1022
|
+
console.log(result);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
run();
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
### Standalone function
|
|
1029
|
+
|
|
1030
|
+
The standalone function version of this method:
|
|
1031
|
+
|
|
1032
|
+
```typescript
|
|
1033
|
+
import { SDKCore } from "@censys/platform-sdk/core.js";
|
|
1034
|
+
import { globalDataGetTrackedScanThreatHunting } from "@censys/platform-sdk/funcs/globalDataGetTrackedScanThreatHunting.js";
|
|
1035
|
+
|
|
1036
|
+
// Use `SDKCore` for best tree-shaking performance.
|
|
1037
|
+
// You can create one instance of it to use across an application.
|
|
1038
|
+
const sdk = new SDKCore({
|
|
1039
|
+
organizationId: "11111111-2222-3333-4444-555555555555",
|
|
1040
|
+
personalAccessToken: "<YOUR_BEARER_TOKEN_HERE>",
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
async function run() {
|
|
1044
|
+
const res = await globalDataGetTrackedScanThreatHunting(sdk, {
|
|
1045
|
+
scanId: "cd62e794-9f12-4c2f-b5b3-153853aaf8d9",
|
|
1046
|
+
});
|
|
1047
|
+
if (res.ok) {
|
|
1048
|
+
const { value: result } = res;
|
|
1049
|
+
console.log(result);
|
|
1050
|
+
} else {
|
|
1051
|
+
console.log("globalDataGetTrackedScanThreatHunting failed:", res.error);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
run();
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
### Parameters
|
|
1059
|
+
|
|
1060
|
+
| Parameter | Type | Required | Description |
|
|
1061
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1062
|
+
| `request` | [operations.V3ThreathuntingScansGetRequest](../../models/operations/v3threathuntingscansgetrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
1063
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
1064
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
1065
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
1066
|
+
|
|
1067
|
+
### Response
|
|
1068
|
+
|
|
1069
|
+
**Promise\<[operations.V3ThreathuntingScansGetResponse](../../models/operations/v3threathuntingscansgetresponse.md)\>**
|
|
1070
|
+
|
|
1071
|
+
### Errors
|
|
1072
|
+
|
|
732
1073
|
| Error Type | Status Code | Content Type |
|
|
733
1074
|
| ------------------------ | ------------------------ | ------------------------ |
|
|
734
1075
|
| errors.ErrorModel | 401, 403 | application/problem+json |
|