@corellium/corellium-cli 1.2.7 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -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="1715897730108" 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-16T22:15:30.115Z
|
90
90
|
</div>
|
91
91
|
<script src="prettify.js"></script>
|
92
92
|
<script>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@corellium/corellium-cli",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.8",
|
4
4
|
"description": "Corellium CLI Tool",
|
5
5
|
"scripts": {
|
6
6
|
"corellium": "node index.js",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
],
|
28
28
|
"dependencies": {
|
29
29
|
"@corellium/client-api": "^0.1.0",
|
30
|
-
"@corellium/corellium-api": "^1.7.
|
30
|
+
"@corellium/corellium-api": "^1.7.7",
|
31
31
|
"axios": "^0.27.2",
|
32
32
|
"chalk": "^4.1.2",
|
33
33
|
"cli-progress": "^3.12.0",
|
package/src/clients/Agent.js
CHANGED
@@ -6,8 +6,15 @@ const { progressBar } = require('../progress')
|
|
6
6
|
const { getCorelliumApi } = require('../corellium-api')
|
7
7
|
|
8
8
|
/**
|
9
|
-
* @typedef {object}
|
10
|
-
* @property {Array<
|
9
|
+
* @typedef {object} App
|
10
|
+
* @property {Array<any>} tags
|
11
|
+
* @property {boolean} running
|
12
|
+
* @property {string} [icon]
|
13
|
+
* @property {number} diskUsage
|
14
|
+
* @property {number} date
|
15
|
+
* @property {string} applicationType
|
16
|
+
* @property {string} name
|
17
|
+
* @property {string} bundleID
|
11
18
|
*/
|
12
19
|
|
13
20
|
/**
|
@@ -30,14 +37,19 @@ class AgentCLI extends Client {
|
|
30
37
|
|
31
38
|
/**
|
32
39
|
* List apps on device
|
33
|
-
* @returns {Promise<Array<
|
40
|
+
* @returns {Promise<Array<App>>}
|
34
41
|
*/
|
35
|
-
listApps = async (options) => {
|
42
|
+
listApps = async (options = { loadIcons: false }) => {
|
36
43
|
const { loadIcons } = options
|
37
44
|
const response = (await this._fetch('GET', `${this.agentBasePath()}/app/apps?loadIcons=${loadIcons ? 1 : 0}`, {}))
|
38
45
|
return response ? response.apps : []
|
39
46
|
}
|
40
47
|
|
48
|
+
/**
|
49
|
+
* Install an app on device
|
50
|
+
* @param {string} app - path to app
|
51
|
+
* @returns {Promise<void>}
|
52
|
+
*/
|
41
53
|
installApp = async (app) => {
|
42
54
|
// get app info
|
43
55
|
const filePath = resolve(app)
|
@@ -47,6 +59,7 @@ class AgentCLI extends Client {
|
|
47
59
|
const corellium = await getCorelliumApi()
|
48
60
|
const instance = await corellium.getInstance(this.instance)
|
49
61
|
const agent = await instance.agent()
|
62
|
+
await agent.ready()
|
50
63
|
|
51
64
|
// configure upload bar for user
|
52
65
|
const uploadBar = progressBar()
|
@@ -64,6 +77,23 @@ class AgentCLI extends Client {
|
|
64
77
|
// cleanup
|
65
78
|
await agent.disconnect()
|
66
79
|
};
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Open an application on a device
|
83
|
+
* @param {string} bundleId - Application Bundle ID
|
84
|
+
* @returns {Promise<void>}
|
85
|
+
*/
|
86
|
+
openApp = async (bundleId) => {
|
87
|
+
// get agent
|
88
|
+
const corellium = await getCorelliumApi()
|
89
|
+
const instance = await corellium.getInstance(this.instance)
|
90
|
+
const agent = await instance.agent()
|
91
|
+
await agent.ready()
|
92
|
+
await agent.openApp(bundleId)
|
93
|
+
|
94
|
+
// cleanup
|
95
|
+
await agent.disconnect()
|
96
|
+
}
|
67
97
|
}
|
68
98
|
|
69
99
|
module.exports = AgentCLI
|
@@ -3,35 +3,42 @@ const { displayTable } = require('../../../table')
|
|
3
3
|
const { validateNonEmpty } = require('../../../utils')
|
4
4
|
const { handleError } = require('../../../error')
|
5
5
|
const InstallCommand = require('./install')
|
6
|
+
const OpenCommand = require('./open')
|
6
7
|
|
7
8
|
async function builder (yargs) {
|
8
9
|
yargs.option('verbose', {
|
9
10
|
alias: 'v',
|
10
11
|
type: 'boolean',
|
11
12
|
describe: 'Console will receive verbose error output'
|
12
|
-
})
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
13
|
+
})
|
14
|
+
.option('project', {
|
15
|
+
type: 'input',
|
16
|
+
describe: 'Project ID',
|
17
|
+
demandOption: true,
|
18
|
+
string: true,
|
19
|
+
validateNonEmpty
|
20
|
+
})
|
21
|
+
.option('instance', {
|
22
|
+
type: 'input',
|
23
|
+
describe: 'Instance ID',
|
24
|
+
demandOption: true,
|
25
|
+
string: true,
|
26
|
+
validateNonEmpty
|
27
|
+
})
|
28
|
+
.option('load-icons', {
|
29
|
+
type: 'input',
|
30
|
+
describe: 'Toggle loading of icons',
|
31
|
+
demandOption: false,
|
32
|
+
boolean: true
|
33
|
+
})
|
34
|
+
.option('format', {
|
35
|
+
type: 'input',
|
36
|
+
describe: 'Output format (default is json) e.g. table',
|
37
|
+
string: true,
|
38
|
+
choices: ['table', 'json', 'csv']
|
39
|
+
})
|
40
|
+
.command(InstallCommand)
|
41
|
+
.command(OpenCommand)
|
35
42
|
}
|
36
43
|
|
37
44
|
async function handler (argv) {
|
@@ -0,0 +1,37 @@
|
|
1
|
+
const AgentCLI = require('../../../clients/Agent')
|
2
|
+
const { validateNonEmpty } = require('../../../utils')
|
3
|
+
const { handleError } = require('../../../error')
|
4
|
+
const log = require('../../../logging')
|
5
|
+
|
6
|
+
async function builder (yargs) {
|
7
|
+
yargs.option('bundle', {
|
8
|
+
alias: 'b',
|
9
|
+
type: 'string',
|
10
|
+
demandOption: true,
|
11
|
+
describe: 'application bundle id',
|
12
|
+
validateNonEmpty
|
13
|
+
})
|
14
|
+
}
|
15
|
+
|
16
|
+
async function handler (argv) {
|
17
|
+
try {
|
18
|
+
const { bundle: bundleId } = argv
|
19
|
+
const agent = new AgentCLI(argv)
|
20
|
+
log.info('Opening app...')
|
21
|
+
const apps = await agent.listApps()
|
22
|
+
if (!apps.filter(app => app.bundleID === bundleId).length) {
|
23
|
+
throw new Error('App not installed.')
|
24
|
+
}
|
25
|
+
await agent.openApp(bundleId)
|
26
|
+
log.info('App opened.')
|
27
|
+
} catch (err) {
|
28
|
+
handleError(err, 'Open app failed', argv.verbose)
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
module.exports = {
|
33
|
+
builder,
|
34
|
+
handler,
|
35
|
+
command: 'open',
|
36
|
+
describe: 'Open app on device instance'
|
37
|
+
}
|