Corellium Technical Articles

Golang iOS | Corellium API Bindings for Go | [Technical Writeup]

Written by David Manouchehri | Aug 28, 2023 2:54:41 PM

Golang, or simply Go, has rapidly gained popularity due to its simplicity, efficiency, and strong support for concurrent programming. In this blog post, we will demonstrate how to use the new Corellium API bindings for Golang to simulate changing the accelerometer of a virtual iPhone as if it was in the pocket of a passenger during a 737 takeoff. 

This example showcases the power of Go combined with the capabilities of the Corellium API to turn these boring static fields into dynamically changing values to simulate the real world.

Writing The Program

Importing Required Libraries 

First, we import the necessary libraries, including the Corellium API bindings, os, fmt, and time packages:

Initializing Variables and Configuration

In the main function, we initialize the API token, context, peripherals data, instance ID, and API configuration using the Corellium API bindings for Golang:

Simulating 737 Takeoff Acceleration with a Goroutine 

We create a goroutine to simulate the 737 takeoff acceleration. In this goroutine, we use a ticker to trigger events every 500 milliseconds and iterate through the acceleration profile:

Waiting for the Goroutine Finish

Finally, we wait for the goroutine to finish by using a time.Sleep(). Our completed program should look like this:

Runway Test

Finally, to test what we wrote, set the CORELLIUM_API_TOKEN to the value obtained from your profile, and run go run main.go.

And you’ve taken off!