Project

Project

Instances of this class are returned from Corellium#projects, Corellium#getProject, and Corellium#projectNamed. They should not be created using the constructor.

Members

name

Source:

The project's name.

Example
project.name();

quotas

Source:

The project quotas.

Example
// Create map of supported devices.
let supported = {};
(await corellium.supported()).forEach(modelInfo => {
    supported[modelInfo.name] = modelInfo;
});

// Get how many CPUs we're currently using.
let cpusUsed = 0;
instances.forEach(instance => {
    cpusUsed += supported[instance.flavor].quotas.cpus;
});

console.log('Used: ' + cpusUsed + '/' + project.quotas.cpus);

quotasUsed

Source:
Properties:
Name Type Description
cores number

Number of used CPU cores

How much of the project's quotas are currently used. To ensure this information is up to date, call Project#refresh() first.

Example
project.quotasUsed();

Methods

(async) addKey(key, kind, labelopt) → {Promise.<ProjectKey>}

Source:

Add a public key to project.

Example
project.addKey(key, 'ssh', 'SSH Key');
Parameters:
Name Type Attributes Default Description
key string

the public key, as formatted in a .pub file

kind 'ssh' | 'adb' ssh
label string <optional>
null

defaults to the public key comment, if present

Returns:
Type
Promise.<ProjectKey>

(async) createInstance(options) → {Promise.<Instance>}

Source:

Creates an instance and returns the Instance object. The options are passed directly to the API.

Example

Creating an instance and waiting for it to start its first boot

const instance = await project.createInstance({
    flavor: 'iphone6',
    os: '11.3',
    name: 'Test Device',
    osbuild: '15E216',
    patches: 'corelliumd',
    bootOptions: {
        udid: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
    },
});
await instance.finishRestore();
Parameters:
Name Type Description
options Object

The options for instance creation. These are the same as the JSON options passed to the instance creation API endpoint. For a full list of possible options, see the API documentation.

Properties
Name Type Attributes Description
flavor string

The device flavor, such as iphone6

os string

The device operating system version

ipsw string

The ID of a previously uploaded image in the project to use as the firmware

osbuild string

The device operating system build

name string <optional>

The device name

patches string <optional>

Instance patches, such as jailbroken (default), nonjailbroken or corelliumd which is non-jailbroken with API agent.

bootOptions Object <optional>

Boot options for the instance

Properties
Name Type Attributes Description
kernelSlide string <optional>

Change the Kernel slide value for an iOS device. When not set, the slide will default to zero. When set to an empty value, the slide will be randomized.

udid string <optional>

Predefined Unique Device ID (UDID) for iOS device

screen string <optional>

Change the screen metrics for Ranchu devices XxY[:DPI], e.g. 720x1280:280

additionalTags Array.<string> <optional>

Addition features to utilize for the device, valid options include:
kalloc : Enable kalloc/kfree trace access via GDB (Enterprise only)
gpu : Enable cloud GPU acceleration (Extra costs incurred, cloud only)

Returns:
Type
Promise.<Instance>

(async) createRole(grantee, type)

Source:

Give permissions to this project for a Team or a User (adds a Role).

This function is only available to domain and project administrators.

Example
project.createRole(grantee, 'user');
Parameters:
Name Type Default Description
grantee User | Team

must be an instance of User or Team

type string user

user ID

(async) deleteKey(keyId)

Source:

Delete public key from the project

Example
project.deleteKey('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
Parameters:
Name Type Description
keyId string

(async) destroy()

Source:

Destroy this project.

Example
project.destroy();

(async) getInstance(id) → {Promise.<Instance>}

Source:

Returns the Instance with the given ID.

Example
await project.getInstance('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
Parameters:
Name Type Description
id string
Returns:
Type
Promise.<Instance>

(async) getToken() → {string}

Source:

Returns refreshed authentication token

Example
let token = await project.getToken()
Returns:

token

Type
string

(async) instances() → {Promise.<Array.<Instance>>}

Source:

Returns an array of the Instances in this project.

Example

Finding the first instance with a given name

const instances = await project.instances();
const instance = instances.find(instance => instance.name === 'Test Device');
Returns:

The instances in this project

Type
Promise.<Array.<Instance>>

(async) keys() → {Promise.<Array.<ProjectKey>>}

Source:

Returns a list of authorized keys associated with the project. When a new instance is created in this project, its authorized_keys (iOS) or adbkeys (Android) will be populated with these keys by default. Adding or removing keys from the project will have no effect on existing instances.

Example
let keys = project.keys();
for(let key of keys)
  console.log(key);
Returns:
Type
Promise.<Array.<ProjectKey>>

(async) refresh()

Source:

Reload the project info. This currently consists of name and quotas, but will likely include more in the future.

Example
project.refresh();

(async) roles() → {Array.<Role>}

Source:

Returns a list of Roles associated with this project, showing who has permissions over this project.

This function is only available to domain and project administrators.

Example
await project.roles();
Returns:
Type
Array.<Role>

(async) setQuotas(quotas)

Source:

Sets the project quotas. Only the cores property is currently respected.

Parameters:
Name Type Description
quotas ProjectQuotas

(async) uploadImage(id, type, path, name, progressopt) → {Promise.<ProjectKey>}

Source:

Add an image to the project. These images may be removed at any time and are meant to facilitate creating a new Instance with images.

Parameters:
Name Type Attributes Description
id string

UUID of the image to create. Required to be universally unique but can be user-provided. You may resume uploads if you provide the same UUID.

type string

E.g. fw for the main firmware image.

path string

The path on the local file system to get the file.

name string

The name of the file to identify the file on the server. Usually the basename of the path.

progress Project~progressCallback <optional>

The callback for file upload progress information.

Returns:
Type
Promise.<ProjectKey>

(async) vpnConfig(type, clientUUID) → {Promise.<Buffer>}

Source:

Get the VPN configuration to connect to the project network. This is only available for cloud. At least one instance must be on in the project.

Example
await project.vpnConfig('ovpn', undefined)
Parameters:
Name Type Default Description
type string ovpn

Could be either "ovpn" or "tblk" to select between OpenVPN and TunnelBlick configuration formats. TunnelBlick files are delivered as a ZIP file and OpenVPN configuration is just a text file.

clientUUID string

An arbitrary UUID to uniquely associate this VPN configuration with so it can be later identified in a list of connected clients. Optional.

Returns:
Type
Promise.<Buffer>