@corellium/corellium-cli 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
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. Install dependencies: `npm install`
19
- 3. Link with `npm link`
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="1716492375648" complexity="0" version="0.1">
3
+ <coverage lines-valid="0" lines-covered="0" line-rate="NaN" branches-valid="0" branches-covered="0" branch-rate="NaN" timestamp="1716923903892" 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-23T19:26:15.654Z
89
+ at 2024-05-28T19:18:23.899Z
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.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Corellium CLI Tool",
5
5
  "scripts": {
6
6
  "corellium": "node index.js",
@@ -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 Id',
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 Id',
25
+ describe: 'Instance UUID',
26
26
  string: true
27
27
  })
28
28
  .positional('imageName', {
@@ -37,7 +37,8 @@ async function builder (yargs) {
37
37
  })
38
38
  .positional('encoding', {
39
39
  type: 'string',
40
- describe: 'Encoding, e.g. plain or encrypted'
40
+ describe: 'Encoding',
41
+ choices: ['plain', 'encrypted']
41
42
  })
42
43
  .positional('file', {
43
44
  type: 'string',
@@ -74,5 +75,5 @@ module.exports = {
74
75
  builder,
75
76
  handler,
76
77
  command: 'create [project] [instance] <imageName> <imageType> <encoding> <file>',
77
- describe: 'Create image and optionally associate with a project/instance'
78
+ describe: 'Create image and associate it with a project or instance (you must specify either the project or instance UUID)'
78
79
  }
@@ -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
+ }
@@ -11,7 +11,8 @@ const subcommands = [
11
11
  require('./file'),
12
12
  require('./apps'),
13
13
  require('./input'),
14
- require('./unlock')
14
+ require('./unlock'),
15
+ require('./get')
15
16
  ]
16
17
 
17
18
  let _yargs
@@ -27,12 +27,10 @@ async function handler (argv) {
27
27
  // verify instance type
28
28
  const instance = await api.v1GetInstance(argv.instance)
29
29
  if (!instance) {
30
- console.error('Instance not found')
31
- return
30
+ throw new Error(`Instance ${argv.instance} not found`)
32
31
  }
33
32
  if (instance.type !== 'ios') {
34
- console.error('Instance is not an iOS device')
35
- return
33
+ throw new Error(`Instance ${argv.instance} is not an iOS device`)
36
34
  }
37
35
 
38
36
  const agent = new AgentCLI(argv)