@corellium/corellium-cli 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/coverage/cobertura-coverage.xml +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/package.json +1 -1
- package/src/commands/mast/api-base-path.js +21 -0
- package/src/commands/mast/constants.js +2 -1
- package/src/commands/mast/create-assessment.js +3 -2
- package/src/commands/mast/delete-assessment.js +3 -2
- package/src/commands/mast/download-report.js +3 -2
- package/src/commands/mast/get-assessment.js +3 -2
- package/src/commands/mast/get-assessments.js +3 -2
- package/src/commands/mast/start-monitor.js +3 -2
- package/src/commands/mast/stop-monitor.js +3 -2
- package/src/commands/mast/test.js +3 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" ?>
|
2
2
|
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
3
|
-
<coverage lines-valid="0" lines-covered="0" line-rate="NaN" branches-valid="0" branches-covered="0" branch-rate="NaN" timestamp="
|
3
|
+
<coverage lines-valid="0" lines-covered="0" line-rate="NaN" branches-valid="0" branches-covered="0" branch-rate="NaN" timestamp="1715716510523" complexity="0" version="0.1">
|
4
4
|
<sources>
|
5
5
|
<source>/builds/middleware/corellium-cli</source>
|
6
6
|
</sources>
|
@@ -86,7 +86,7 @@
|
|
86
86
|
<div class='footer quiet pad2 space-top1 center small'>
|
87
87
|
Code coverage generated by
|
88
88
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
89
|
-
at 2024-05-
|
89
|
+
at 2024-05-14T19:55:10.530Z
|
90
90
|
</div>
|
91
91
|
<script src="prettify.js"></script>
|
92
92
|
<script>
|
package/package.json
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
const { MAST_API_BASE_PATH, MAST_API_BASE_PATH_LEGACY } = require('./constants')
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Temporarily support backwards compatibility with mast/matrix routes.
|
5
|
+
* Until all environments are listening on /matrix at the conclusion of release 6.4.0, we need to handle
|
6
|
+
* the possibility that some environments will listen to MAST on /mast or /matrix
|
7
|
+
*
|
8
|
+
* This temporary code can be removed in release 6.5.0 - CORE-7670
|
9
|
+
*/
|
10
|
+
async function getMastApiBasePath (client, instance) {
|
11
|
+
try {
|
12
|
+
await client._fetch('GET', `${MAST_API_BASE_PATH}/${instance}/instances/${instance}/assessments`)
|
13
|
+
return MAST_API_BASE_PATH
|
14
|
+
} catch (_) {
|
15
|
+
// no-op, we want to fall back to legacy route.
|
16
|
+
}
|
17
|
+
|
18
|
+
return MAST_API_BASE_PATH_LEGACY
|
19
|
+
}
|
20
|
+
|
21
|
+
module.exports = { getMastApiBasePath }
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const Client = require('../../clients/Client')
|
2
2
|
const { handleError } = require('../../error')
|
3
|
-
const {
|
3
|
+
const { getMastApiBasePath } = require('./api-base-path')
|
4
4
|
|
5
5
|
/**
|
6
6
|
* Create an assessment via corellium-mast API.
|
@@ -42,7 +42,8 @@ async function handler (argv) {
|
|
42
42
|
const client = new Client(argv)
|
43
43
|
try {
|
44
44
|
const body = { instanceId: instance, bundleId: bundle, wordlistId: wordlist }
|
45
|
-
const
|
45
|
+
const API_BASE_PATH = await getMastApiBasePath(client, instance)
|
46
|
+
const res = await client._fetch('POST', `${API_BASE_PATH}/${instance}/assessments`, body)
|
46
47
|
console.log(JSON.stringify(res))
|
47
48
|
} catch (error) {
|
48
49
|
handleError(error, 'create-assessment failed', verbose)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
const Client = require('../../clients/Client')
|
2
2
|
const { handleError } = require('../../error')
|
3
|
-
const { MAST_API_BASE_PATH } = require('./constants')
|
4
3
|
const log = require('../../logging')
|
4
|
+
const { getMastApiBasePath } = require('./api-base-path')
|
5
5
|
|
6
6
|
/**
|
7
7
|
* Delete an assessment via corellium-mast API.
|
@@ -35,7 +35,8 @@ async function handler (argv) {
|
|
35
35
|
const { assessment, instance, verbose } = argv
|
36
36
|
const client = new Client(argv)
|
37
37
|
try {
|
38
|
-
await client
|
38
|
+
const API_BASE_PATH = await getMastApiBasePath(client, instance)
|
39
|
+
await client._fetch('DELETE', `${API_BASE_PATH}/${instance}/assessments/${assessment}`)
|
39
40
|
log.info('Assessment deleted.')
|
40
41
|
} catch (error) {
|
41
42
|
handleError(error, 'delete-assessment failed', verbose)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const Client = require('../../clients/Client')
|
2
2
|
const { handleError } = require('../../error')
|
3
|
-
const {
|
3
|
+
const { getMastApiBasePath } = require('./api-base-path')
|
4
4
|
|
5
5
|
/**
|
6
6
|
* Download assessment report via corellium-mast API.
|
@@ -43,7 +43,8 @@ async function handler (argv) {
|
|
43
43
|
const { assessment, instance, format, verbose } = argv
|
44
44
|
const client = new Client(argv)
|
45
45
|
try {
|
46
|
-
const
|
46
|
+
const API_BASE_PATH = await getMastApiBasePath(client, instance)
|
47
|
+
const res = await client._fetch('GET', `${API_BASE_PATH}/${instance}/assessments/${assessment}/download?format=${format}`)
|
47
48
|
console.log(res)
|
48
49
|
} catch (error) {
|
49
50
|
handleError(error, 'download-report failed', verbose)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const Client = require('../../clients/Client')
|
2
2
|
const { handleError } = require('../../error')
|
3
|
-
const {
|
3
|
+
const { getMastApiBasePath } = require('./api-base-path')
|
4
4
|
|
5
5
|
/**
|
6
6
|
* Get an assessment via corellium-mast API.
|
@@ -36,7 +36,8 @@ async function handler (argv) {
|
|
36
36
|
const { assessment, instance, verbose } = argv
|
37
37
|
const client = new Client(argv)
|
38
38
|
try {
|
39
|
-
const
|
39
|
+
const API_BASE_PATH = await getMastApiBasePath(client, instance)
|
40
|
+
const res = await client._fetch('GET', `${API_BASE_PATH}/${instance}/assessments/${assessment}`)
|
40
41
|
console.log(JSON.stringify(res))
|
41
42
|
} catch (error) {
|
42
43
|
handleError(error, 'get-assessment failed', verbose)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const Client = require('../../clients/Client')
|
2
2
|
const { handleError } = require('../../error')
|
3
|
-
const {
|
3
|
+
const { getMastApiBasePath } = require('./api-base-path')
|
4
4
|
|
5
5
|
/**
|
6
6
|
* Get assessments for an instance via corellium-mast API.
|
@@ -29,7 +29,8 @@ async function handler (argv) {
|
|
29
29
|
const { instance, verbose } = argv
|
30
30
|
const client = new Client(argv)
|
31
31
|
try {
|
32
|
-
const
|
32
|
+
const API_BASE_PATH = await getMastApiBasePath(client, instance)
|
33
|
+
const res = await client._fetch('GET', `${API_BASE_PATH}/${instance}/instances/${instance}/assessments`)
|
33
34
|
console.log(JSON.stringify(res))
|
34
35
|
} catch (error) {
|
35
36
|
handleError(error, 'get-assessments failed', verbose)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
const Client = require('../../clients/Client')
|
2
2
|
const { handleError } = require('../../error')
|
3
|
-
const { MAST_API_BASE_PATH } = require('./constants')
|
4
3
|
const log = require('../../logging')
|
4
|
+
const { getMastApiBasePath } = require('./api-base-path')
|
5
5
|
|
6
6
|
/**
|
7
7
|
* The start-monitor command starts device monitoring via the start-monitor API on corellium-mast
|
@@ -37,7 +37,8 @@ async function handler (argv) {
|
|
37
37
|
const { assessment, instance, verbose } = argv
|
38
38
|
const client = new Client(argv)
|
39
39
|
try {
|
40
|
-
await client
|
40
|
+
const API_BASE_PATH = await getMastApiBasePath(client, instance)
|
41
|
+
await client._fetch('POST', `${API_BASE_PATH}/${instance}/assessments/${assessment}/start`)
|
41
42
|
log.info('Monitoring started.')
|
42
43
|
} catch (error) {
|
43
44
|
handleError(error, 'start-monitor failed', verbose)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
const Client = require('../../clients/Client')
|
2
2
|
const { handleError } = require('../../error')
|
3
|
-
const { MAST_API_BASE_PATH } = require('./constants')
|
4
3
|
const log = require('../../logging')
|
4
|
+
const { getMastApiBasePath } = require('./api-base-path')
|
5
5
|
|
6
6
|
/**
|
7
7
|
* The stop-monitor command stops device monitoring via the stop-monitor API on corellium-mast.
|
@@ -37,7 +37,8 @@ async function handler (argv) {
|
|
37
37
|
const { assessment, instance, verbose } = argv
|
38
38
|
const client = new Client(argv)
|
39
39
|
try {
|
40
|
-
await client
|
40
|
+
const API_BASE_PATH = await getMastApiBasePath(client, instance)
|
41
|
+
await client._fetch('POST', `${API_BASE_PATH}/${instance}/assessments/${assessment}/stop`)
|
41
42
|
log.info('Monitoring stopped.')
|
42
43
|
} catch (error) {
|
43
44
|
handleError(error, 'stop-monitor failed', verbose)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const Client = require('../../clients/Client')
|
2
2
|
const { handleError } = require('../../error')
|
3
|
-
const {
|
3
|
+
const { getMastApiBasePath } = require('./api-base-path')
|
4
4
|
|
5
5
|
/**
|
6
6
|
* The test command executes device testing via the test API on corellium-mast.
|
@@ -47,7 +47,8 @@ async function handler (argv) {
|
|
47
47
|
const { grep, invert, assessment, instance, verbose } = argv
|
48
48
|
const client = new Client(argv)
|
49
49
|
try {
|
50
|
-
const
|
50
|
+
const API_BASE_PATH = await getMastApiBasePath(client, instance)
|
51
|
+
const res = await client._fetch('POST', `${API_BASE_PATH}/${instance}/assessments/${assessment}/test`, { grep, invert })
|
51
52
|
console.log(JSON.stringify(res))
|
52
53
|
} catch (error) {
|
53
54
|
handleError(error, 'test failed', verbose)
|