@censys/platform-sdk 0.8.0 → 0.9.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/README.md +10 -6
- package/docs/sdks/accountmanagement/README.md +72 -2
- package/docs/sdks/collections/README.md +0 -1
- package/docs/sdks/globaldata/README.md +0 -1
- package/docs/sdks/threathunting/README.md +78 -1
- package/examples/package-lock.json +1 -1
- package/funcs/accountManagementGetOrganizationCredits.d.ts +1 -1
- package/funcs/accountManagementGetOrganizationCredits.js +1 -1
- package/funcs/accountManagementGetUserCredits.d.ts +18 -0
- package/funcs/accountManagementGetUserCredits.d.ts.map +1 -0
- package/funcs/accountManagementGetUserCredits.js +112 -0
- package/funcs/accountManagementGetUserCredits.js.map +1 -0
- package/funcs/threatHuntingListThreats.d.ts +18 -0
- package/funcs/threatHuntingListThreats.d.ts.map +1 -0
- package/funcs/threatHuntingListThreats.js +130 -0
- package/funcs/threatHuntingListThreats.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +4 -4
- package/lib/config.js +4 -4
- package/lib/encodings.d.ts +1 -0
- package/lib/encodings.d.ts.map +1 -1
- package/lib/encodings.js +12 -1
- package/lib/encodings.js.map +1 -1
- package/models/components/cobaltstrikeconfig.d.ts +1 -0
- package/models/components/cobaltstrikeconfig.d.ts.map +1 -1
- package/models/components/cobaltstrikeconfig.js +2 -0
- package/models/components/cobaltstrikeconfig.js.map +1 -1
- package/models/components/index.d.ts +6 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +6 -0
- package/models/components/index.js.map +1 -1
- package/models/components/responseenvelopethreatslistresponse.d.ts +11 -0
- package/models/components/responseenvelopethreatslistresponse.d.ts.map +1 -0
- package/models/components/responseenvelopethreatslistresponse.js +51 -0
- package/models/components/responseenvelopethreatslistresponse.js.map +1 -0
- package/models/components/responseenvelopeusercredits.d.ts +11 -0
- package/models/components/responseenvelopeusercredits.d.ts.map +1 -0
- package/models/components/responseenvelopeusercredits.js +51 -0
- package/models/components/responseenvelopeusercredits.js.map +1 -0
- package/models/components/threatlistitem.d.ts +42 -0
- package/models/components/threatlistitem.d.ts.map +1 -0
- package/models/components/threatlistitem.js +66 -0
- package/models/components/threatlistitem.js.map +1 -0
- package/models/components/threatreference.d.ts +13 -0
- package/models/components/threatreference.d.ts.map +1 -0
- package/models/components/threatreference.js +50 -0
- package/models/components/threatreference.js.map +1 -0
- package/models/components/threatslistresponse.d.ts +14 -0
- package/models/components/threatslistresponse.d.ts.map +1 -0
- package/models/components/threatslistresponse.js +51 -0
- package/models/components/threatslistresponse.js.map +1 -0
- package/models/components/usercredits.d.ts +17 -0
- package/models/components/usercredits.d.ts.map +1 -0
- package/models/components/usercredits.js +57 -0
- package/models/components/usercredits.js.map +1 -0
- package/models/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +2 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/v3accountmanagementusercredits.d.ts +14 -0
- package/models/operations/v3accountmanagementusercredits.d.ts.map +1 -0
- package/models/operations/v3accountmanagementusercredits.js +58 -0
- package/models/operations/v3accountmanagementusercredits.js.map +1 -0
- package/models/operations/v3globaldatasearchaggregate.d.ts +1 -1
- package/models/operations/v3globaldatasearchquery.d.ts +1 -1
- package/models/operations/v3threathuntingthreatslist.d.ts +35 -0
- package/models/operations/v3threathuntingthreatslist.d.ts.map +1 -0
- package/models/operations/v3threathuntingthreatslist.js +71 -0
- package/models/operations/v3threathuntingthreatslist.js.map +1 -0
- package/package.json +1 -1
- package/sdk/accountmanagement.d.ts +8 -1
- package/sdk/accountmanagement.d.ts.map +1 -1
- package/sdk/accountmanagement.js +11 -1
- package/sdk/accountmanagement.js.map +1 -1
- package/sdk/threathunting.d.ts +7 -0
- package/sdk/threathunting.d.ts.map +1 -1
- package/sdk/threathunting.js +10 -0
- package/sdk/threathunting.js.map +1 -1
- package/src/funcs/accountManagementGetOrganizationCredits.ts +1 -1
- package/src/funcs/accountManagementGetUserCredits.ts +163 -0
- package/src/funcs/threatHuntingListThreats.ts +187 -0
- package/src/lib/config.ts +4 -4
- package/src/lib/encodings.ts +17 -3
- package/src/models/components/cobaltstrikeconfig.ts +3 -0
- package/src/models/components/index.ts +6 -0
- package/src/models/components/responseenvelopethreatslistresponse.ts +36 -0
- package/src/models/components/responseenvelopeusercredits.ts +32 -0
- package/src/models/components/threatlistitem.ts +81 -0
- package/src/models/components/threatreference.ts +34 -0
- package/src/models/components/threatslistresponse.ts +38 -0
- package/src/models/components/usercredits.ts +45 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/v3accountmanagementusercredits.ts +41 -0
- package/src/models/operations/v3globaldatasearchaggregate.ts +1 -1
- package/src/models/operations/v3globaldatasearchquery.ts +1 -1
- package/src/models/operations/v3threathuntingthreatslist.ts +86 -0
- package/src/sdk/accountmanagement.ts +17 -1
- package/src/sdk/threathunting.ts +18 -0
- package/src/types/enums.ts +38 -9
- package/src/types/index.ts +2 -2
- package/src/types/unrecognized.ts +35 -0
- package/tsconfig.json +1 -2
- package/types/enums.d.ts +8 -11
- package/types/enums.d.ts.map +1 -1
- package/types/enums.js +59 -3
- package/types/enums.js.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/index.d.ts.map +1 -1
- package/types/index.js +16 -3
- package/types/index.js.map +1 -1
- package/types/unrecognized.d.ts +16 -0
- package/types/unrecognized.d.ts.map +1 -0
- package/types/unrecognized.js +34 -0
- package/types/unrecognized.js.map +1 -0
package/sdk/threathunting.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.ThreatHunting = void 0;
|
|
|
7
7
|
const threatHuntingCreateTrackedScan_js_1 = require("../funcs/threatHuntingCreateTrackedScan.js");
|
|
8
8
|
const threatHuntingGetHostObservationsWithCertificate_js_1 = require("../funcs/threatHuntingGetHostObservationsWithCertificate.js");
|
|
9
9
|
const threatHuntingGetTrackedScanThreatHunting_js_1 = require("../funcs/threatHuntingGetTrackedScanThreatHunting.js");
|
|
10
|
+
const threatHuntingListThreats_js_1 = require("../funcs/threatHuntingListThreats.js");
|
|
10
11
|
const threatHuntingValueCounts_js_1 = require("../funcs/threatHuntingValueCounts.js");
|
|
11
12
|
const sdks_js_1 = require("../lib/sdks.js");
|
|
12
13
|
const fp_js_1 = require("../types/fp.js");
|
|
@@ -38,6 +39,15 @@ class ThreatHunting extends sdks_js_1.ClientSDK {
|
|
|
38
39
|
async getTrackedScanThreatHunting(request, options) {
|
|
39
40
|
return (0, fp_js_1.unwrapAsync)((0, threatHuntingGetTrackedScanThreatHunting_js_1.threatHuntingGetTrackedScanThreatHunting)(this, request, options));
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* List active threats
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Retrieve a list of active threats observed by Censys by aggregating threat IDs across hosts and web properties. Threats are active if their fingerprint has been identified on hosts or web properties by Censys scans. This information is also available on the [Explore Threats page in the Platform web UI](https://platform.censys.io/threats).
|
|
47
|
+
*/
|
|
48
|
+
async listThreats(request, options) {
|
|
49
|
+
return (0, fp_js_1.unwrapAsync)((0, threatHuntingListThreats_js_1.threatHuntingListThreats)(this, request, options));
|
|
50
|
+
}
|
|
41
51
|
/**
|
|
42
52
|
* CensEye: Retrieve value counts to discover pivots
|
|
43
53
|
*
|
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,kGAA4F;AAC5F,oIAA8H;AAC9H,sHAAgH;AAChH,sFAAgF;AAChF,4CAA2D;AAE3D,0CAA6C;AAE7C,MAAa,aAAc,SAAQ,mBAAS;IAC1C;;;;;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;;;;;OAKG;IACH,KAAK,CAAC,2BAA2B,CAC/B,OAAkD,EAClD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sFAAwC,EACzD,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;
|
|
1
|
+
{"version":3,"file":"threathunting.js","sourceRoot":"","sources":["../src/sdk/threathunting.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,kGAA4F;AAC5F,oIAA8H;AAC9H,sHAAgH;AAChH,sFAAgF;AAChF,sFAAgF;AAChF,4CAA2D;AAE3D,0CAA6C;AAE7C,MAAa,aAAc,SAAQ,mBAAS;IAC1C;;;;;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;;;;;OAKG;IACH,KAAK,CAAC,2BAA2B,CAC/B,OAAkD,EAClD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sFAAwC,EACzD,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;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;AAxFD,sCAwFC"}
|
|
@@ -26,7 +26,7 @@ import { APICall, APIPromise } from "../types/async.js";
|
|
|
26
26
|
import { Result } from "../types/fp.js";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Get organization credit
|
|
29
|
+
* Get organization credit details
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
32
|
* Retrieve credit balance and expiration information for an organization. <br><br>Credits expire 12 months after they are acquired.<br><br>This endpoint does not cost any credits to execute.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import * as M from "../lib/matchers.js";
|
|
7
|
+
import { compactMap } from "../lib/primitives.js";
|
|
8
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
9
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
10
|
+
import { pathToFunc } from "../lib/url.js";
|
|
11
|
+
import {
|
|
12
|
+
ConnectionError,
|
|
13
|
+
InvalidRequestError,
|
|
14
|
+
RequestAbortedError,
|
|
15
|
+
RequestTimeoutError,
|
|
16
|
+
UnexpectedClientError,
|
|
17
|
+
} from "../models/errors/httpclienterrors.js";
|
|
18
|
+
import * as errors from "../models/errors/index.js";
|
|
19
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
20
|
+
import { SDKBaseError } from "../models/errors/sdkbaseerror.js";
|
|
21
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
22
|
+
import * as operations from "../models/operations/index.js";
|
|
23
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get Free user credit details
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Retrieve your Free user account credit balance and refresh information. To retrieve the credit balance for a Starter or Enterprise account, use the [get organization credit details endpoint](https://docs.censys.com/reference/v3-accountmanagement-org-credits).<br><br>This endpoint does not cost any credits to execute.
|
|
31
|
+
*/
|
|
32
|
+
export function accountManagementGetUserCredits(
|
|
33
|
+
client: SDKCore,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): APIPromise<
|
|
36
|
+
Result<
|
|
37
|
+
operations.V3AccountmanagementUserCreditsResponse,
|
|
38
|
+
| errors.AuthenticationError
|
|
39
|
+
| errors.ErrorModel
|
|
40
|
+
| SDKBaseError
|
|
41
|
+
| ResponseValidationError
|
|
42
|
+
| ConnectionError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| UnexpectedClientError
|
|
47
|
+
| SDKValidationError
|
|
48
|
+
>
|
|
49
|
+
> {
|
|
50
|
+
return new APIPromise($do(
|
|
51
|
+
client,
|
|
52
|
+
options,
|
|
53
|
+
));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function $do(
|
|
57
|
+
client: SDKCore,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<
|
|
60
|
+
[
|
|
61
|
+
Result<
|
|
62
|
+
operations.V3AccountmanagementUserCreditsResponse,
|
|
63
|
+
| errors.AuthenticationError
|
|
64
|
+
| errors.ErrorModel
|
|
65
|
+
| SDKBaseError
|
|
66
|
+
| ResponseValidationError
|
|
67
|
+
| ConnectionError
|
|
68
|
+
| RequestAbortedError
|
|
69
|
+
| RequestTimeoutError
|
|
70
|
+
| InvalidRequestError
|
|
71
|
+
| UnexpectedClientError
|
|
72
|
+
| SDKValidationError
|
|
73
|
+
>,
|
|
74
|
+
APICall,
|
|
75
|
+
]
|
|
76
|
+
> {
|
|
77
|
+
const path = pathToFunc("/v3/accounts/users/credits")();
|
|
78
|
+
|
|
79
|
+
const headers = new Headers(compactMap({
|
|
80
|
+
Accept: "application/json",
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
const secConfig = await extractSecurity(client._options.personalAccessToken);
|
|
84
|
+
const securityInput = secConfig == null
|
|
85
|
+
? {}
|
|
86
|
+
: { personalAccessToken: secConfig };
|
|
87
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
88
|
+
|
|
89
|
+
const context = {
|
|
90
|
+
options: client._options,
|
|
91
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
92
|
+
operationID: "v3-accountmanagement-user-credits",
|
|
93
|
+
oAuth2Scopes: null,
|
|
94
|
+
|
|
95
|
+
resolvedSecurity: requestSecurity,
|
|
96
|
+
|
|
97
|
+
securitySource: client._options.personalAccessToken,
|
|
98
|
+
retryConfig: options?.retries
|
|
99
|
+
|| client._options.retryConfig
|
|
100
|
+
|| { strategy: "none" },
|
|
101
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const requestRes = client._createRequest(context, {
|
|
105
|
+
security: requestSecurity,
|
|
106
|
+
method: "GET",
|
|
107
|
+
baseURL: options?.serverURL,
|
|
108
|
+
path: path,
|
|
109
|
+
headers: headers,
|
|
110
|
+
userAgent: client._options.userAgent,
|
|
111
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
112
|
+
}, options);
|
|
113
|
+
if (!requestRes.ok) {
|
|
114
|
+
return [requestRes, { status: "invalid" }];
|
|
115
|
+
}
|
|
116
|
+
const req = requestRes.value;
|
|
117
|
+
|
|
118
|
+
const doResult = await client._do(req, {
|
|
119
|
+
context,
|
|
120
|
+
errorCodes: ["401", "404", "4XX", "5XX"],
|
|
121
|
+
retryConfig: context.retryConfig,
|
|
122
|
+
retryCodes: context.retryCodes,
|
|
123
|
+
});
|
|
124
|
+
if (!doResult.ok) {
|
|
125
|
+
return [doResult, { status: "request-error", request: req }];
|
|
126
|
+
}
|
|
127
|
+
const response = doResult.value;
|
|
128
|
+
|
|
129
|
+
const responseFields = {
|
|
130
|
+
HttpMeta: { Response: response, Request: req },
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const [result] = await M.match<
|
|
134
|
+
operations.V3AccountmanagementUserCreditsResponse,
|
|
135
|
+
| errors.AuthenticationError
|
|
136
|
+
| errors.ErrorModel
|
|
137
|
+
| SDKBaseError
|
|
138
|
+
| ResponseValidationError
|
|
139
|
+
| ConnectionError
|
|
140
|
+
| RequestAbortedError
|
|
141
|
+
| RequestTimeoutError
|
|
142
|
+
| InvalidRequestError
|
|
143
|
+
| UnexpectedClientError
|
|
144
|
+
| SDKValidationError
|
|
145
|
+
>(
|
|
146
|
+
M.json(
|
|
147
|
+
200,
|
|
148
|
+
operations.V3AccountmanagementUserCreditsResponse$inboundSchema,
|
|
149
|
+
{ hdrs: true, key: "Result" },
|
|
150
|
+
),
|
|
151
|
+
M.jsonErr(401, errors.AuthenticationError$inboundSchema),
|
|
152
|
+
M.jsonErr(404, errors.ErrorModel$inboundSchema, {
|
|
153
|
+
ctype: "application/problem+json",
|
|
154
|
+
}),
|
|
155
|
+
M.fail("4XX"),
|
|
156
|
+
M.fail("5XX"),
|
|
157
|
+
)(response, req, { extraFields: responseFields });
|
|
158
|
+
if (!result.ok) {
|
|
159
|
+
return [result, { status: "complete", request: req, response }];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return [result, { status: "complete", request: req, response }];
|
|
163
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } 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
|
+
* List active threats
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Retrieve a list of active threats observed by Censys by aggregating threat IDs across hosts and web properties. Threats are active if their fingerprint has been identified on hosts or web properties by Censys scans. This information is also available on the [Explore Threats page in the Platform web UI](https://platform.censys.io/threats).
|
|
33
|
+
*/
|
|
34
|
+
export function threatHuntingListThreats(
|
|
35
|
+
client: SDKCore,
|
|
36
|
+
request: operations.V3ThreathuntingThreatsListRequest,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
operations.V3ThreathuntingThreatsListResponse,
|
|
41
|
+
| errors.AuthenticationError
|
|
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.V3ThreathuntingThreatsListRequest,
|
|
63
|
+
options?: RequestOptions,
|
|
64
|
+
): Promise<
|
|
65
|
+
[
|
|
66
|
+
Result<
|
|
67
|
+
operations.V3ThreathuntingThreatsListResponse,
|
|
68
|
+
| errors.AuthenticationError
|
|
69
|
+
| errors.ErrorModel
|
|
70
|
+
| SDKBaseError
|
|
71
|
+
| ResponseValidationError
|
|
72
|
+
| ConnectionError
|
|
73
|
+
| RequestAbortedError
|
|
74
|
+
| RequestTimeoutError
|
|
75
|
+
| InvalidRequestError
|
|
76
|
+
| UnexpectedClientError
|
|
77
|
+
| SDKValidationError
|
|
78
|
+
>,
|
|
79
|
+
APICall,
|
|
80
|
+
]
|
|
81
|
+
> {
|
|
82
|
+
const parsed = safeParse(
|
|
83
|
+
request,
|
|
84
|
+
(value) =>
|
|
85
|
+
operations.V3ThreathuntingThreatsListRequest$outboundSchema.parse(value),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = null;
|
|
93
|
+
|
|
94
|
+
const path = pathToFunc("/v3/threat-hunting/threats")();
|
|
95
|
+
|
|
96
|
+
const query = encodeFormQuery({
|
|
97
|
+
"organization_id": payload.organization_id
|
|
98
|
+
?? client._options.organizationId,
|
|
99
|
+
"query": payload.query,
|
|
100
|
+
}, { explode: false });
|
|
101
|
+
|
|
102
|
+
const headers = new Headers(compactMap({
|
|
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-threathunting-threats-list",
|
|
116
|
+
oAuth2Scopes: null,
|
|
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: "GET",
|
|
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", "422", "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.V3ThreathuntingThreatsListResponse,
|
|
160
|
+
| errors.AuthenticationError
|
|
161
|
+
| errors.ErrorModel
|
|
162
|
+
| SDKBaseError
|
|
163
|
+
| ResponseValidationError
|
|
164
|
+
| ConnectionError
|
|
165
|
+
| RequestAbortedError
|
|
166
|
+
| RequestTimeoutError
|
|
167
|
+
| InvalidRequestError
|
|
168
|
+
| UnexpectedClientError
|
|
169
|
+
| SDKValidationError
|
|
170
|
+
>(
|
|
171
|
+
M.json(200, operations.V3ThreathuntingThreatsListResponse$inboundSchema, {
|
|
172
|
+
hdrs: true,
|
|
173
|
+
key: "Result",
|
|
174
|
+
}),
|
|
175
|
+
M.jsonErr(401, errors.AuthenticationError$inboundSchema),
|
|
176
|
+
M.jsonErr([403, 422], errors.ErrorModel$inboundSchema, {
|
|
177
|
+
ctype: "application/problem+json",
|
|
178
|
+
}),
|
|
179
|
+
M.fail("4XX"),
|
|
180
|
+
M.fail("5XX"),
|
|
181
|
+
)(response, req, { extraFields: responseFields });
|
|
182
|
+
if (!result.ok) {
|
|
183
|
+
return [result, { status: "complete", request: req, response }];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return [result, { status: "complete", request: req, response }];
|
|
187
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -65,9 +65,9 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
|
|
66
66
|
export const SDK_METADATA = {
|
|
67
67
|
language: "typescript",
|
|
68
|
-
openapiDocVersion: "1.0.
|
|
69
|
-
sdkVersion: "0.
|
|
70
|
-
genVersion: "2.
|
|
68
|
+
openapiDocVersion: "1.0.50",
|
|
69
|
+
sdkVersion: "0.9.0",
|
|
70
|
+
genVersion: "2.787.2",
|
|
71
71
|
userAgent:
|
|
72
|
-
"speakeasy-sdk/typescript 0.
|
|
72
|
+
"speakeasy-sdk/typescript 0.9.0 2.787.2 1.0.50 @censys/platform-sdk",
|
|
73
73
|
} as const;
|
package/src/lib/encodings.ts
CHANGED
|
@@ -102,8 +102,9 @@ export function encodeLabel(
|
|
|
102
102
|
});
|
|
103
103
|
encValue = mapped?.join("").slice(1);
|
|
104
104
|
} else {
|
|
105
|
-
const k =
|
|
106
|
-
|
|
105
|
+
const k = options?.explode && isPlainObject(value)
|
|
106
|
+
? `${encodeString(pk)}=`
|
|
107
|
+
: "";
|
|
107
108
|
encValue = `${k}${encodeValue(pv)}`;
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -426,6 +427,7 @@ export function queryJoin(...args: (string | undefined)[]): string {
|
|
|
426
427
|
type QueryEncoderOptions = {
|
|
427
428
|
explode?: boolean;
|
|
428
429
|
charEncoding?: "percent" | "none";
|
|
430
|
+
allowEmptyValue?: string[];
|
|
429
431
|
};
|
|
430
432
|
|
|
431
433
|
type QueryEncoder = (
|
|
@@ -440,7 +442,7 @@ type BulkQueryEncoder = (
|
|
|
440
442
|
) => string;
|
|
441
443
|
|
|
442
444
|
export function queryEncoder(f: QueryEncoder): BulkQueryEncoder {
|
|
443
|
-
const bulkEncode = function
|
|
445
|
+
const bulkEncode = function(
|
|
444
446
|
values: Record<string, unknown>,
|
|
445
447
|
options?: QueryEncoderOptions,
|
|
446
448
|
): string {
|
|
@@ -450,7 +452,19 @@ export function queryEncoder(f: QueryEncoder): BulkQueryEncoder {
|
|
|
450
452
|
charEncoding: options?.charEncoding ?? "percent",
|
|
451
453
|
};
|
|
452
454
|
|
|
455
|
+
const allowEmptySet = new Set(options?.allowEmptyValue ?? []);
|
|
456
|
+
|
|
453
457
|
const encoded = Object.entries(values).map(([key, value]) => {
|
|
458
|
+
if (allowEmptySet.has(key)) {
|
|
459
|
+
if (
|
|
460
|
+
value === undefined
|
|
461
|
+
|| value === null
|
|
462
|
+
|| value === ""
|
|
463
|
+
|| (Array.isArray(value) && value.length === 0)
|
|
464
|
+
) {
|
|
465
|
+
return `${encodeURIComponent(key)}=`;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
454
468
|
return f(key, value, opts);
|
|
455
469
|
});
|
|
456
470
|
return queryJoin(...encoded);
|
|
@@ -20,6 +20,7 @@ export type CobaltStrikeConfig = {
|
|
|
20
20
|
cookieBeacon?: number | undefined;
|
|
21
21
|
cryptoScheme?: number | undefined;
|
|
22
22
|
dns?: boolean | undefined;
|
|
23
|
+
hostHeader?: string | undefined;
|
|
23
24
|
httpGet?: CobaltStrikeHttpConfig | undefined;
|
|
24
25
|
httpPost?: CobaltStrikeHttpConfig | undefined;
|
|
25
26
|
jitter?: number | undefined;
|
|
@@ -43,6 +44,7 @@ export const CobaltStrikeConfig$inboundSchema: z.ZodType<
|
|
|
43
44
|
cookie_beacon: z.number().int().optional(),
|
|
44
45
|
crypto_scheme: z.number().int().optional(),
|
|
45
46
|
dns: z.boolean().optional(),
|
|
47
|
+
host_header: z.string().optional(),
|
|
46
48
|
http_get: CobaltStrikeHttpConfig$inboundSchema.optional(),
|
|
47
49
|
http_post: CobaltStrikeHttpConfig$inboundSchema.optional(),
|
|
48
50
|
jitter: z.number().int().optional(),
|
|
@@ -59,6 +61,7 @@ export const CobaltStrikeConfig$inboundSchema: z.ZodType<
|
|
|
59
61
|
return remap$(v, {
|
|
60
62
|
"cookie_beacon": "cookieBeacon",
|
|
61
63
|
"crypto_scheme": "cryptoScheme",
|
|
64
|
+
"host_header": "hostHeader",
|
|
62
65
|
"http_get": "httpGet",
|
|
63
66
|
"http_post": "httpPost",
|
|
64
67
|
"post_ex": "postEx",
|
|
@@ -383,7 +383,9 @@ export * from "./responseenvelopeorganizationdetails.js";
|
|
|
383
383
|
export * from "./responseenvelopeorganizationmemberslist.js";
|
|
384
384
|
export * from "./responseenvelopesearchaggregateresponse.js";
|
|
385
385
|
export * from "./responseenvelopesearchqueryresponse.js";
|
|
386
|
+
export * from "./responseenvelopethreatslistresponse.js";
|
|
386
387
|
export * from "./responseenvelopetrackedscan.js";
|
|
388
|
+
export * from "./responseenvelopeusercredits.js";
|
|
387
389
|
export * from "./responseenvelopevaluecountsresponse.js";
|
|
388
390
|
export * from "./responseenvelopewebpropertyasset.js";
|
|
389
391
|
export * from "./reversednsresolved.js";
|
|
@@ -476,7 +478,10 @@ export * from "./textmessage.js";
|
|
|
476
478
|
export * from "./threat.js";
|
|
477
479
|
export * from "./threatactor.js";
|
|
478
480
|
export * from "./threatdetails.js";
|
|
481
|
+
export * from "./threatlistitem.js";
|
|
479
482
|
export * from "./threatmalware.js";
|
|
483
|
+
export * from "./threatreference.js";
|
|
484
|
+
export * from "./threatslistresponse.js";
|
|
480
485
|
export * from "./tibia.js";
|
|
481
486
|
export * from "./tls.js";
|
|
482
487
|
export * from "./tlschain.js";
|
|
@@ -496,6 +501,7 @@ export * from "./upnpdevice.js";
|
|
|
496
501
|
export * from "./upnpservice.js";
|
|
497
502
|
export * from "./upnpspecversion.js";
|
|
498
503
|
export * from "./user.js";
|
|
504
|
+
export * from "./usercredits.js";
|
|
499
505
|
export * from "./usernotice.js";
|
|
500
506
|
export * from "./validation.js";
|
|
501
507
|
export * from "./validityperiod.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
ThreatsListResponse,
|
|
11
|
+
ThreatsListResponse$inboundSchema,
|
|
12
|
+
} from "./threatslistresponse.js";
|
|
13
|
+
|
|
14
|
+
export type ResponseEnvelopeThreatsListResponse = {
|
|
15
|
+
result?: ThreatsListResponse | undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ResponseEnvelopeThreatsListResponse$inboundSchema: z.ZodType<
|
|
20
|
+
ResponseEnvelopeThreatsListResponse,
|
|
21
|
+
z.ZodTypeDef,
|
|
22
|
+
unknown
|
|
23
|
+
> = z.object({
|
|
24
|
+
result: ThreatsListResponse$inboundSchema.optional(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export function responseEnvelopeThreatsListResponseFromJSON(
|
|
28
|
+
jsonString: string,
|
|
29
|
+
): SafeParseResult<ResponseEnvelopeThreatsListResponse, SDKValidationError> {
|
|
30
|
+
return safeParse(
|
|
31
|
+
jsonString,
|
|
32
|
+
(x) =>
|
|
33
|
+
ResponseEnvelopeThreatsListResponse$inboundSchema.parse(JSON.parse(x)),
|
|
34
|
+
`Failed to parse 'ResponseEnvelopeThreatsListResponse' from JSON`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import { UserCredits, UserCredits$inboundSchema } from "./usercredits.js";
|
|
10
|
+
|
|
11
|
+
export type ResponseEnvelopeUserCredits = {
|
|
12
|
+
result?: UserCredits | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const ResponseEnvelopeUserCredits$inboundSchema: z.ZodType<
|
|
17
|
+
ResponseEnvelopeUserCredits,
|
|
18
|
+
z.ZodTypeDef,
|
|
19
|
+
unknown
|
|
20
|
+
> = z.object({
|
|
21
|
+
result: UserCredits$inboundSchema.optional(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export function responseEnvelopeUserCreditsFromJSON(
|
|
25
|
+
jsonString: string,
|
|
26
|
+
): SafeParseResult<ResponseEnvelopeUserCredits, SDKValidationError> {
|
|
27
|
+
return safeParse(
|
|
28
|
+
jsonString,
|
|
29
|
+
(x) => ResponseEnvelopeUserCredits$inboundSchema.parse(JSON.parse(x)),
|
|
30
|
+
`Failed to parse 'ResponseEnvelopeUserCredits' from JSON`,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
ThreatReference,
|
|
12
|
+
ThreatReference$inboundSchema,
|
|
13
|
+
} from "./threatreference.js";
|
|
14
|
+
|
|
15
|
+
export type ThreatListItem = {
|
|
16
|
+
/**
|
|
17
|
+
* The date and time when the threat was added.
|
|
18
|
+
*/
|
|
19
|
+
addedAt?: Date | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Total count of assets affected by this threat.
|
|
22
|
+
*/
|
|
23
|
+
count: number;
|
|
24
|
+
/**
|
|
25
|
+
* Detailed description of the threat.
|
|
26
|
+
*/
|
|
27
|
+
description?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Number of hosts affected by this threat.
|
|
30
|
+
*/
|
|
31
|
+
hostCount: number;
|
|
32
|
+
/**
|
|
33
|
+
* Unique identifier of the threat.
|
|
34
|
+
*/
|
|
35
|
+
id: string;
|
|
36
|
+
/**
|
|
37
|
+
* Human-readable name of the threat.
|
|
38
|
+
*/
|
|
39
|
+
name?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* External reference links for the threat.
|
|
42
|
+
*/
|
|
43
|
+
references?: Array<ThreatReference> | null | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Number of web properties affected by this threat.
|
|
46
|
+
*/
|
|
47
|
+
webCount: number;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const ThreatListItem$inboundSchema: z.ZodType<
|
|
52
|
+
ThreatListItem,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
unknown
|
|
55
|
+
> = z.object({
|
|
56
|
+
added_at: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
57
|
+
.optional(),
|
|
58
|
+
count: z.number().int(),
|
|
59
|
+
description: z.string().optional(),
|
|
60
|
+
host_count: z.number().int(),
|
|
61
|
+
id: z.string(),
|
|
62
|
+
name: z.string().optional(),
|
|
63
|
+
references: z.nullable(z.array(ThreatReference$inboundSchema)).optional(),
|
|
64
|
+
web_count: z.number().int(),
|
|
65
|
+
}).transform((v) => {
|
|
66
|
+
return remap$(v, {
|
|
67
|
+
"added_at": "addedAt",
|
|
68
|
+
"host_count": "hostCount",
|
|
69
|
+
"web_count": "webCount",
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export function threatListItemFromJSON(
|
|
74
|
+
jsonString: string,
|
|
75
|
+
): SafeParseResult<ThreatListItem, SDKValidationError> {
|
|
76
|
+
return safeParse(
|
|
77
|
+
jsonString,
|
|
78
|
+
(x) => ThreatListItem$inboundSchema.parse(JSON.parse(x)),
|
|
79
|
+
`Failed to parse 'ThreatListItem' from JSON`,
|
|
80
|
+
);
|
|
81
|
+
}
|