{"id":13464140,"url":"https://github.com/corellium/corellium-api","last_synced_at":"2025-04-04T18:05:36.489Z","repository":{"id":34420907,"uuid":"178949104","full_name":"corellium/corellium-api","owner":"corellium","description":"Integration and automation API for Corellium","archived":false,"fork":false,"pushed_at":"2024-11-21T20:39:40.000Z","size":49407,"stargazers_count":74,"open_issues_count":5,"forks_count":16,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-28T17:05:43.053Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://corellium.github.io/corellium-api/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/corellium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-01T21:23:29.000Z","updated_at":"2024-11-21T20:39:43.000Z","dependencies_parsed_at":"2023-02-17T22:45:39.311Z","dependency_job_id":"10c647d5-f6fe-4f46-84b1-0cc94c4e9892","html_url":"https://github.com/corellium/corellium-api","commit_stats":{"total_commits":322,"total_committers":23,"mean_commits":14.0,"dds":0.7577639751552795,"last_synced_commit":"23a62ba5a672730ab6e6c93975526bf6ac307b20"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corellium%2Fcorellium-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corellium%2Fcorellium-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corellium%2Fcorellium-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corellium%2Fcorellium-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corellium","download_url":"https://codeload.github.com/corellium/corellium-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226213,"owners_count":20904465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T14:00:35.160Z","updated_at":"2025-04-04T18:05:36.467Z","avatar_url":"https://github.com/corellium.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Corellium API\n\n## Reference\n\nCorellium API reference documentation is available [here](https://corellium.github.io/corellium-api/index.html).\n\n## Overview\n\n### Installation\n```shell=\nnpm install @corellium/corellium-api\n```\n\n### Publishing\nTo publish the corellium-api npm package to the GitLab registry, create a tag with the format\n```\nv#.#.#\n```\n\nTo publish to the official Corellium npm registry, create a tag with the format\n```\nrelease/v#.#.#\n```\nThis will publish the package in the GitLab registry, the npm registry, as well as create a release in the mirrored GitHub repository\n\n### Usage\n```javascript=\nconst { Corellium } = require(\"@corellium/corellium-api\");\n```\n\n#### Onsite Customer Usage\n\nIf you're using an on-site appliance rather than our cloud product, there may be a few things that are different. Check with your domain administrator to see if the appliance was set up to use a trusted custom certificate that you machine accepts. If it has not been, you will need to accepted the custom certificate that is generated on install by Corellium. Since this certificate will not be known to a local machine you will either need to export it from the server and trust it, or simply tell the node.js vm that you can safely ignore the certificate chain error.\n\nThe easiest way to ignore the certificate is to pass the flag `NODE_TLS_REJECT_UNAUTHORIZED=0` to the scripts you are running.\n\n```shell=\nmkdir test\ncd test\nnpm install @corellium/corellium-api\nwget https://github.com/corellium/corellium-api/blob/master/examples/agent-simple.js\n\u003cedit agent-simple.js for your local config\u003e\nenv NODE_TLS_REJECT_UNAUTHORIZED=0 node agent-simple.js\n```\n\n## class Corellium\n\n### new Corellium(options)\n\nSets up a new Corellium endpoint to use. Accepted options are:\n\n- `options.endpoint`: the URL of the endpoint to use\n\n### Include one of the following methods of authentication:\n\n#### Username / Password Credentials\n- `options.username`: username to use for login\n- `options.password`: password for given username\n#### API Token\n- `options.apiToken`: user's API token\n#### JWT\n- `options.token`: user's JWT\n```javascript=\noptions.token = {\n    token: 'eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9...', // JWT\n    expiration: '2022-10-21T21:16:53.000Z', \n}\n```\n#### TOTP\n- `options.totpToken`: Timebased One Time Password Token for a given username\n\nExample:\n\n```javascript=\nlet corellium = new Corellium({\n    endpoint: 'https://app.corellium.com',\n    username: 'username',\n    password: 'password',\n    totpToken: '12345',\n});\n```\n\n### async login()\n\nPerforms the login on the endpoint using the credentials passed through the constructor.\n\nExample:\n\n```javascript=\nawait corellium.login();\n```\n\n### async projects()\n\nReturns all projects from the connected endpoint as an `Array`.\n\nExample:\n\n```javascript=\nlet projects = await corellium.projects();\nlet project = projects.find(project =\u003e project.name === \"Demo Project\");\n```\n\nLine 2 shows how to pick a specific project from the returned map.\n\n### async getProject(projectId)\n\nReturns the `Project` with the identifier `projectId` or _undefined_ if it does not exist.\n\nExample:\n\n```javascript=\nlet project = await corellium.getProject('b5ef6be5-71a9-4a26-a320-9be182217ac8');\n```\n\n### async projectNamed(name)\n\nReturns the `Project` with the name `name` or _undefined_ if it does not exist.\n\nExample:\n\n```javascript=\nlet project = await corellium.projectNamed('Default Project');\n```\n\n### async supported()\n\nReturns an `Array` with all devices that are supported by the endpoint, with their supported firmwares.\n\nExample:\n\n```javascript=\nlet supported = await corellium.supported();\n```\n\n## class Project\n\n**Note:** Instances of the class `Project` are supposed to be created using the `Corellium#projects()`, `Corellium#getProject()`, or `Corellium#projectNamed()` methods.\n\n### Property: name\n\nReturns the name of the project.\n\nExample:\n\n```javascript=\nlet name = project.name;\n```\n\n### Property: quotas\n\nReturns the quotas of the project. Currently, `quotas`' only element is `cpus`.\n\nExample:\n\n```javascript=\n// Create map of supported devices.\nlet supported = {};\n(await corellium.supported()).forEach(modelInfo =\u003e {\n    supported[modelInfo.name] = modelInfo;\n});\n\n// Get how many CPUs we're currently using.\nlet cpusUsed = 0;\ninstances.forEach(instance =\u003e {\n    cpusUsed += supported[instance.flavor].quotas.cpus;\n});\n\nconsole.log('Used: ' + cpusUsed + '/' + project.quotas.cpus);\n```\n\n### async instances()\n\nReturns an `Array` of `Instance` objects of all virtual machine instances.\n\nExample:\n\n```javascript=\nlet instances = await project.instances();\nlet instance = instances.find(instance =\u003e instance.name === 'Test-Device');\n```\n\nLine 2 shows how to select a specific instance by name from the returned instances.\n\n### async getInstance(id)\n\nReturns the instance identified by `id`.\n\nExample:\n\n```javascript=\nlet instance = project.getInstance('a9212122-40b0-1387-7feb-7a721916580d');\n```\n\n### async createInstance(options)\n\nCreates a new instance with the given options. The following options are supported:\n\n- `options.name`: The name of the new Instance.\n- `options.flavor`: The flavor of the `Instance` that is being created.\n  - The following flavors are supported for Android:\n    - `ranchu` (for Generic Android devices)\n    - The following Android devices are \"frames\" which will change the screen size and dpi\n      - `google-nexus-4`\n      - `google-nexus-5`\n      - `google-nexus-5x`\n      - `google-nexus-6`\n      - `google-nexus-6p`\n      - `google-nexus-9`\n      - `google-pixel`\n      - `google-pixel-2`\n      - `google-pixel-3`\n      - `htc-one-m8`\n      - `huawei-p8`\n  - The following flavors are supported for iOS:\n    - `iphone6`\n    - `iphone6plus`\n    - `ipodtouch6`\n    - `ipadmini4wifi`\n    - `iphone6s`\n    - `iphone6splus`\n    - `iphonese`\n    - `iphone7`\n    - `iphone7plus`\n    - `iphone8`\n    - `iphone8plus`\n    - `iphonex`\n    - `iphonexs`\n    - `iphonexsmax`\n    - `iphonexsmaxww`\n    - `iphonexr`\n    - `iphone11`\n    - `iphone11pro`\n    - `iphone11promax`\n    - `iphonese2`\n    - `iphone12m`\n    - `iphone12`\n    - `iphone12p`\n    - `iphone12pm`\n    - `iphone13`\n    - `iphone13m`\n    - `iphone13p`\n    - `iphone13pm`\n- `options.os`: The software version, e.g. `14.3` for iOS, or `11.0.0` for Android\n- `options.patches`: The following values are supported:\n  - `jailbroken` The instance should be jailbroken (default).\n  - `nonjailbroken` The instance should not be jailbroken.\n  - `corelliumd` The instance should not be jailbroken but should profile API agent.\n- `options.bootOptions`: Various boot options\n  - `options.bootOptions.kernelSlide`: 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.\n  - `options.bootOptions.udid`: Predefined Unique Device ID (UDID) for iOS device\n  - `options.bootOptions.screen`: Change the screen metrics for Ranchu devices `XxY[:DPI]`, e.g. `720x1280:280`\n  - `options.bootOptions.additionalTags[]`: An array of addition features to utilize for the device, valid options include\n    - `kalloc`: Enable kalloc/kfree trace access via GDB (Enterprise only)\n    - `gpu`: Enable cloud GPU acceleration (Extra costs incurred, cloud only)\n    - `no-keyboard` : Enable keyboard passthrough from web interface\n    - `nodevmode` : Disable developer mode on iOS16 (and greater)\n    - `sep-cons-ext` : Patch SEPOS to print debug messages to console\n    - `iboot-jailbreak` : Patch iBoot to disable signature checks\n    - `llb-jailbreak` : Patch LLB to disable signature checks\n    - `rom-jailbreak` : Patch BootROM to disable signature checks  \n  - `options.bootOptions.kernel`: Custom kernel to pass to the device on creation\n  - `options.bootOptions.vmmio[]`: Paremeters to export a VM address space range (and IRQ \u0026 DMA functionality) over TCP to different models running on different machines or inside a different VM\n    - `start`: start address for beginning of vMMIO range\n    - `size`: size of the range to use for vMMIO\n    - `irq`: system IRQs, 1-16 ranges must be specified\n    - `port`: tcp port for vMMIO usage\n\n#### Example:\n\n```javascript=\n// create instance\nlet instance = await project.createInstance({\n    'name': 'Test Device',\n    'flavor': 'ranchu',\n    'os': '11.0.0',\n    'bootOptions': {\n        'screen': '720x1280:280',\n    },\n});\n// wait for the instance to finish restoring\nawait instance.finishRestore();\n```\n\n#### Example: Handling Firmware Assets\n\n```\n❯ node myscript.js\nError: This instance requires additional firmware assets. To automatically download firmware assets and associate them\nwith your domain, set the environment variable FETCH_FIRMWARE_ASSETS=1\n```\n\nSome recent firmwares require additional files that must be downloaded by the api client and associated with your domain.\nThe Corellium API can download these resources and associated them with your domain. To enable automatic download, set\nthe environment variable `FETCH_FIRMWARE_ASSETS=1`.\n\n```\n❯ env FETCH_FIRMWARE_ASSETS=1 node myscript.js\nCreating ios device...\nCreated 741d5b9c-01dd-4878-b16f-8d6aa513c9c4\n```\n\n## class Instance\n\n**Note:** instances of class `Instance` are only supposed to be retrieved by `Project#instances()`, `Project#getInstance()`, or `Project#createInstance`.\n\n### Property: name\n\nThe name of the instance.\n\nExample:\n\n```javascript=\nlet instances = await project.instances();\nlet instance = instances[0];\nconsole.log(\"Using \" + instance.name);\n```\n\n### Property: state\n\nReturns the state of the `Instance`.\n\nValid states are:\n\n- `on`: The `Instance` is running.\n- `off`: The `Instance` is not running.\n- `creating`: The `Instance` is being created.\n- `deleting`: The `Instance` is being deleted.\n\nExample:\n\n```javascript=\nawait instance.start();\nawait instance.waitForState('on');\nassert.equal(instance.state, 'on');\n```\n\nSee also: `Instance.waitForState()`\n\n### Property: flavor\n\nReturns the flavor of the `Instance`.\n\nExample:\n\n```javascript=\nlet instances = await project.instances();\ninstances.forEach(instance =\u003e {\n    console.log(instance.name + ': ' + instance.flavor);\n});\n```\n\n### async rename(name)\n\nRenames an `Instance` to `name`.\n\nExample:\n\n```javascript=\nlet instances = await project.instances();\nlet instance = instances.find(instance =\u003e instance.name === 'Test-Device');\nawait instance.rename('Demo-Device');\n```\n\n### async modifyPeripherals(peripheralData)\n\nModify the a `PeripheralData` object for the current `Instance`. This is the peripheral/sensor\ndata which is sent to the device hardware.\n\nCurrently only supported for Android devices.\n\nExample:\n\n```javascript=\nconst instances = await project.instances();\nconst instance = instances.find(instance =\u003e instance.name == 'foo');\nawait instance.modifyPeripherals({\n    \"gpsToffs\": \"0.000000\",\n    \"gpsLat\": \"37.414300\",\n    \"gpsLon\": \"-122.077400\",\n    \"gpsAlt\": \"45.000000\",\n    \"acOnline\": \"1\",\n    \"batteryPresent\": \"1\",\n    \"batteryStatus\": \"discharging\",\n    \"batteryHealth\": \"overheat\",\n    \"batteryCapacity\": \"99.000000\",\n    \"acceleration\": \"0.000000,9.810000,0.000000\",\n    \"gyroscope\": \"0.000000,0.000000,0.000000\",\n    \"magnetic\": \"0.000000,45.000000,0.000000\",\n    \"orientation\": \"0.000000,0.000000,0.000000\",\n    \"temperature\": \"25.000000\",\n    \"proximity\": \"50.000000\",\n    \"light\": \"20.000000\",\n    \"pressure\": \"1013.250000\",\n    \"humidity\": \"55.000000\"\n }));\n```\n\n### async getPeripherals()\n\nReturn a `Promise` of a `PeripheralData` object for the current `Instance`.\n\nExample:\n\n```javascript=\nlet peripherals = await instance.getPeripherals();\nconsole.log(peripherals);\n```\n\n### async snapshots()\n\nReturns an `Array` of `Snapshot` objects with the snapshots for the current `Instance`.\n\nExample:\n\n```javascript=\nlet snapshots = instance.snapshots();\nsnapshots.forEach(snapshot =\u003e {\n    console.log(snapshot.name, snapshot.created);\n});\n```\n\n### async takeSnapshot(name)\n\nCreates a snapshot named `name` of an `Instance`. Returns an instance of `Snapshot`.\n\nExample:\n\n```javascript=\nawait instance.takeSnapshot('before-test');\n```\n\n### async consoleLog()\n\nReturns the current console log of an `Instance`.\n\nExample:\n\n```javascript=\nconsole.log(await instance.consoleLog());\n```\n\n### async panics()\n\nReturns recorded panics of an `Instance`.\n\nExample:\n\n```javascript=\nconsole.log(await instance.panics());\n```\n\nSee also: `Event: panic`\n\n### async clearPanics()\n\nClears recorded panics of an `Instance`.\n\nExample:\n\n```javascript=\nawait instance.clearPanics();\n```\n\nSee also: `Event: panic`\n\n### async agent()\n\nReturns an `Agent` instance for the `Instance`.\n\nExample:\n\n```javascript=\nlet agent = await instance.agent();\nawait agent.ready();\n```\n\n### async newAgent()\n\nCreates an additional `Agent` connection to the `Instance`. This is required for agent tasks that do not actually finish, like `Agent#crashes()`.\n\nExample:\n\n```javascript=\nlet crashListener = await instance.newAgent();\ncrashListener.crashes('com.corellium.demoapp', (err, crashReport) =\u003e {\n    if (err) {\n        console.error(err);\n        return;\n    }\n    console.log(crashReport);\n});\n```\n\n### async console()\n\nReturns a node stream for the `Instance`'s console.\n\nExample:\n\n```javascript=\nlet consoleStream = await instance.console();\nconsoleStream.pipe(process.stdout);\n```\n\n### async start()\n\nStarts an `Instance`.\n\nExample:\n\n```javascript=\nawait instance.start();\n```\n\n### async stop()\n\nStops an `Instance`.\n\nExample:\n\n```javascript=\nawait instance.stop();\n```\n\n### async reboot()\n\nReboots an `Instance`.\n\nExample:\n\n```javascript=\nawait instance.reboot();\n```\n\n### async destroy()\n\nDestroys an `Instance`.\n\nExample:\n\n```javascript=\n// delete all instances of the project\nlet instances = await project.instances();\ninstances.forEach(instance =\u003e {\n    instance.destroy();\n});\n```\n\n### async getCoreTraceThreadList()\n\nReturns array of threads in the following format:\n\n```\n[\n\t{ pid, kernelId, name, threads: [ { tid, kernelId }, ... ] },\n\t...\n]\n```\n\nExample:\n\n```javascript=\nlet procList = await instance.getCoreTraceThreadList();\nfor (let p of procList) {\n\tconsole.log(p.pid, p.kernelId, p.name);\n\tfor (let t of p.threads) {\n\t\tconsole.log(t.tid, t.kernelId);\n\t}\n}\n```\n\n### async setCoreTraceFilter(pids, names, tids)\n\nCreates CoreTrace filter from array of PIDs, TIDs and process names.\n\nExample:\n\n```javascript=\nawait instance.setCoreTraceFilter([111, 222], [\"proc_name\"], [333]);\n```\n\n### async clearCoreTraceFilter()\n\nClears CoreTrace filter.\n\nExample:\n\n```javascript=\nawait instance.clearCoreTraceFilter();\n```\n\n### async startCoreTrace()\n\nStarts CoreTrace capture.\n\nExample:\n\n```javascript=\nawait instance.startCoreTrace();\n```\n\n### async stopCoreTrace()\n\nStops CoreTrace capture.\n\nExample:\n\n```javascript=\nawait instance.stopCoreTrace();\n```\n\n### async downloadCoreTraceLog()\n\nReturns captured CoreTrace data.\n\nExample:\n\n```javascript=\nlet trace = await instance.downloadCoreTraceLog();\nconsole.log(trace.toString());\n```\n\n### async clearCoreTraceLog()\n\nClears captured CoreTrace data.\n\nExample:\n\n```javascript=\nawait instance.clearCoreTraceLog();\n```\n\n### async fridaConsole()\n\nReturns a node stream for the `Instance`'s FRIDA console.\n\nExample:\n\n```javascript=\nlet consoleStream = await instance.fridaConsole();\nconsoleStream.pipe(process.stdout);\n```\n\n### async executeFridaScript(filePath)\n\nExecute installed FRIDA script with path.\n\nExample:\n\n```javascript=\nawait instance.executeFridaScript(\"/data/corellium/frida/scripts/script.js\");\n```\n\n### async takeScreenshot()\n\nInstructions the `Instance` to create a screenshot of the device screen. Returns a `Buffer` with PNG data.\n\nExample:\n\n```javascript=\nlet screenshot = await instance.takeScreenshot();\nfs.writeFileSync('screenshot.png', screenshot);\n```\n\n### async finishRestore()\n\nWaits for a device to finish restoring.\n\nExample:\n\n```javascript=\nawait instance.finishRestore();\n```\n\nSee also the example at `Project#createInstance()`\n\n### async waitForState(state)\n\nWaits for the `Instance` to switch to a specific state. For valid states, see `Property: state`.\n\nExample:\n\n```javascript=\nawait instance.waitForState('on');\n```\n\n### Event: change\n\n`Instance` emits a `change` event when its info changes, e.g. when the instance is renamed or its state changes.\n\nExample:\n\n```javascript=\ninstance.on('change', async () =\u003e {\n    console.log(instance.id, instance.name, instance.state);\n});\n```\n\n### Event: panic\n\n`Instance` emits a `panic` event when a panic occurred.\n\nExample:\n\n```javascript=\ninstance.on('panic', async () =\u003e {\n    console.log('Panic detected!');\n\n    // get the panic log(s)\n    console.log(await instance.panics());\n\n    // Download the console log.\n    console.log(await instance.consoleLog());\n\n    // Clear the panic log.\n    await instance.clearPanics();\n\n    // Reboot the instance.\n    await instance.reboot();\n});\n```\n\n## class Agent\n\n**Note:** Instances of the class `Agent` are only supposed to be retrieved with `Instance#agent()` or `Instance#newAgent()`.\n\n### async ready()\n\nWaits for the agent to be ready to use. This essentially means that it will wait until Springboard has launched.\n\nExample:\n\n```javascript=\nlet agent = await instance.agent();\nawait agent.ready();\n```\n\n### async appList()\n\nReturns an `Array` of installed apps.\n\nExample:\n\n```javascript=\nlet appList = await agent.appList();\nfor (app of appList) {\n    console.log('Found installed app ' + app['bundleID']);\n}\n```\n\n### async run(bundleID)\n\nLaunches the app with the given `bundleID`.\n\nExample:\n\n```javascript=\nawait agent.run(\"com.corellium.demoapp\");\n```\n\n### async kill(bundleID)\n\nKills the underlying process of the app identified by `bundleID`.\n\nExample:\n\n```javascript=\nawait agent.kill(\"com.corellium.demoapp\");\n```\n\n### async install(path, [progress])\n\nInstalls an app, where the packaged app needs to be available on the VMs filesystem at `path`. The optional `progress` parameter expects a callback function with signature `(progress, status)`, where `progress` is the percentage as float, and `status` a string with the current status of the installation progress.\n\nTo upload a file to the VM's filesystem, see `Agent#upload()`.\n\nSee also `Agent#installFile()` which will handle the file upload on its own.\n\nExample:\n\n```javascript=\nawait agent.install('/var/tmp/temp.ipa', (progress, status) =\u003e {\n    console.log(progress, status);\n});\n```\n\n### async installFile(stream, [progress])\n\nUploads the packaged app provided through the node stream object `stream` and installs it on the VM. The optional `progress` parameter expects a callback function with signature `(progress, status)`, where `progress` is the percentage as float, and `status` a string with the current status of the installation progress.\n\nExample:\n\n```javascript=\nawait agent.installFile(fs.createReadStream('test.ipa'), (progress, status) =\u003e {\n    console.log(progress, status);\n});\n```\n\n### async uninstall(bundleID, [progress])\n\nUninstalls the app identified by `bundleID`. The optional `progress` parameter expects a callback function with signature `(progress, status)`, where `progress` is the percentage as float, and `status` a string with the current status of the uninstallation progress.\n\nExample:\n\n```javascript=\nawait agent.uninstall('com.corellium.demoapp', (progress, status) =\u003e {\n    console.log(progress, status);\n});\n```\n\n### async shellExec(cmd)\n\nExecutes a given command shell command on the VM.\n\nExample:\n\n```javascript=\n    let response = await agent.shellExec('uname');\n    console.log('Output:' + response['output']);\n```\n\n### async tempFile()\n\nReturns a temporary random filename on the VMs filesystem that by the time of invocation of this method is guaranteed to be unique.\n\nSee example at `Agent#upload()`.\n\n### async upload(path, stream)\n\nExample:\n\n```javascript=\nlet tmpName = await agent.tempFile();\nawait agent.upload(tmpName, fs.createReadStream('test.ipa'));\n```\n\n### download(path)\n\nDownloads the file at `path` from the VM's filesystem. Returns a node stream object.\n\nExample:\n\n```javascript=\nlet dl = agent.download('/var/tmp/test.log');\ndl.pipe(fs.createWriteStream('test.log'));\n```\n\n### async deleteFile(path)\n\nDeletes the file at `path` on the VM's filesystem.\n\nExample:\n\n```javascript=\nawait agent.deleteFile('/var/tmp/test.log');\n```\n\n### async profileList()\n\nReturns an array of Mobile Configuration profile IDs.\n\nExample:\n\n```javascript=\nlet profiles = await agent.profileList();\nfor (p of profiles) {\n    console.log('Found configuration profile: ' + p);\n}\n```\n\n### async installProfile(profile)\n\nInstalls Mobile Configuration binary `profile` to iOS device.\n\nExample:\n\n```javascript=\nvar profile = fs.readFileSync(path.join(__dirname, \"myprofile.mobileconfig\"));\nawait agent.installProfile(profile);\n```\n\n### async removeProfile(profileID)\n\nDeletes Mobile Configuration profile with `profileID`.\n\nExample:\n\n```javascript=\nawait agent.removeProfile('com.test.myprofile');\n```\n\n### async getProfile(profileID)\n\nGets Mobile Configuration profile binary with `profileID`.\n\nExample:\n\n```javascript=\nvar profile = await agent.getProfile('com.test.myprofile');\n```\n\n### async listProvisioningProfiles()\n\nReturns an array of Provisioning profile descriptions.\n\nExample:\n\n```javascript=\nlet profiles = await agent.listProvisioningProfiles();\nfor (p of profiles) {\n    console.log(p['uuid']);\n}\n```\n\n### async installProvisioningProfile(profile, trust)\n\nInstalls Provisioning profile binary `profile` makes it immediately trusted if `trust` is set.\n\nExample:\n\n```javascript=\nvar profile = fs.readFileSync(path.join(__dirname, \"embedded.mobileprovision\"));\nawait agent.installProvisioningProfile(profile, true);\n```\n\n### async removeProvisioningProfile(profileID)\n\nDeletes Provisioning profile with `profileID`.\n\nExample:\n\n```javascript=\nawait agent.removeProvisioningProfile('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');\n```\n\n### async preApproveProvisioningProfile(certID, profileID)\n\nApproves (makes trusted) profile with `certID` and `profileID` which will be installed later in a future for example during app installation via Xcode.\n\nExample:\n\n```javascript=\nawait agent.preApproveProvisioningProfile('Apple Development: my@email.com (NKJDZ3DZJB)', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');\n```\n\n### crashes(bundleID, callback)\n\nSubscribes to crash events for a given app identified by `bundleID`. The callback will be called as soon as the agent found a new crash log. The signature is `(err, crashReport)` where `err` is only defined if an error occured setting up or watching for crash logs and `crashReport` will contain the full crash report data.\n\nCurrently this is only available on iOS virtual devices.\n\n**Note:** Since this method blocks the communication channel of the agent to wait for crash reports, a new `Agent` connection should be created with `Instance#newAgent()`.\n\nExample:\n\n```javascript=\nlet crashListener = await instance.newAgent();\ncrashListener.crashes(\"com.corellium.demoapp\", (err, crashReport) =\u003e {\n    if (err) {\n        console.error(err);\n        return;\n    }\n    console.log(crashReport);\n});\n```\n\n### async lockDevice()\n\nLocks the device software-wise.\n\nExample:\n\n```javascript=\nawait agent.lockDevice();\n```\n\n### async unlockDevice()\n\nUnlocks the device software-wise.\n\nExample:\n\n```javascript=\nawait agent.unlockDevice();\n```\n\n### async enableUIAutomation()\nEnables UI Automation.\n\nExample:\n\n```javascript=\nawait agent.enableUIAutomation();\n```\n\n### async disableUIAutomation()\n\nDisables UI Automation.\n\nExample:\n\n```javascript=\nawait agent.disableUIAutomation();\n```\n\n### async isSSLPinningEnabled()\nCheck if SSL pinning is enabled.\nBy default SSL pinning is disabled.\n\nExample:\n\n```javascript=\nlet enabled = await agent.isSSLPinningEnabled();\nif (enabled) {\n    console.log(\"enabled\");\n} else {\n    console.log(\"disabled\");\n}\n```\n\n### async enableSSLPinning()\nEnables SSL pinning.\n\nExample:\n\n```javascript=\nawait agent.enableSSLPinning();\n```\n\n### async disableSSLPinning()\n\nDisables SSL pinning.\n\nExample:\n\n```javascript=\nawait agent.disableSSLPinning();\n```\n\n### disconnect()\n\nDisconnects an `Agent` connection. This is usually only required if a new agent connection has been created and is no longer needed, for example if the `crashListener` demonstrated in the example at `Agent#crashes()` is not required anymore.\n\nExample:\n\n```javascript=\n// subscribe for crash logs\nlet crashListener = await instance.newAgent();\ncrashListener.crashes(\"com.corellium.demoapp\", (err, crashReport) =\u003e {\n    if (err) {\n        console.error(err);\n        return;\n    }\n    console.log(crashReport);\n});\n\n// wait 15 seconds\nlet timeoutComplete = null;\nnew Promise(resolve =\u003e {\n    timeoutComplete = resolve;\n    setTimeout(timeoutComplete, 15000);\n});\n\n// crashListener not required anymore\ncrashListener.disconnect();\n```\n\n### async runFridaPs()\n\nReturns processes avialable for FRIDA to attach.\n\nExample:\n\n```javascript=\nlet procList = await agent.runFridaPs();\nlet lines = procList.output.trim().split('\\n');\n// Discard the first two lines.\nlines.shift();\nlines.shift();\nfor (const line of lines) {\n    const [pid, name] = line.trim().split(/\\s+/);\n    console.log(pid, name);\n}\n```\n\n### async runFrida(pid, name)\n\nAttaches FRIDA to the process with `pid` and `name`.\nPlease note that both arguments need to be provided as they are required by the Web UI.\n\nExample:\n\n```javascript=\nawait agent.runFrida(111, 'myapp');\n```\n\n### async runFridaKill()\n\nDetaches FRIDA from current process.\n\nExample:\n\n```javascript=\nawait agent.runFridaKill();\n```\n\n## class NetworkMonitor\n\n**Note:** Instances of the class `NetworkMonitor` are only supposed to be retrieved with `Instance#networkMonitor()` or `Instance#newNetworkMonitor()`.\n\n### async handleMessage(handler)\n\nInstall handler for captured Network Monitor data\n\nExample:\n\n```javascript=\nlet netmon = await instance.newNetworkMonitor();\nnetmon.handleMessage((message) =\u003e {\n    let host = message.request.headers.find(entry =\u003e entry.key === 'Host');\n    console.log(message.response.status, message.request.method, message.response.body.size, host.value);\n});\n```\n\n### async start()\n\nStarts capturing Network Monitor data\n\nExample:\n\n```javascript=\nlet netmon = await instance.newNetworkMonitor();\nnetmon.start();\n```\n\n### async stop()\n\nStops capturing Network Monitor data\n\nExample:\n\n```javascript=\nlet netmon = await instance.newNetworkMonitor();\nnetmon.stop();\n```\n\n### async isEnabled()\n\nCheck if Network Monitor is enabled\n\nExample:\n\n```javascript=\nlet enabled = await netmon.isEnabled();\nif (enabled) {\n    console.log(\"enabled\");\n} else {\n    console.log(\"disabled\");\n}\n```\n\n### async clearLog()\n\nClears captured Network Monitor data\n\nExample:\n\n```javascript=\nlet netmon = await instance.newNetworkMonitor();\nnetmon.clearLog();\n```\n\n## class Snapshot\n\n**Note:** Instances of the class `Snapshot` are only supposed to be retrieved with `Instance#snapshots()` or `Instance#takeSnapshot()`.\n\n### Property: name\n\nName of the snapshot.\n\n### Property: created\n\nThe time the snapshot was created.\n\n### Property: fresh\n\nTells wether a snapshot is fresh or not.\n\nA snapshot will be automatically created after the initial restore of an `Instance` in which case it is considered fresh.\n\nExample:\n\n```javascript=\nlet snapshots = await instance.snapshots();\nlet freshSnapshot = snapshots.find(snapshot =\u003e snapshot.fresh);\nawait freshSnapshot.restore();\n```\n\n### async rename(name)\n\nRenames a snapshot to `name`.\n\nExample:\n\n```javascript=\nlet snapshots = await instance.snapshots();\nlet snapshot = snapshots.find(snapshot =\u003e snapshot.name === 'Test 1');\nif (snapshot) {\n    await snapshot.rename('Test 1 new');\n}\n```\n\n### async restore()\n\nRestores a snapshot.\n\nExample:\n\n```javascript=\nlet snapshots = await instance.snapshots();\nlet snapshot = snapshots.find(snapshot =\u003e snapshot.name === 'Pre-Test 1');\nif (snapshot) {\n    await snapshot.restore();\n}\n```\n\n### async delete()\n\nDeletes a snapshot.\n\nExample:\n\n```javascript=\nlet snapshots = await instance.snapshots();\nsnapshots.forEach(snapshot =\u003e {\n    console.log(\"Deleting snapshot \" + snapshot.name)\n    snapshot.delete();\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorellium%2Fcorellium-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorellium%2Fcorellium-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorellium%2Fcorellium-api/lists"}