Skip to main content

Simple API Example

This article demonstrates the steps required to run an API Example that completes the following:

  1. Logs in to Corellium.
  2. Retrieves the available projects on that account.
  3. Retrieves the available instances on the desired project.
  4. Creates a new instance of a virtual device.
  5. Uploads a custom kernel to that virtual device.
  6. Takes a snapshot of that virtual device.

Check out the Corellium API Documentation for a list of supported flavors and more.

Setting Up

There are two ways to get set up for this tutorial. You can either:

  1. Clone the entire Corellium-API GitHub Repository and run the example within your cloned repository.

  2. Or, you can clone the device_example folder and run the example on its own.

You will also need a device tree file to upload to your device. If you don't have one handy, install our example file, and put it in the corellium-api/examples/device_example subdirectory.

Tutorial

  1. Run the following command inside the device_example directory:
npm install @corellium/corellium-api
  1. Now, in main.js replace the values assigned to the myEndPoint, myUserName, myPassword, and myProject variables with your own account credentials and project name.

account credentials

  1. Optionally, you can replace the values in myDeviceName, myFlavor, and myOS. Currently, the example creates a ranchu (Generic Android) device named API Android with the 11.0.0 OS.

optional vars

  1. Optionally, if you would like to upload a different image, edit myFirmware and myFirmwarePath.

optional firmware

  1. If you would like to upload a different type of image, such as a kernel choose a different upload function.

upload function

  1. Run the example by entering the following command into your command line
node main.js.
  1. Check your console to see the output.

output

Note: if you haven't named your devices, the example will return "Found instance named null" as seen above.

Next Steps