@mitre/hdf-converters 2.6.50 → 2.6.54
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 +19 -17
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +2 -2
- package/lib/src/ckl-mapper/checklist-jsonix-converter.d.ts +72 -0
- package/lib/src/ckl-mapper/checklist-jsonix-converter.js +123 -0
- package/lib/src/ckl-mapper/checklist-jsonix-converter.js.map +1 -0
- package/lib/src/ckl-mapper/checklist-mapper.d.ts +19 -0
- package/lib/src/ckl-mapper/checklist-mapper.js +292 -0
- package/lib/src/ckl-mapper/checklist-mapper.js.map +1 -0
- package/lib/src/ckl-mapper/jsonixMapping.d.ts +110 -0
- package/lib/src/ckl-mapper/jsonixMapping.js +586 -0
- package/lib/src/ckl-mapper/jsonixMapping.js.map +1 -0
- package/lib/src/converters-from-hdf/splunk/reverse-splunk-mapper.d.ts +8 -20
- package/lib/src/converters-from-hdf/splunk/reverse-splunk-mapper.js +77 -121
- package/lib/src/converters-from-hdf/splunk/reverse-splunk-mapper.js.map +1 -1
- package/lib/src/conveyor-mapper.d.ts +14 -0
- package/lib/src/conveyor-mapper.js +188 -0
- package/lib/src/conveyor-mapper.js.map +1 -0
- package/lib/src/dbprotect-mapper.d.ts +5 -2
- package/lib/src/dbprotect-mapper.js +21 -20
- package/lib/src/dbprotect-mapper.js.map +1 -1
- package/lib/src/jsonix-converter.d.ts +5 -0
- package/lib/src/jsonix-converter.js +16 -0
- package/lib/src/jsonix-converter.js.map +1 -0
- package/lib/src/jsonix-intermediate-converter.d.ts +4 -0
- package/lib/src/jsonix-intermediate-converter.js +8 -0
- package/lib/src/jsonix-intermediate-converter.js.map +1 -0
- package/lib/src/splunk-mapper.d.ts +13 -12
- package/lib/src/splunk-mapper.js +110 -99
- package/lib/src/splunk-mapper.js.map +1 -1
- package/lib/src/utils/fingerprinting.d.ts +2 -0
- package/lib/src/utils/fingerprinting.js +9 -0
- package/lib/src/utils/fingerprinting.js.map +1 -1
- package/lib/src/utils/splunk-tools.d.ts +5 -0
- package/lib/src/utils/splunk-tools.js +73 -0
- package/lib/src/utils/splunk-tools.js.map +1 -0
- package/lib/types/splunk-config-types.d.ts +13 -0
- package/lib/types/splunk-config-types.js +3 -0
- package/lib/types/splunk-config-types.js.map +1 -0
- package/lib/{src/converters-from-hdf/splunk → types}/splunk-control-types.d.ts +1 -1
- package/lib/types/splunk-control-types.js.map +1 -0
- package/lib/{src/converters-from-hdf/splunk → types}/splunk-profile-types.d.ts +1 -1
- package/lib/types/splunk-profile-types.js.map +1 -0
- package/lib/types/splunk-report-types.js.map +1 -0
- package/package.json +2 -2
- package/lib/src/converters-from-hdf/splunk/splunk-control-types.js.map +0 -1
- package/lib/src/converters-from-hdf/splunk/splunk-profile-types.js.map +0 -1
- package/lib/src/converters-from-hdf/splunk/splunk-report-types.js.map +0 -1
- /package/lib/{src/converters-from-hdf/splunk → types}/splunk-control-types.js +0 -0
- /package/lib/{src/converters-from-hdf/splunk → types}/splunk-profile-types.js +0 -0
- /package/lib/{src/converters-from-hdf/splunk → types}/splunk-report-types.d.ts +0 -0
- /package/lib/{src/converters-from-hdf/splunk → types}/splunk-report-types.js +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { SplunkConfig } from '../../types/splunk-config-types';
|
|
3
|
+
export declare function generateHostname(config: SplunkConfig): string;
|
|
4
|
+
export declare function handleSplunkErrorResponse(error: AxiosResponse): string;
|
|
5
|
+
export declare function checkSplunkCredentials(config: SplunkConfig): Promise<string>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.checkSplunkCredentials = exports.handleSplunkErrorResponse = exports.generateHostname = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
|
+
function generateHostname(config) {
|
|
10
|
+
return config.port
|
|
11
|
+
? `${config.scheme}://${config.host}:${config.port}`
|
|
12
|
+
: `${config.scheme}://${config.host}:8089`;
|
|
13
|
+
}
|
|
14
|
+
exports.generateHostname = generateHostname;
|
|
15
|
+
function handleSplunkErrorResponse(error) {
|
|
16
|
+
switch (lodash_1.default.get(error, ['response', 'status'])) {
|
|
17
|
+
case 400:
|
|
18
|
+
return 'Malformed request received';
|
|
19
|
+
case 401:
|
|
20
|
+
return 'Incorrect username or password';
|
|
21
|
+
case 402:
|
|
22
|
+
return 'Bad license detected';
|
|
23
|
+
case 403:
|
|
24
|
+
return 'Insufficient permission for this request';
|
|
25
|
+
case 404:
|
|
26
|
+
return 'Targeted endpoint does not exist';
|
|
27
|
+
case 409:
|
|
28
|
+
return 'Invalid request operation made on endpoint';
|
|
29
|
+
case 500:
|
|
30
|
+
return 'Internal server error';
|
|
31
|
+
case 503:
|
|
32
|
+
return 'This feature is disabled by server configurations';
|
|
33
|
+
default:
|
|
34
|
+
return `Unexpected error`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.handleSplunkErrorResponse = handleSplunkErrorResponse;
|
|
38
|
+
async function checkSplunkCredentials(config) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const hostname = generateHostname(config);
|
|
41
|
+
const username = ((_a = config.username) !== null && _a !== void 0 ? _a : (config.username = ''));
|
|
42
|
+
const password = ((_b = config.password) !== null && _b !== void 0 ? _b : (config.password = ''));
|
|
43
|
+
let authRequest;
|
|
44
|
+
const loginTimeout = 5000;
|
|
45
|
+
const loginTimer = setTimeout(() => {
|
|
46
|
+
throw new Error('Login timed out - Please check your CORS configuration or validate that you have inputted the correct domain');
|
|
47
|
+
}, loginTimeout);
|
|
48
|
+
try {
|
|
49
|
+
authRequest = await axios_1.default.post(`${hostname}/services/auth/login`, new URLSearchParams({
|
|
50
|
+
username: username,
|
|
51
|
+
password: password
|
|
52
|
+
}), { params: { output_mode: 'json' } });
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
clearTimeout(loginTimer);
|
|
56
|
+
const errorCode = handleSplunkErrorResponse(error);
|
|
57
|
+
if (errorCode === 'Unexpected error') {
|
|
58
|
+
throw new Error('Failed to login - Please check your CORS configuration and validate that your input has the correct domain');
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
throw new Error(`Failed to login - ${errorCode}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
clearTimeout(loginTimer);
|
|
65
|
+
if (lodash_1.default.has(authRequest, ['data', 'sessionKey'])) {
|
|
66
|
+
return authRequest.data.sessionKey;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
throw new Error('Failed to login - Malformed authentication response received');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.checkSplunkCredentials = checkSplunkCredentials;
|
|
73
|
+
//# sourceMappingURL=splunk-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splunk-tools.js","sourceRoot":"","sources":["../../../src/utils/splunk-tools.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA2C;AAC3C,oDAAuB;AAIvB,SAAgB,gBAAgB,CAAC,MAAoB;IACnD,OAAO,MAAM,CAAC,IAAI;QAChB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,MAAM,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE;QACpD,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,MAAM,MAAM,CAAC,IAAI,OAAO,CAAC;AAC/C,CAAC;AAJD,4CAIC;AAID,SAAgB,yBAAyB,CAAC,KAAoB;IAC5D,QAAQ,gBAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,U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d,YAAY,CAAC,UAAU,CAAC,CAAC;QAGzB,MAAM,SAAS,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,SAAS,KAAK,kBAAkB,EAAE;YACpC,MAAM,IAAI,KAAK,CACb,4GAA4G,CAC7G,CAAC;SACH;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,qBAAqB,SAAS,EAAE,CAAC,CAAC;SACnD;KACF;IAGD,YAAY,CAAC,UAAU,CAAC,CAAC;IAGzB,IAAI,gBAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE;QAC9C,OAAO,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC;KACpC;SAAM;QACL,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;KACH;AACH,CAAC;AAvDD,wDAuDC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare type SplunkConfig = {
|
|
2
|
+
scheme: string;
|
|
3
|
+
host: string;
|
|
4
|
+
port?: number;
|
|
5
|
+
username?: string;
|
|
6
|
+
password?: string;
|
|
7
|
+
index: string;
|
|
8
|
+
owner?: string;
|
|
9
|
+
app?: string;
|
|
10
|
+
sessionKey?: string;
|
|
11
|
+
autologin?: boolean;
|
|
12
|
+
version?: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splunk-config-types.js","sourceRoot":"","sources":["../../types/splunk-config-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splunk-control-types.js","sourceRoot":"","sources":["../../types/splunk-control-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splunk-profile-types.js","sourceRoot":"","sources":["../../types/splunk-profile-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splunk-report-types.js","sourceRoot":"","sources":["../../types/splunk-report-types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mitre/hdf-converters",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.54",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Converter util library used to transform various scan results into HDF format",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@aws-sdk/client-config-service": "^3.95.0",
|
|
29
|
-
"@mitre/
|
|
29
|
+
"@mitre/jsonix": "^3.0.6",
|
|
30
30
|
"@types/csv2json": "^1.4.2",
|
|
31
31
|
"@types/ms": "^0.7.31",
|
|
32
32
|
"@types/mustache": "^4.1.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splunk-control-types.js","sourceRoot":"","sources":["../../../../src/converters-from-hdf/splunk/splunk-control-types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splunk-profile-types.js","sourceRoot":"","sources":["../../../../src/converters-from-hdf/splunk/splunk-profile-types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splunk-report-types.js","sourceRoot":"","sources":["../../../../src/converters-from-hdf/splunk/splunk-report-types.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|