@corellium/corellium-cli 1.3.4 → 1.3.6

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.
Files changed (121) hide show
  1. package/coverage/cobertura-coverage.xml +1 -1
  2. package/coverage/lcov-report/index.html +1 -1
  3. package/node_modules/@corellium/client-api/README.md +177 -14
  4. package/node_modules/@corellium/client-api/dist/ApiClient.js +67 -138
  5. package/node_modules/@corellium/client-api/dist/api/CorelliumApi.js +4668 -905
  6. package/node_modules/@corellium/client-api/dist/index.js +469 -37
  7. package/node_modules/@corellium/client-api/dist/model/Address.js +158 -0
  8. package/node_modules/@corellium/client-api/dist/model/AgentApp.js +159 -0
  9. package/node_modules/@corellium/client-api/dist/model/AgentAppReadyResponse.js +112 -0
  10. package/node_modules/@corellium/client-api/dist/model/AgentAppStatus.js +102 -0
  11. package/node_modules/@corellium/client-api/dist/model/AgentAppsList.js +127 -0
  12. package/node_modules/@corellium/client-api/dist/model/AgentAppsStatusList.js +127 -0
  13. package/node_modules/@corellium/client-api/dist/model/AgentError.js +153 -0
  14. package/node_modules/@corellium/client-api/dist/model/AgentIcons.js +89 -0
  15. package/node_modules/@corellium/client-api/dist/model/AgentInstallBody.js +93 -0
  16. package/node_modules/@corellium/client-api/dist/model/AgentProfilesReturn.js +116 -0
  17. package/node_modules/@corellium/client-api/dist/model/AgentSystemAdbAuth.js +89 -0
  18. package/node_modules/@corellium/client-api/dist/model/AgentSystemGetPropBody.js +116 -0
  19. package/node_modules/@corellium/client-api/dist/model/AgentValueReturn.js +93 -0
  20. package/node_modules/@corellium/client-api/dist/model/AgreedAck.js +89 -0
  21. package/node_modules/@corellium/client-api/dist/model/ApiConflictError.js +61 -22
  22. package/node_modules/@corellium/client-api/dist/model/ApiError.js +64 -21
  23. package/node_modules/@corellium/client-api/dist/model/ApiInternalConsistencyError.js +144 -0
  24. package/node_modules/@corellium/client-api/dist/model/ApiNotFoundError.js +65 -23
  25. package/node_modules/@corellium/client-api/dist/model/ApiToken.js +55 -17
  26. package/node_modules/@corellium/client-api/dist/model/Bit.js +24 -14
  27. package/node_modules/@corellium/client-api/dist/model/BtraceEnableOptions.js +93 -0
  28. package/node_modules/@corellium/client-api/dist/model/Button.js +90 -0
  29. package/node_modules/@corellium/client-api/dist/model/CouponOptions.js +161 -0
  30. package/node_modules/@corellium/client-api/dist/model/CreateTeam.js +116 -0
  31. package/node_modules/@corellium/client-api/dist/model/CreatedBy.js +128 -0
  32. package/node_modules/@corellium/client-api/dist/model/Credentials.js +59 -19
  33. package/node_modules/@corellium/client-api/dist/model/DomainOptions.js +103 -0
  34. package/node_modules/@corellium/client-api/dist/model/Extension.js +167 -0
  35. package/node_modules/@corellium/client-api/dist/model/Features.js +260 -0
  36. package/node_modules/@corellium/client-api/dist/model/FileChanges.js +120 -0
  37. package/node_modules/@corellium/client-api/dist/model/Firmware.js +97 -46
  38. package/node_modules/@corellium/client-api/dist/model/GpioStateDefinition.js +55 -20
  39. package/node_modules/@corellium/client-api/dist/model/GpiosState.js +120 -0
  40. package/node_modules/@corellium/client-api/dist/model/GrantTrialRequestResponse.js +93 -0
  41. package/node_modules/@corellium/client-api/dist/model/Hook.js +211 -0
  42. package/node_modules/@corellium/client-api/dist/model/Image.js +99 -49
  43. package/node_modules/@corellium/client-api/dist/model/Instance.js +201 -71
  44. package/node_modules/@corellium/client-api/dist/model/InstanceAgentState.js +106 -0
  45. package/node_modules/@corellium/client-api/dist/model/InstanceBootOptions.js +72 -29
  46. package/node_modules/@corellium/client-api/dist/model/InstanceBootOptionsAdditionalTag.js +90 -0
  47. package/node_modules/@corellium/client-api/dist/model/InstanceConsoleEndpoint.js +34 -17
  48. package/node_modules/@corellium/client-api/dist/model/InstanceCreateOptions.js +126 -49
  49. package/node_modules/@corellium/client-api/dist/model/InstanceInput.js +181 -0
  50. package/node_modules/@corellium/client-api/dist/model/InstanceNetdumpState.js +115 -0
  51. package/node_modules/@corellium/client-api/dist/model/InstanceNetmonState.js +56 -16
  52. package/node_modules/@corellium/client-api/dist/model/InstanceReturn.js +55 -20
  53. package/node_modules/@corellium/client-api/dist/model/InstanceServices.js +35 -18
  54. package/node_modules/@corellium/client-api/dist/model/InstanceStartOptions.js +39 -17
  55. package/node_modules/@corellium/client-api/dist/model/InstanceState.js +52 -21
  56. package/node_modules/@corellium/client-api/dist/model/InstanceStopOptions.js +30 -17
  57. package/node_modules/@corellium/client-api/dist/model/InstanceUpgradeBody.js +129 -0
  58. package/node_modules/@corellium/client-api/dist/model/Invitation.js +115 -0
  59. package/node_modules/@corellium/client-api/dist/model/InviteRevokeParams.js +94 -0
  60. package/node_modules/@corellium/client-api/dist/model/InviteRevokeParamsIds.js +150 -0
  61. package/node_modules/@corellium/client-api/dist/model/Kcrange.js +106 -0
  62. package/node_modules/@corellium/client-api/dist/model/KernelTask.js +149 -0
  63. package/node_modules/@corellium/client-api/dist/model/KernelThread.js +115 -0
  64. package/node_modules/@corellium/client-api/dist/model/MediaPlayBody.js +106 -0
  65. package/node_modules/@corellium/client-api/dist/model/Model.js +97 -35
  66. package/node_modules/@corellium/client-api/dist/model/ModelSoftware.js +77 -28
  67. package/node_modules/@corellium/client-api/dist/model/NetdumpFilter.js +158 -0
  68. package/node_modules/@corellium/client-api/dist/model/PasswordChangeBody.js +146 -0
  69. package/node_modules/@corellium/client-api/dist/model/PasswordResetBody.js +146 -0
  70. package/node_modules/@corellium/client-api/dist/model/PatchInstanceOptions.js +182 -0
  71. package/node_modules/@corellium/client-api/dist/model/PeripheralsData.js +63 -33
  72. package/node_modules/@corellium/client-api/dist/model/Plan.js +106 -0
  73. package/node_modules/@corellium/client-api/dist/model/Project.js +77 -28
  74. package/node_modules/@corellium/client-api/dist/model/ProjectKey.js +206 -0
  75. package/node_modules/@corellium/client-api/dist/model/ProjectQuota.js +35 -21
  76. package/node_modules/@corellium/client-api/dist/model/ProjectSettings.js +35 -21
  77. package/node_modules/@corellium/client-api/dist/model/ProjectUsage.js +37 -23
  78. package/node_modules/@corellium/client-api/dist/model/ProxyConfig.js +116 -0
  79. package/node_modules/@corellium/client-api/dist/model/RateInfo.js +98 -0
  80. package/node_modules/@corellium/client-api/dist/model/ResetLinkBody.js +116 -0
  81. package/node_modules/@corellium/client-api/dist/model/Role.js +164 -0
  82. package/node_modules/@corellium/client-api/dist/model/RotateBody.js +140 -0
  83. package/node_modules/@corellium/client-api/dist/model/Snapshot.js +56 -32
  84. package/node_modules/@corellium/client-api/dist/model/SnapshotCreationOptions.js +54 -17
  85. package/node_modules/@corellium/client-api/dist/model/SnapshotStatus.js +37 -19
  86. package/node_modules/@corellium/client-api/dist/model/SubscriberInvite.js +277 -0
  87. package/node_modules/@corellium/client-api/dist/model/Team.js +162 -0
  88. package/node_modules/@corellium/client-api/dist/model/TeamCreate.js +93 -0
  89. package/node_modules/@corellium/client-api/dist/model/TextInput.js +93 -0
  90. package/node_modules/@corellium/client-api/dist/model/Token.js +56 -19
  91. package/node_modules/@corellium/client-api/dist/model/TouchCurveInput.js +98 -0
  92. package/node_modules/@corellium/client-api/dist/model/TouchInput.js +89 -0
  93. package/node_modules/@corellium/client-api/dist/model/Trial.js +112 -0
  94. package/node_modules/@corellium/client-api/dist/model/TrialExtension.js +124 -0
  95. package/node_modules/@corellium/client-api/dist/model/TrialRequestMetadata.js +146 -0
  96. package/node_modules/@corellium/client-api/dist/model/TrialRequestOptions.js +156 -0
  97. package/node_modules/@corellium/client-api/dist/model/UpdateExtension.js +89 -0
  98. package/node_modules/@corellium/client-api/dist/model/User.js +170 -0
  99. package/node_modules/@corellium/client-api/dist/model/UserError.js +65 -22
  100. package/node_modules/@corellium/client-api/dist/model/V1CreateHookParameters.js +179 -0
  101. package/node_modules/@corellium/client-api/dist/model/V1LoadExtensionParameters.js +116 -0
  102. package/node_modules/@corellium/client-api/dist/model/V1SetStateBody.js +50 -18
  103. package/node_modules/@corellium/client-api/dist/model/ValidationError.js +157 -0
  104. package/node_modules/@corellium/client-api/dist/model/VolumeOptions.js +42 -21
  105. package/node_modules/@corellium/client-api/dist/model/VpnDefinition.js +45 -23
  106. package/node_modules/@corellium/client-api/dist/model/WebPlayerCreateSessionRequest.js +171 -0
  107. package/node_modules/@corellium/client-api/dist/model/WebPlayerSession.js +142 -0
  108. package/node_modules/@corellium/client-api/package.json +1 -1
  109. package/package.json +2 -2
  110. package/renovate.json +96 -0
  111. package/src/commands/login.js +6 -4
  112. package/src/commands/mast/constants.js +1 -2
  113. package/src/commands/mast/create-assessment.js +2 -3
  114. package/src/commands/mast/delete-assessment.js +2 -3
  115. package/src/commands/mast/download-report.js +3 -4
  116. package/src/commands/mast/get-assessment.js +2 -3
  117. package/src/commands/mast/get-assessments.js +2 -3
  118. package/src/commands/mast/start-monitor.js +2 -3
  119. package/src/commands/mast/stop-monitor.js +2 -3
  120. package/src/commands/mast/test.js +2 -3
  121. package/src/commands/mast/api-base-path.js +0 -21
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
11
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
18
+ * Corellium API
19
+ * REST API to manage your virtual devices.
20
+ *
21
+ * The version of the OpenAPI document: 4.5.0-16775
22
+ *
23
+ *
24
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
25
+ * https://openapi-generator.tech
26
+ * Do not edit the class manually.
27
+ *
28
+ */
29
+ /**
30
+ * The WebPlayerSession model module.
31
+ * @module model/WebPlayerSession
32
+ * @version 0.3.2
33
+ */
34
+ var WebPlayerSession = /*#__PURE__*/function () {
35
+ /**
36
+ * Constructs a new <code>WebPlayerSession</code>.
37
+ *
38
+ * @alias module:model/WebPlayerSession
39
+ * @param identifier {String} New Session Identifier
40
+ * @param token {String} Session Token
41
+ * @param expiration {Number} Expiration in ISO-8601 format e.g. 2022-05-06T02:39:23.000Z
42
+ */
43
+ function WebPlayerSession(identifier, token, expiration) {
44
+ _classCallCheck(this, WebPlayerSession);
45
+ WebPlayerSession.initialize(this, identifier, token, expiration);
46
+ }
47
+
48
+ /**
49
+ * Initializes the fields of this object.
50
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
51
+ * Only for internal use.
52
+ */
53
+ _createClass(WebPlayerSession, null, [{
54
+ key: "initialize",
55
+ value: function initialize(obj, identifier, token, expiration) {
56
+ obj['identifier'] = identifier;
57
+ obj['token'] = token;
58
+ obj['expiration'] = expiration;
59
+ }
60
+
61
+ /**
62
+ * Constructs a <code>WebPlayerSession</code> from a plain JavaScript object, optionally creating a new instance.
63
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
64
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
65
+ * @param {module:model/WebPlayerSession} obj Optional instance to populate.
66
+ * @return {module:model/WebPlayerSession} The populated <code>WebPlayerSession</code> instance.
67
+ */
68
+ }, {
69
+ key: "constructFromObject",
70
+ value: function constructFromObject(data, obj) {
71
+ if (data) {
72
+ obj = obj || new WebPlayerSession();
73
+ if (data.hasOwnProperty('identifier')) {
74
+ obj['identifier'] = _ApiClient["default"].convertToType(data['identifier'], 'String');
75
+ }
76
+ if (data.hasOwnProperty('token')) {
77
+ obj['token'] = _ApiClient["default"].convertToType(data['token'], 'String');
78
+ }
79
+ if (data.hasOwnProperty('expiration')) {
80
+ obj['expiration'] = _ApiClient["default"].convertToType(data['expiration'], 'Number');
81
+ }
82
+ }
83
+ return obj;
84
+ }
85
+
86
+ /**
87
+ * Validates the JSON data with respect to <code>WebPlayerSession</code>.
88
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
89
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>WebPlayerSession</code>.
90
+ */
91
+ }, {
92
+ key: "validateJSON",
93
+ value: function validateJSON(data) {
94
+ // check to make sure all required properties are present in the JSON string
95
+ var _iterator = _createForOfIteratorHelper(WebPlayerSession.RequiredProperties),
96
+ _step;
97
+ try {
98
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
99
+ var property = _step.value;
100
+ if (!data[property]) {
101
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
102
+ }
103
+ }
104
+ // ensure the json data is a string
105
+ } catch (err) {
106
+ _iterator.e(err);
107
+ } finally {
108
+ _iterator.f();
109
+ }
110
+ if (data['identifier'] && !(typeof data['identifier'] === 'string' || data['identifier'] instanceof String)) {
111
+ throw new Error("Expected the field `identifier` to be a primitive type in the JSON string but got " + data['identifier']);
112
+ }
113
+ // ensure the json data is a string
114
+ if (data['token'] && !(typeof data['token'] === 'string' || data['token'] instanceof String)) {
115
+ throw new Error("Expected the field `token` to be a primitive type in the JSON string but got " + data['token']);
116
+ }
117
+ return true;
118
+ }
119
+ }]);
120
+ return WebPlayerSession;
121
+ }();
122
+ WebPlayerSession.RequiredProperties = ["identifier", "token", "expiration"];
123
+
124
+ /**
125
+ * New Session Identifier
126
+ * @member {String} identifier
127
+ */
128
+ WebPlayerSession.prototype['identifier'] = undefined;
129
+
130
+ /**
131
+ * Session Token
132
+ * @member {String} token
133
+ */
134
+ WebPlayerSession.prototype['token'] = undefined;
135
+
136
+ /**
137
+ * Expiration in ISO-8601 format e.g. 2022-05-06T02:39:23.000Z
138
+ * @member {Number} expiration
139
+ */
140
+ WebPlayerSession.prototype['expiration'] = undefined;
141
+ var _default = WebPlayerSession;
142
+ exports["default"] = _default;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corellium/client-api",
3
- "version": "0.1.0",
3
+ "version": "0.3.2",
4
4
  "description": "Corellium Client API",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corellium/corellium-cli",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Corellium CLI Tool",
5
5
  "scripts": {
6
6
  "corellium": "node index.js",
@@ -26,7 +26,7 @@
26
26
  "yargs"
27
27
  ],
28
28
  "dependencies": {
29
- "@corellium/client-api": "^0.1.0",
29
+ "@corellium/client-api": "^0.3.0",
30
30
  "@corellium/corellium-api": "^1.7.7",
31
31
  "axios": "^0.27.2",
32
32
  "chalk": "^4.1.2",
package/renovate.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ ":dependencyDashboard",
5
+ ":dependencyDashboardApproval",
6
+ ":semanticPrefixFixDepsChoreOthers",
7
+ ":ignoreModulesAndTests",
8
+ "replacements:all",
9
+ "workarounds:all",
10
+ "npm:unpublishSafe",
11
+ "group:datadog-browser-sdkMonorepo"
12
+ ],
13
+ "enabledManagers": [
14
+ "npm"
15
+ ],
16
+ "prConcurrentLimit": 5,
17
+ "labels": [
18
+ "renovate"
19
+ ],
20
+ "osvVulnerabilityAlerts": true,
21
+ "semanticCommits": "enabled",
22
+ "packageRules": [
23
+ {
24
+ "description": "node.js & npm shouldn't be updated automatically, they require manual updates in many places",
25
+ "matchDepNames": [
26
+ "node",
27
+ "npm"
28
+ ],
29
+ "enabled": false
30
+ },
31
+ {
32
+ "description": "Ignored",
33
+ "matchDepNames": [
34
+ "ts-node",
35
+ "@types/node",
36
+ "typescript"
37
+ ],
38
+ "matchPackagePatterns": [
39
+ "^@swc",
40
+ "^@typescript",
41
+ "^@commitlint"
42
+ ],
43
+ "enabled": false
44
+ },
45
+ {
46
+ "description": "Internal corellium packages major versions, immediately created, requires manual review/approve",
47
+ "groupName": "corellium-internal",
48
+ "dependencyDashboardApproval": false,
49
+ "addLabels": [
50
+ "corellium-internal-major"
51
+ ],
52
+ "matchPackagePatterns": [
53
+ "^@corellium"
54
+ ],
55
+ "matchUpdateTypes": [
56
+ "major"
57
+ ]
58
+ },
59
+ {
60
+ "description": "Internal corellium packages, minor/patch versions, immediately created, automatically merged",
61
+ "groupName": "corellium-internal",
62
+ "dependencyDashboardApproval": false,
63
+ "addLabels": [
64
+ "corellium-internal"
65
+ ],
66
+ "matchPackagePatterns": [
67
+ "^@corellium"
68
+ ],
69
+ "automerge": true,
70
+ "autoApprove": true,
71
+ "matchUpdateTypes": [
72
+ "minor",
73
+ "patch"
74
+ ]
75
+ },
76
+ {
77
+ "matchPackageNames": ["sinon"],
78
+ "allowedVersions": "<17.0.0"
79
+ },
80
+ {
81
+ "description": "higher versions drop node 16 support",
82
+ "matchPackageNames": ["husky", "eslint"],
83
+ "allowedVersions": "<9.0.0"
84
+ },
85
+ {
86
+ "description": "higher versions drop node 16 support",
87
+ "matchPackageNames": ["node-fetch"],
88
+ "allowedVersions": "<3.0.0"
89
+ },
90
+ {
91
+ "description": "higher versions drop node 16 support",
92
+ "matchPackageNames": ["file-type"],
93
+ "allowedVersions": "<19.0.0"
94
+ }
95
+ ]
96
+ }
@@ -61,19 +61,21 @@ async function handler (argv) {
61
61
  })).password
62
62
  }
63
63
 
64
+ const sanitizedEndpoint = endpoint.slice(-1) === '/' ? endpoint.slice(0, -1) : endpoint
65
+
64
66
  // We need a special agent just for login because we can't assume profile has been written yet
65
- const CACert = await getCACert({ endpoint })
67
+ const CACert = await getCACert({ endpoint: sanitizedEndpoint })
66
68
  axios.defaults.httpsAgent = new https.Agent({ ca: CACert })
67
69
 
68
70
  try {
69
71
  let data
70
72
 
71
73
  if (apitoken) {
72
- data = (await axios.post(`${endpoint}/api/v1/tokens`, { apiToken: apitoken })).data
74
+ data = (await axios.post(`${sanitizedEndpoint}/api/v1/tokens`, { apiToken: apitoken })).data
73
75
  } else {
74
- data = (await axios.post(`${endpoint}/api/v1/tokens`, { username, password })).data
76
+ data = (await axios.post(`${sanitizedEndpoint}/api/v1/tokens`, { username, password })).data
75
77
  }
76
- await updateProfile({ token: data.token, expiration: data.expiration, endpoint })
78
+ await updateProfile({ token: data.token, expiration: data.expiration, endpoint: sanitizedEndpoint })
77
79
  console.log(
78
80
  chalk.green(`Login successful, profile saved to ${profilePath}`)
79
81
  )
@@ -1,4 +1,3 @@
1
1
  module.exports = {
2
- MAST_API_BASE_PATH: 'v1/services/matrix',
3
- MAST_API_BASE_PATH_LEGACY: 'v1/services/mast' // CORE-7670
2
+ MAST_API_BASE_PATH: 'v1/services/mast'
4
3
  }
@@ -1,6 +1,6 @@
1
1
  const Client = require('../../clients/Client')
2
2
  const { handleError } = require('../../error')
3
- const { getMastApiBasePath } = require('./api-base-path')
3
+ const { MAST_API_BASE_PATH } = require('./constants')
4
4
 
5
5
  /**
6
6
  * Create an assessment via corellium-mast API.
@@ -42,8 +42,7 @@ 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 API_BASE_PATH = await getMastApiBasePath(client, instance)
46
- const res = await client._fetch('POST', `${API_BASE_PATH}/${instance}/assessments`, body)
45
+ const res = await client._fetch('POST', `${MAST_API_BASE_PATH}/${instance}/assessments`, body)
47
46
  console.log(JSON.stringify(res))
48
47
  } catch (error) {
49
48
  handleError(error, 'create-assessment failed', verbose)
@@ -1,7 +1,7 @@
1
1
  const Client = require('../../clients/Client')
2
2
  const { handleError } = require('../../error')
3
3
  const log = require('../../logging')
4
- const { getMastApiBasePath } = require('./api-base-path')
4
+ const { MAST_API_BASE_PATH } = require('./constants')
5
5
 
6
6
  /**
7
7
  * Delete an assessment via corellium-mast API.
@@ -35,8 +35,7 @@ async function handler (argv) {
35
35
  const { assessment, instance, verbose } = argv
36
36
  const client = new Client(argv)
37
37
  try {
38
- const API_BASE_PATH = await getMastApiBasePath(client, instance)
39
- await client._fetch('DELETE', `${API_BASE_PATH}/${instance}/assessments/${assessment}`)
38
+ await client._fetch('DELETE', `${MAST_API_BASE_PATH}/${instance}/assessments/${assessment}`)
40
39
  log.info('Assessment deleted.')
41
40
  } catch (error) {
42
41
  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 { getMastApiBasePath } = require('./api-base-path')
3
+ const { MAST_API_BASE_PATH } = require('./constants')
4
4
 
5
5
  /**
6
6
  * Download assessment report via corellium-mast API.
@@ -43,9 +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 API_BASE_PATH = await getMastApiBasePath(client, instance)
47
- const res = await client._fetch('GET', `${API_BASE_PATH}/${instance}/assessments/${assessment}/download?format=${format}`)
48
- console.log(res)
46
+ const res = await client._fetch('GET', `${MAST_API_BASE_PATH}/${instance}/assessments/${assessment}/download?format=${format}`)
47
+ console.log(format === 'json' ? JSON.stringify(res, null, 2) : res) // print deep json
49
48
  } catch (error) {
50
49
  handleError(error, 'download-report failed', verbose)
51
50
  }
@@ -1,6 +1,6 @@
1
1
  const Client = require('../../clients/Client')
2
2
  const { handleError } = require('../../error')
3
- const { getMastApiBasePath } = require('./api-base-path')
3
+ const { MAST_API_BASE_PATH } = require('./constants')
4
4
 
5
5
  /**
6
6
  * Get an assessment via corellium-mast API.
@@ -36,8 +36,7 @@ async function handler (argv) {
36
36
  const { assessment, instance, verbose } = argv
37
37
  const client = new Client(argv)
38
38
  try {
39
- const API_BASE_PATH = await getMastApiBasePath(client, instance)
40
- const res = await client._fetch('GET', `${API_BASE_PATH}/${instance}/assessments/${assessment}`)
39
+ const res = await client._fetch('GET', `${MAST_API_BASE_PATH}/${instance}/assessments/${assessment}`)
41
40
  console.log(JSON.stringify(res))
42
41
  } catch (error) {
43
42
  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 { getMastApiBasePath } = require('./api-base-path')
3
+ const { MAST_API_BASE_PATH } = require('./constants')
4
4
 
5
5
  /**
6
6
  * Get assessments for an instance via corellium-mast API.
@@ -29,8 +29,7 @@ async function handler (argv) {
29
29
  const { instance, verbose } = argv
30
30
  const client = new Client(argv)
31
31
  try {
32
- const API_BASE_PATH = await getMastApiBasePath(client, instance)
33
- const res = await client._fetch('GET', `${API_BASE_PATH}/${instance}/instances/${instance}/assessments`)
32
+ const res = await client._fetch('GET', `${MAST_API_BASE_PATH}/${instance}/instances/${instance}/assessments`)
34
33
  console.log(JSON.stringify(res))
35
34
  } catch (error) {
36
35
  handleError(error, 'get-assessments failed', verbose)
@@ -1,7 +1,7 @@
1
1
  const Client = require('../../clients/Client')
2
2
  const { handleError } = require('../../error')
3
3
  const log = require('../../logging')
4
- const { getMastApiBasePath } = require('./api-base-path')
4
+ const { MAST_API_BASE_PATH } = require('./constants')
5
5
 
6
6
  /**
7
7
  * The start-monitor command starts device monitoring via the start-monitor API on corellium-mast
@@ -37,8 +37,7 @@ async function handler (argv) {
37
37
  const { assessment, instance, verbose } = argv
38
38
  const client = new Client(argv)
39
39
  try {
40
- const API_BASE_PATH = await getMastApiBasePath(client, instance)
41
- await client._fetch('POST', `${API_BASE_PATH}/${instance}/assessments/${assessment}/start`)
40
+ await client._fetch('POST', `${MAST_API_BASE_PATH}/${instance}/assessments/${assessment}/start`)
42
41
  log.info('Monitoring started.')
43
42
  } catch (error) {
44
43
  handleError(error, 'start-monitor failed', verbose)
@@ -1,7 +1,7 @@
1
1
  const Client = require('../../clients/Client')
2
2
  const { handleError } = require('../../error')
3
3
  const log = require('../../logging')
4
- const { getMastApiBasePath } = require('./api-base-path')
4
+ const { MAST_API_BASE_PATH } = require('./constants')
5
5
 
6
6
  /**
7
7
  * The stop-monitor command stops device monitoring via the stop-monitor API on corellium-mast.
@@ -37,8 +37,7 @@ async function handler (argv) {
37
37
  const { assessment, instance, verbose } = argv
38
38
  const client = new Client(argv)
39
39
  try {
40
- const API_BASE_PATH = await getMastApiBasePath(client, instance)
41
- await client._fetch('POST', `${API_BASE_PATH}/${instance}/assessments/${assessment}/stop`)
40
+ await client._fetch('POST', `${MAST_API_BASE_PATH}/${instance}/assessments/${assessment}/stop`)
42
41
  log.info('Monitoring stopped.')
43
42
  } catch (error) {
44
43
  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 { getMastApiBasePath } = require('./api-base-path')
3
+ const { MAST_API_BASE_PATH } = require('./constants')
4
4
 
5
5
  /**
6
6
  * The test command executes device testing via the test API on corellium-mast.
@@ -47,8 +47,7 @@ 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 API_BASE_PATH = await getMastApiBasePath(client, instance)
51
- const res = await client._fetch('POST', `${API_BASE_PATH}/${instance}/assessments/${assessment}/test`, { grep, invert })
50
+ const res = await client._fetch('POST', `${MAST_API_BASE_PATH}/${instance}/assessments/${assessment}/test`, { grep, invert })
52
51
  console.log(JSON.stringify(res))
53
52
  } catch (error) {
54
53
  handleError(error, 'test failed', verbose)
@@ -1,21 +0,0 @@
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 }