Table of Contents

Certain menus are only accessible by holding multiple hardware buttons down for a certain amount of time.

You can do this using the Corellium API with just a few lines of JavaScript.


Code Example

The following script holds down your Corellium device's virtual Power and Volume Up buttons for three seconds.

const { Corellium } = require("@corellium/corellium-api");
const { Input } =
require('/Users/<YOUR_MACOS_USERNAME_GOES_HERE>/node_modules/@corellium/corellium-api/src/input.js');

const corellium = new Corellium({
endpoint:'https://app.corellium.com',
apiToken: '<YOUR_API_TOKEN_GOES_HERE>'
});

async function main() {
await corellium.login();

let project = await corellium.projectNamed('Default Project');
let instance = await project.getInstance('<YOUR_INSTANCE_ID_GOES_HERE>');

await instance.sendInput(new Input().press('power','volume-up').delay(3000).release('power','volume-up'));

return;
}

main().catch((err) => {
console.error(err);
});


How to Execute the Code

  1. Create a new device. For our example, we use a Generic Android running 12.0.0.

  2. If applicable, install Node.js and the Corellium API package.

    brew install node
    npm install @corellium/corellium-api

  3. Copy the code above and save it to a file on your computer. For our example, we will use ~/Desktop/multiPressAPIExample.js.

  4. Adjust the const { Input } line to match your computer. Find the path using the following code.

    ls -R / 2>/dev/null | grep "@corellium/corellium-api:"

  5. Adjust the endpoint: line for your Corellium domain (e.g. 'https://<YOUR__ENTERPRISE_DOMAIN>.enterprise.corellium.com' or 'https://app.corellium.com'). Find your domain in your browser URL or by using the Project.instances() method.

  6. Adjust the apiToken: line to match your Corellium API token, which you can find by logging into your account and navigating to PROFILE then API. (You may have to click GENERATE.)

  7. Adjust the let instance line to your instance identifier, which you can find in the browser URL for your device or by using the Project.instances() method. In our example, the Instance ID is 77053f8b-8c69-4eaf-983d-4734c12509b6.

    https://app.corellium.com/devices/77053f8b-8c69-4eaf-983d-4734c12509b6/connect

  8. Execute the JavaScript code in Terminal.

    node ~/Desktop/multiPressAPIExample.js

  9. You should see the Power menu appear on the device.

Did this answer your question?