@corellium/corellium-cli 1.2.9 → 1.3.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/README.md +6 -2
- package/coverage/cobertura-coverage.xml +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/output/b0b7159c2ff8df23d332c4c518fdcfaec6c7b2b4-corellium-cli-build.tar.gz +0 -0
- package/package.json +1 -1
- package/src/clients/Agent.js +3 -0
- package/src/commands/images/create.js +7 -5
- package/src/commands/instances/get.js +44 -0
- package/src/commands/instances/index.js +3 -1
- package/src/commands/instances/unlock.js +51 -0
package/README.md
CHANGED
@@ -15,8 +15,12 @@ npm install -g @corellium/corellium-cli
|
|
15
15
|
## Development
|
16
16
|
|
17
17
|
1. Clone the repo
|
18
|
-
2.
|
19
|
-
|
18
|
+
2. Ensure NPM has access to private package registery for dependencies
|
19
|
+
- Create a Personal Access Token with read_api scope in GitLab.
|
20
|
+
- Authenticate to the registry. (in ~/.npmrc): ``npm config set -- //[FQDN HERE]/api/v4/packages/npm/:_authToken=[TOKEN HERE]``
|
21
|
+
- Set the registry. (in ~/.npmrc): `npm config set @corellium:registry https://[FQDN HERE]/api/v4/packages/npm/`
|
22
|
+
3. Install dependencies: `npm ci`
|
23
|
+
4. Link with `npm link`
|
20
24
|
|
21
25
|
*Note*: if you are running it locally create `.env` file and put the following line there `NODE_TLS_REJECT_UNAUTHORIZED=0`
|
22
26
|
|
@@ -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="1716906748524" 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-28T14:32:28.531Z
|
90
90
|
</div>
|
91
91
|
<script src="prettify.js"></script>
|
92
92
|
<script>
|
Binary file
|
package/package.json
CHANGED
package/src/clients/Agent.js
CHANGED
@@ -25,6 +25,9 @@ class AgentCLI extends Client {
|
|
25
25
|
|
26
26
|
ready = async () => await this._fetch('GET', `${this.agentBasePath()}/app/ready/`, {})
|
27
27
|
|
28
|
+
// only for iOS
|
29
|
+
unlock = async () => await this._fetch('POST', `${this.agentBasePath()}/system/unlock/`)
|
30
|
+
|
28
31
|
/**
|
29
32
|
* List files on device
|
30
33
|
* @returns {Promise<Array<{object}>>}
|
@@ -6,7 +6,7 @@ const { getApi } = require('../../utils')
|
|
6
6
|
async function builder (yargs) {
|
7
7
|
yargs.option('project', {
|
8
8
|
type: 'input',
|
9
|
-
describe: 'Project
|
9
|
+
describe: 'Project UUID',
|
10
10
|
string: true
|
11
11
|
})
|
12
12
|
.option('format', {
|
@@ -22,7 +22,7 @@ async function builder (yargs) {
|
|
22
22
|
})
|
23
23
|
.option('instance', {
|
24
24
|
type: 'input',
|
25
|
-
describe: 'Instance
|
25
|
+
describe: 'Instance UUID',
|
26
26
|
string: true
|
27
27
|
})
|
28
28
|
.positional('imageName', {
|
@@ -33,11 +33,13 @@ async function builder (yargs) {
|
|
33
33
|
.positional('imageType', {
|
34
34
|
type: 'string',
|
35
35
|
describe: 'Image type to upload',
|
36
|
-
demandOption: true
|
36
|
+
demandOption: true,
|
37
|
+
choices: ['fwbinary', 'kernel', 'devicetree', 'ramdisk', 'loaderfile', 'sepf']
|
37
38
|
})
|
38
39
|
.positional('encoding', {
|
39
40
|
type: 'string',
|
40
|
-
describe: 'Encoding,
|
41
|
+
describe: 'Encoding',
|
42
|
+
choices: ['plain', 'encrypted']
|
41
43
|
})
|
42
44
|
.positional('file', {
|
43
45
|
type: 'string',
|
@@ -74,5 +76,5 @@ module.exports = {
|
|
74
76
|
builder,
|
75
77
|
handler,
|
76
78
|
command: 'create [project] [instance] <imageName> <imageType> <encoding> <file>',
|
77
|
-
describe: 'Create image and
|
79
|
+
describe: 'Create image and associate it with a project or instance (you must specify either the project or instance UUID)'
|
78
80
|
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const { handleError } = require('../../error')
|
2
|
+
const { getApi } = require('../../utils')
|
3
|
+
|
4
|
+
async function builder (yargs) {
|
5
|
+
yargs
|
6
|
+
.option('instance', {
|
7
|
+
alias: 'i',
|
8
|
+
type: 'string',
|
9
|
+
demandOption: true,
|
10
|
+
describe: 'virtual device id'
|
11
|
+
})
|
12
|
+
.option('verbose', {
|
13
|
+
alias: 'v',
|
14
|
+
type: 'boolean',
|
15
|
+
describe: 'Console will receive verbose error output'
|
16
|
+
})
|
17
|
+
}
|
18
|
+
|
19
|
+
async function handler (argv) {
|
20
|
+
const api = await getApi()
|
21
|
+
|
22
|
+
try {
|
23
|
+
const instance = await api.v1GetInstance(argv.instance)
|
24
|
+
if (!instance) {
|
25
|
+
throw new Error(`Instance ${argv.instance} not found`)
|
26
|
+
}
|
27
|
+
console.log(JSON.stringify({
|
28
|
+
id: instance.id,
|
29
|
+
flavor: instance.flavor,
|
30
|
+
type: instance.type,
|
31
|
+
state: instance.state,
|
32
|
+
os: instance.os
|
33
|
+
}))
|
34
|
+
} catch (err) {
|
35
|
+
handleError(err, 'Get instance failed', argv.verbose)
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
module.exports = {
|
40
|
+
builder,
|
41
|
+
handler,
|
42
|
+
command: 'get',
|
43
|
+
describe: 'Get instance'
|
44
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// this is for iOS only
|
2
|
+
|
3
|
+
const chalk = require('chalk')
|
4
|
+
const AgentCLI = require('../../clients/Agent')
|
5
|
+
const { handleError } = require('../../error')
|
6
|
+
const { getApi } = require('../../utils')
|
7
|
+
|
8
|
+
async function builder (yargs) {
|
9
|
+
yargs
|
10
|
+
.option('instance', {
|
11
|
+
alias: 'i',
|
12
|
+
type: 'string',
|
13
|
+
demandOption: true,
|
14
|
+
describe: 'virtual device id'
|
15
|
+
})
|
16
|
+
.option('verbose', {
|
17
|
+
alias: 'v',
|
18
|
+
type: 'boolean',
|
19
|
+
describe: 'Console will receive verbose error output'
|
20
|
+
})
|
21
|
+
}
|
22
|
+
|
23
|
+
async function handler (argv) {
|
24
|
+
const api = await getApi()
|
25
|
+
|
26
|
+
try {
|
27
|
+
// verify instance type
|
28
|
+
const instance = await api.v1GetInstance(argv.instance)
|
29
|
+
if (!instance) {
|
30
|
+
throw new Error(`Instance ${argv.instance} not found`)
|
31
|
+
}
|
32
|
+
if (instance.type !== 'ios') {
|
33
|
+
throw new Error(`Instance ${argv.instance} is not an iOS device`)
|
34
|
+
}
|
35
|
+
|
36
|
+
const agent = new AgentCLI(argv)
|
37
|
+
await agent.unlock()
|
38
|
+
console.log(
|
39
|
+
chalk.green(`Successfully unlocked ${argv.instance}`)
|
40
|
+
)
|
41
|
+
} catch (err) {
|
42
|
+
handleError(err, 'Unlock failed', argv.verbose)
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
module.exports = {
|
47
|
+
builder,
|
48
|
+
handler,
|
49
|
+
command: 'unlock',
|
50
|
+
describe: 'Unlock iOS device'
|
51
|
+
}
|