@censys/platform-sdk 0.4.3 → 0.5.1
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 +260 -6
- package/docs/sdks/threathunting/README.md +335 -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/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/funcs/threatHuntingGetHostObservationsWithCertificate.d.ts +18 -0
- package/funcs/threatHuntingGetHostObservationsWithCertificate.d.ts.map +1 -0
- package/funcs/threatHuntingGetHostObservationsWithCertificate.js +141 -0
- package/funcs/threatHuntingGetHostObservationsWithCertificate.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/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/v3threathuntinggethostobservationswithcertificate.d.ts +124 -0
- package/models/operations/v3threathuntinggethostobservationswithcertificate.d.ts.map +1 -0
- package/models/operations/v3threathuntinggethostobservationswithcertificate.js +183 -0
- package/models/operations/v3threathuntinggethostobservationswithcertificate.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 +23 -0
- package/sdk/globaldata.d.ts.map +1 -1
- package/sdk/globaldata.js +32 -0
- package/sdk/globaldata.js.map +1 -1
- package/sdk/threathunting.d.ts +30 -0
- package/sdk/threathunting.d.ts.map +1 -1
- package/sdk/threathunting.js +42 -0
- package/sdk/threathunting.js.map +1 -1
- package/src/funcs/globalDataCreateTrackedScan.ts +185 -0
- package/src/funcs/globalDataGetTrackedScan.ts +191 -0
- package/src/funcs/globalDataGetTrackedScanThreatHunting.ts +191 -0
- package/src/funcs/threatHuntingCreateTrackedScan.ts +188 -0
- package/src/funcs/threatHuntingGetHostObservationsWithCertificate.ts +201 -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/v3globaldatascansget.ts +232 -0
- package/src/models/operations/v3globaldatascansrescan.ts +229 -0
- package/src/models/operations/v3threathuntinggethostobservationswithcertificate.ts +315 -0
- package/src/models/operations/v3threathuntingscansdiscovery.ts +238 -0
- package/src/models/operations/v3threathuntingscansget.ts +232 -0
- package/src/sdk/globaldata.ts +56 -0
- package/src/sdk/threathunting.ts +77 -0
package/sdk/threathunting.js
CHANGED
|
@@ -4,10 +4,52 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ThreatHunting = void 0;
|
|
7
|
+
const globalDataGetTrackedScan_js_1 = require("../funcs/globalDataGetTrackedScan.js");
|
|
8
|
+
const globalDataGetTrackedScanThreatHunting_js_1 = require("../funcs/globalDataGetTrackedScanThreatHunting.js");
|
|
9
|
+
const threatHuntingCreateTrackedScan_js_1 = require("../funcs/threatHuntingCreateTrackedScan.js");
|
|
10
|
+
const threatHuntingGetHostObservationsWithCertificate_js_1 = require("../funcs/threatHuntingGetHostObservationsWithCertificate.js");
|
|
7
11
|
const threatHuntingValueCounts_js_1 = require("../funcs/threatHuntingValueCounts.js");
|
|
8
12
|
const sdks_js_1 = require("../lib/sdks.js");
|
|
9
13
|
const fp_js_1 = require("../types/fp.js");
|
|
10
14
|
class ThreatHunting extends sdks_js_1.ClientSDK {
|
|
15
|
+
/**
|
|
16
|
+
* Get tracked scan details
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Retrieve the current status and results of a tracked scan by its ID.
|
|
20
|
+
* This endpoint works for both discovery scans and rescans.
|
|
21
|
+
*/
|
|
22
|
+
async getTrackedScan(request, options) {
|
|
23
|
+
return (0, fp_js_1.unwrapAsync)((0, globalDataGetTrackedScan_js_1.globalDataGetTrackedScan)(this, request, options));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get Host Observations With Certificate
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Retrieve historical observations of hosts associated with a certificate fingerprint. Useful for threat hunting, detection engineering, and timeline generation.
|
|
30
|
+
*/
|
|
31
|
+
async getHostObservationsWithCertificate(request, options) {
|
|
32
|
+
return (0, fp_js_1.unwrapAsync)((0, threatHuntingGetHostObservationsWithCertificate_js_1.threatHuntingGetHostObservationsWithCertificate)(this, request, options));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a tracked discovery scan
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* Create a new tracked discovery scan for a specified target. Discovery scans are used to scan new targets that have not been previously identified. 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 organizations that have access to the Threat Hunting module.
|
|
39
|
+
*/
|
|
40
|
+
async createTrackedScan(request, options) {
|
|
41
|
+
return (0, fp_js_1.unwrapAsync)((0, threatHuntingCreateTrackedScan_js_1.threatHuntingCreateTrackedScan)(this, request, options));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get tracked scan details
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* Retrieve the current status and results of a tracked scan by its ID.
|
|
48
|
+
* This endpoint works for both discovery scans and rescans.
|
|
49
|
+
*/
|
|
50
|
+
async getTrackedScanThreatHunting(request, options) {
|
|
51
|
+
return (0, fp_js_1.unwrapAsync)((0, globalDataGetTrackedScanThreatHunting_js_1.globalDataGetTrackedScanThreatHunting)(this, request, options));
|
|
52
|
+
}
|
|
11
53
|
/**
|
|
12
54
|
* CensEye: Retrieve value counts to discover pivots
|
|
13
55
|
*
|
package/sdk/threathunting.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threathunting.js","sourceRoot":"","sources":["../src/sdk/threathunting.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sFAAgF;AAChF,4CAA2D;AAE3D,0CAA6C;AAE7C,MAAa,aAAc,SAAQ,mBAAS;IAC1C;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CACf,OAAqD,EACrD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sDAAwB,EACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"threathunting.js","sourceRoot":"","sources":["../src/sdk/threathunting.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sFAAgF;AAChF,gHAA0G;AAC1G,kGAA4F;AAC5F,oIAA8H;AAC9H,sFAAgF;AAChF,4CAA2D;AAE3D,0CAA6C;AAE7C,MAAa,aAAc,SAAQ,mBAAS;IAC1C;;;;;;OAMG;IACH,KAAK,CAAC,cAAc,CAClB,OAA+C,EAC/C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sDAAwB,EACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kCAAkC,CACtC,OACqE,EACrE,OAAwB;QAIxB,OAAO,IAAA,mBAAW,EAAC,IAAA,oGAA+C,EAChE,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CACrB,OAAwD,EACxD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,kEAA8B,EAC/C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,2BAA2B,CAC/B,OAAkD,EAClD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,gFAAqC,EACtD,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CACf,OAAqD,EACrD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sDAAwB,EACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AA1FD,sCA0FC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKBaseError } from "../models/errors/sdkbaseerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create a tracked rescan
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* 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.
|
|
33
|
+
*/
|
|
34
|
+
export function globalDataCreateTrackedScan(
|
|
35
|
+
client: SDKCore,
|
|
36
|
+
request: operations.V3GlobaldataScansRescanRequest,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
operations.V3GlobaldataScansRescanResponse,
|
|
41
|
+
| errors.ErrorModel
|
|
42
|
+
| SDKBaseError
|
|
43
|
+
| ResponseValidationError
|
|
44
|
+
| ConnectionError
|
|
45
|
+
| RequestAbortedError
|
|
46
|
+
| RequestTimeoutError
|
|
47
|
+
| InvalidRequestError
|
|
48
|
+
| UnexpectedClientError
|
|
49
|
+
| SDKValidationError
|
|
50
|
+
>
|
|
51
|
+
> {
|
|
52
|
+
return new APIPromise($do(
|
|
53
|
+
client,
|
|
54
|
+
request,
|
|
55
|
+
options,
|
|
56
|
+
));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function $do(
|
|
60
|
+
client: SDKCore,
|
|
61
|
+
request: operations.V3GlobaldataScansRescanRequest,
|
|
62
|
+
options?: RequestOptions,
|
|
63
|
+
): Promise<
|
|
64
|
+
[
|
|
65
|
+
Result<
|
|
66
|
+
operations.V3GlobaldataScansRescanResponse,
|
|
67
|
+
| errors.ErrorModel
|
|
68
|
+
| SDKBaseError
|
|
69
|
+
| ResponseValidationError
|
|
70
|
+
| ConnectionError
|
|
71
|
+
| RequestAbortedError
|
|
72
|
+
| RequestTimeoutError
|
|
73
|
+
| InvalidRequestError
|
|
74
|
+
| UnexpectedClientError
|
|
75
|
+
| SDKValidationError
|
|
76
|
+
>,
|
|
77
|
+
APICall,
|
|
78
|
+
]
|
|
79
|
+
> {
|
|
80
|
+
const parsed = safeParse(
|
|
81
|
+
request,
|
|
82
|
+
(value) =>
|
|
83
|
+
operations.V3GlobaldataScansRescanRequest$outboundSchema.parse(value),
|
|
84
|
+
"Input validation failed",
|
|
85
|
+
);
|
|
86
|
+
if (!parsed.ok) {
|
|
87
|
+
return [parsed, { status: "invalid" }];
|
|
88
|
+
}
|
|
89
|
+
const payload = parsed.value;
|
|
90
|
+
const body = encodeJSON("body", payload.ScansRescanInputBody, {
|
|
91
|
+
explode: true,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const path = pathToFunc("/v3/global/scans/rescan")();
|
|
95
|
+
|
|
96
|
+
const query = encodeFormQuery({
|
|
97
|
+
"organization_id": payload.organization_id
|
|
98
|
+
?? client._options.organizationId,
|
|
99
|
+
}, { explode: false });
|
|
100
|
+
|
|
101
|
+
const headers = new Headers(compactMap({
|
|
102
|
+
"Content-Type": "application/json",
|
|
103
|
+
Accept: "application/json",
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
const secConfig = await extractSecurity(client._options.personalAccessToken);
|
|
107
|
+
const securityInput = secConfig == null
|
|
108
|
+
? {}
|
|
109
|
+
: { personalAccessToken: secConfig };
|
|
110
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
111
|
+
|
|
112
|
+
const context = {
|
|
113
|
+
options: client._options,
|
|
114
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
115
|
+
operationID: "v3-globaldata-scans-rescan",
|
|
116
|
+
oAuth2Scopes: [],
|
|
117
|
+
|
|
118
|
+
resolvedSecurity: requestSecurity,
|
|
119
|
+
|
|
120
|
+
securitySource: client._options.personalAccessToken,
|
|
121
|
+
retryConfig: options?.retries
|
|
122
|
+
|| client._options.retryConfig
|
|
123
|
+
|| { strategy: "none" },
|
|
124
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const requestRes = client._createRequest(context, {
|
|
128
|
+
security: requestSecurity,
|
|
129
|
+
method: "POST",
|
|
130
|
+
baseURL: options?.serverURL,
|
|
131
|
+
path: path,
|
|
132
|
+
headers: headers,
|
|
133
|
+
query: query,
|
|
134
|
+
body: body,
|
|
135
|
+
userAgent: client._options.userAgent,
|
|
136
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
137
|
+
}, options);
|
|
138
|
+
if (!requestRes.ok) {
|
|
139
|
+
return [requestRes, { status: "invalid" }];
|
|
140
|
+
}
|
|
141
|
+
const req = requestRes.value;
|
|
142
|
+
|
|
143
|
+
const doResult = await client._do(req, {
|
|
144
|
+
context,
|
|
145
|
+
errorCodes: ["401", "403", "4XX", "5XX"],
|
|
146
|
+
retryConfig: context.retryConfig,
|
|
147
|
+
retryCodes: context.retryCodes,
|
|
148
|
+
});
|
|
149
|
+
if (!doResult.ok) {
|
|
150
|
+
return [doResult, { status: "request-error", request: req }];
|
|
151
|
+
}
|
|
152
|
+
const response = doResult.value;
|
|
153
|
+
|
|
154
|
+
const responseFields = {
|
|
155
|
+
HttpMeta: { Response: response, Request: req },
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const [result] = await M.match<
|
|
159
|
+
operations.V3GlobaldataScansRescanResponse,
|
|
160
|
+
| errors.ErrorModel
|
|
161
|
+
| SDKBaseError
|
|
162
|
+
| ResponseValidationError
|
|
163
|
+
| ConnectionError
|
|
164
|
+
| RequestAbortedError
|
|
165
|
+
| RequestTimeoutError
|
|
166
|
+
| InvalidRequestError
|
|
167
|
+
| UnexpectedClientError
|
|
168
|
+
| SDKValidationError
|
|
169
|
+
>(
|
|
170
|
+
M.json(200, operations.V3GlobaldataScansRescanResponse$inboundSchema, {
|
|
171
|
+
hdrs: true,
|
|
172
|
+
key: "Result",
|
|
173
|
+
}),
|
|
174
|
+
M.jsonErr([401, 403], errors.ErrorModel$inboundSchema, {
|
|
175
|
+
ctype: "application/problem+json",
|
|
176
|
+
}),
|
|
177
|
+
M.fail("4XX"),
|
|
178
|
+
M.fail("5XX"),
|
|
179
|
+
)(response, req, { extraFields: responseFields });
|
|
180
|
+
if (!result.ok) {
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return [result, { status: "complete", request: req, response }];
|
|
185
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKBaseError } from "../models/errors/sdkbaseerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get tracked scan details
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Retrieve the current status and results of a tracked scan by its ID.
|
|
33
|
+
* This endpoint works for both discovery scans and rescans.
|
|
34
|
+
*/
|
|
35
|
+
export function globalDataGetTrackedScan(
|
|
36
|
+
client: SDKCore,
|
|
37
|
+
request: operations.V3GlobaldataScansGetRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
operations.V3GlobaldataScansGetResponse,
|
|
42
|
+
| errors.ErrorModel
|
|
43
|
+
| SDKBaseError
|
|
44
|
+
| ResponseValidationError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| InvalidRequestError
|
|
49
|
+
| UnexpectedClientError
|
|
50
|
+
| SDKValidationError
|
|
51
|
+
>
|
|
52
|
+
> {
|
|
53
|
+
return new APIPromise($do(
|
|
54
|
+
client,
|
|
55
|
+
request,
|
|
56
|
+
options,
|
|
57
|
+
));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function $do(
|
|
61
|
+
client: SDKCore,
|
|
62
|
+
request: operations.V3GlobaldataScansGetRequest,
|
|
63
|
+
options?: RequestOptions,
|
|
64
|
+
): Promise<
|
|
65
|
+
[
|
|
66
|
+
Result<
|
|
67
|
+
operations.V3GlobaldataScansGetResponse,
|
|
68
|
+
| errors.ErrorModel
|
|
69
|
+
| SDKBaseError
|
|
70
|
+
| ResponseValidationError
|
|
71
|
+
| ConnectionError
|
|
72
|
+
| RequestAbortedError
|
|
73
|
+
| RequestTimeoutError
|
|
74
|
+
| InvalidRequestError
|
|
75
|
+
| UnexpectedClientError
|
|
76
|
+
| SDKValidationError
|
|
77
|
+
>,
|
|
78
|
+
APICall,
|
|
79
|
+
]
|
|
80
|
+
> {
|
|
81
|
+
const parsed = safeParse(
|
|
82
|
+
request,
|
|
83
|
+
(value) =>
|
|
84
|
+
operations.V3GlobaldataScansGetRequest$outboundSchema.parse(value),
|
|
85
|
+
"Input validation failed",
|
|
86
|
+
);
|
|
87
|
+
if (!parsed.ok) {
|
|
88
|
+
return [parsed, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const payload = parsed.value;
|
|
91
|
+
const body = null;
|
|
92
|
+
|
|
93
|
+
const pathParams = {
|
|
94
|
+
scan_id: encodeSimple("scan_id", payload.scan_id, {
|
|
95
|
+
explode: false,
|
|
96
|
+
charEncoding: "percent",
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const path = pathToFunc("/v3/global/scans/{scan_id}")(pathParams);
|
|
101
|
+
|
|
102
|
+
const query = encodeFormQuery({
|
|
103
|
+
"organization_id": payload.organization_id
|
|
104
|
+
?? client._options.organizationId,
|
|
105
|
+
}, { explode: false });
|
|
106
|
+
|
|
107
|
+
const headers = new Headers(compactMap({
|
|
108
|
+
Accept: "application/vnd.censys.api.v3.trackedscan.v1+json",
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
const secConfig = await extractSecurity(client._options.personalAccessToken);
|
|
112
|
+
const securityInput = secConfig == null
|
|
113
|
+
? {}
|
|
114
|
+
: { personalAccessToken: secConfig };
|
|
115
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
116
|
+
|
|
117
|
+
const context = {
|
|
118
|
+
options: client._options,
|
|
119
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
120
|
+
operationID: "v3-globaldata-scans-get",
|
|
121
|
+
oAuth2Scopes: [],
|
|
122
|
+
|
|
123
|
+
resolvedSecurity: requestSecurity,
|
|
124
|
+
|
|
125
|
+
securitySource: client._options.personalAccessToken,
|
|
126
|
+
retryConfig: options?.retries
|
|
127
|
+
|| client._options.retryConfig
|
|
128
|
+
|| { strategy: "none" },
|
|
129
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const requestRes = client._createRequest(context, {
|
|
133
|
+
security: requestSecurity,
|
|
134
|
+
method: "GET",
|
|
135
|
+
baseURL: options?.serverURL,
|
|
136
|
+
path: path,
|
|
137
|
+
headers: headers,
|
|
138
|
+
query: query,
|
|
139
|
+
body: body,
|
|
140
|
+
userAgent: client._options.userAgent,
|
|
141
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
142
|
+
}, options);
|
|
143
|
+
if (!requestRes.ok) {
|
|
144
|
+
return [requestRes, { status: "invalid" }];
|
|
145
|
+
}
|
|
146
|
+
const req = requestRes.value;
|
|
147
|
+
|
|
148
|
+
const doResult = await client._do(req, {
|
|
149
|
+
context,
|
|
150
|
+
errorCodes: ["401", "403", "4XX", "5XX"],
|
|
151
|
+
retryConfig: context.retryConfig,
|
|
152
|
+
retryCodes: context.retryCodes,
|
|
153
|
+
});
|
|
154
|
+
if (!doResult.ok) {
|
|
155
|
+
return [doResult, { status: "request-error", request: req }];
|
|
156
|
+
}
|
|
157
|
+
const response = doResult.value;
|
|
158
|
+
|
|
159
|
+
const responseFields = {
|
|
160
|
+
HttpMeta: { Response: response, Request: req },
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const [result] = await M.match<
|
|
164
|
+
operations.V3GlobaldataScansGetResponse,
|
|
165
|
+
| errors.ErrorModel
|
|
166
|
+
| SDKBaseError
|
|
167
|
+
| ResponseValidationError
|
|
168
|
+
| ConnectionError
|
|
169
|
+
| RequestAbortedError
|
|
170
|
+
| RequestTimeoutError
|
|
171
|
+
| InvalidRequestError
|
|
172
|
+
| UnexpectedClientError
|
|
173
|
+
| SDKValidationError
|
|
174
|
+
>(
|
|
175
|
+
M.json(200, operations.V3GlobaldataScansGetResponse$inboundSchema, {
|
|
176
|
+
ctype: "application/vnd.censys.api.v3.trackedscan.v1+json",
|
|
177
|
+
hdrs: true,
|
|
178
|
+
key: "Result",
|
|
179
|
+
}),
|
|
180
|
+
M.jsonErr([401, 403], errors.ErrorModel$inboundSchema, {
|
|
181
|
+
ctype: "application/problem+json",
|
|
182
|
+
}),
|
|
183
|
+
M.fail("4XX"),
|
|
184
|
+
M.fail("5XX"),
|
|
185
|
+
)(response, req, { extraFields: responseFields });
|
|
186
|
+
if (!result.ok) {
|
|
187
|
+
return [result, { status: "complete", request: req, response }];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return [result, { status: "complete", request: req, response }];
|
|
191
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKBaseError } from "../models/errors/sdkbaseerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get tracked scan details
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Retrieve the current status and results of a tracked scan by its ID.
|
|
33
|
+
* This endpoint works for both discovery scans and rescans.
|
|
34
|
+
*/
|
|
35
|
+
export function globalDataGetTrackedScanThreatHunting(
|
|
36
|
+
client: SDKCore,
|
|
37
|
+
request: operations.V3ThreathuntingScansGetRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
operations.V3ThreathuntingScansGetResponse,
|
|
42
|
+
| errors.ErrorModel
|
|
43
|
+
| SDKBaseError
|
|
44
|
+
| ResponseValidationError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| InvalidRequestError
|
|
49
|
+
| UnexpectedClientError
|
|
50
|
+
| SDKValidationError
|
|
51
|
+
>
|
|
52
|
+
> {
|
|
53
|
+
return new APIPromise($do(
|
|
54
|
+
client,
|
|
55
|
+
request,
|
|
56
|
+
options,
|
|
57
|
+
));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function $do(
|
|
61
|
+
client: SDKCore,
|
|
62
|
+
request: operations.V3ThreathuntingScansGetRequest,
|
|
63
|
+
options?: RequestOptions,
|
|
64
|
+
): Promise<
|
|
65
|
+
[
|
|
66
|
+
Result<
|
|
67
|
+
operations.V3ThreathuntingScansGetResponse,
|
|
68
|
+
| errors.ErrorModel
|
|
69
|
+
| SDKBaseError
|
|
70
|
+
| ResponseValidationError
|
|
71
|
+
| ConnectionError
|
|
72
|
+
| RequestAbortedError
|
|
73
|
+
| RequestTimeoutError
|
|
74
|
+
| InvalidRequestError
|
|
75
|
+
| UnexpectedClientError
|
|
76
|
+
| SDKValidationError
|
|
77
|
+
>,
|
|
78
|
+
APICall,
|
|
79
|
+
]
|
|
80
|
+
> {
|
|
81
|
+
const parsed = safeParse(
|
|
82
|
+
request,
|
|
83
|
+
(value) =>
|
|
84
|
+
operations.V3ThreathuntingScansGetRequest$outboundSchema.parse(value),
|
|
85
|
+
"Input validation failed",
|
|
86
|
+
);
|
|
87
|
+
if (!parsed.ok) {
|
|
88
|
+
return [parsed, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const payload = parsed.value;
|
|
91
|
+
const body = null;
|
|
92
|
+
|
|
93
|
+
const pathParams = {
|
|
94
|
+
scan_id: encodeSimple("scan_id", payload.scan_id, {
|
|
95
|
+
explode: false,
|
|
96
|
+
charEncoding: "percent",
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const path = pathToFunc("/v3/threat-hunting/scans/{scan_id}")(pathParams);
|
|
101
|
+
|
|
102
|
+
const query = encodeFormQuery({
|
|
103
|
+
"organization_id": payload.organization_id
|
|
104
|
+
?? client._options.organizationId,
|
|
105
|
+
}, { explode: false });
|
|
106
|
+
|
|
107
|
+
const headers = new Headers(compactMap({
|
|
108
|
+
Accept: "application/vnd.censys.api.v3.trackedscan.v1+json",
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
const secConfig = await extractSecurity(client._options.personalAccessToken);
|
|
112
|
+
const securityInput = secConfig == null
|
|
113
|
+
? {}
|
|
114
|
+
: { personalAccessToken: secConfig };
|
|
115
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
116
|
+
|
|
117
|
+
const context = {
|
|
118
|
+
options: client._options,
|
|
119
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
120
|
+
operationID: "v3-threathunting-scans-get",
|
|
121
|
+
oAuth2Scopes: [],
|
|
122
|
+
|
|
123
|
+
resolvedSecurity: requestSecurity,
|
|
124
|
+
|
|
125
|
+
securitySource: client._options.personalAccessToken,
|
|
126
|
+
retryConfig: options?.retries
|
|
127
|
+
|| client._options.retryConfig
|
|
128
|
+
|| { strategy: "none" },
|
|
129
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const requestRes = client._createRequest(context, {
|
|
133
|
+
security: requestSecurity,
|
|
134
|
+
method: "GET",
|
|
135
|
+
baseURL: options?.serverURL,
|
|
136
|
+
path: path,
|
|
137
|
+
headers: headers,
|
|
138
|
+
query: query,
|
|
139
|
+
body: body,
|
|
140
|
+
userAgent: client._options.userAgent,
|
|
141
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
142
|
+
}, options);
|
|
143
|
+
if (!requestRes.ok) {
|
|
144
|
+
return [requestRes, { status: "invalid" }];
|
|
145
|
+
}
|
|
146
|
+
const req = requestRes.value;
|
|
147
|
+
|
|
148
|
+
const doResult = await client._do(req, {
|
|
149
|
+
context,
|
|
150
|
+
errorCodes: ["401", "403", "4XX", "5XX"],
|
|
151
|
+
retryConfig: context.retryConfig,
|
|
152
|
+
retryCodes: context.retryCodes,
|
|
153
|
+
});
|
|
154
|
+
if (!doResult.ok) {
|
|
155
|
+
return [doResult, { status: "request-error", request: req }];
|
|
156
|
+
}
|
|
157
|
+
const response = doResult.value;
|
|
158
|
+
|
|
159
|
+
const responseFields = {
|
|
160
|
+
HttpMeta: { Response: response, Request: req },
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const [result] = await M.match<
|
|
164
|
+
operations.V3ThreathuntingScansGetResponse,
|
|
165
|
+
| errors.ErrorModel
|
|
166
|
+
| SDKBaseError
|
|
167
|
+
| ResponseValidationError
|
|
168
|
+
| ConnectionError
|
|
169
|
+
| RequestAbortedError
|
|
170
|
+
| RequestTimeoutError
|
|
171
|
+
| InvalidRequestError
|
|
172
|
+
| UnexpectedClientError
|
|
173
|
+
| SDKValidationError
|
|
174
|
+
>(
|
|
175
|
+
M.json(200, operations.V3ThreathuntingScansGetResponse$inboundSchema, {
|
|
176
|
+
ctype: "application/vnd.censys.api.v3.trackedscan.v1+json",
|
|
177
|
+
hdrs: true,
|
|
178
|
+
key: "Result",
|
|
179
|
+
}),
|
|
180
|
+
M.jsonErr([401, 403], errors.ErrorModel$inboundSchema, {
|
|
181
|
+
ctype: "application/problem+json",
|
|
182
|
+
}),
|
|
183
|
+
M.fail("4XX"),
|
|
184
|
+
M.fail("5XX"),
|
|
185
|
+
)(response, req, { extraFields: responseFields });
|
|
186
|
+
if (!result.ok) {
|
|
187
|
+
return [result, { status: "complete", request: req, response }];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return [result, { status: "complete", request: req, response }];
|
|
191
|
+
}
|