How to use MobSF with Genymotion SaaS

2025-04-14

In this tutorial, it is assumed that you are familiar with MobSF and that you are using MobSF from a physical local machine. For detailed information about MobSF, refer to .

> Important: This tutorial requires modification to MobSF source code. This tutorial will not work with MobSF official docker image.

Prerequisite

Setup gmsaas CLI

Configure the path to your Android SDK

Use the following command:

Bash

gmsaas config set android-sdk-path <sdk_path>

<sdk_path> should point to the Android SDK installation directory, similar to the ANDROID_SDK_ROOT or deprecated ANDROID_HOME environment variables.

Configure authentication

You will need a Genymotion SaaS API token for this step. If you haven’t created one yet, follow the steps from the on-line documentation: .

Next, use the following command:

Bash

gmsaas auth token <token>

Alternatively, you can store the API Token in the environment variable: GENYMOTION_API_TOKEN.

Verify gmsaas configuration

Run the command:

Bash

gmsaas doctor

If the command returns “Authentication OK” and “Android SDK OK”, you are all set with gmsaas.

Connect an instance to ADB

Start your instance. When the instance is in “Running” state, copy the instance UUID. You can get the instance UUID from the . You can also get the instance UUID with the gmsaas recipes list command. Then, use the following command:

Bash

gmsaas instances adbconnect [--adb-serial-port PORT] <instance_uuid>

Replace <instance_uuid> with the instance UUID. The command returns to shell once ADB is connected. If the --adb-serial-port <PORT> option is set, the instance will be connected to ADB on localhost:<PORT>.

Another method connects any running instances to ADB by combining this command with the --quiet or -q option and xargs:

Bash

gmsaas instances list -q | xargs -n1 gmsaas instances adbconnect

You can verify with the adb devices command. adb should now be connected to “localhost:XXXXX device”. For example:

Bash

$ adb devices
List of devices attached
localhost:45485	device

Configure MobSF

1. Clone MobSF code from github

Clone MobSF open-source code to your computer:

Bash

git clone https://github.com/MobSF/Mobile-Security-Framework-MobSF.git

2. Modify the code

Edit the Mobile-Security-Framework-MobSF/mobsf/DynamicAnalyzer/views/android/environment.py script.

Comment the following lines in def connect_n_mount(self):

Python

def connect_n_mount(self):
    """Test ADB Connection."""
    if not self.identifier:
        return False
    """self.adb_command(['kill-server'])
    self.adb_command(['start-server'], False, True)
    logger.info('ADB Restarted')"""
    self.wait(2)

Save the script.

3. Install MobSF

> Important: It is strongly recommended to use a to install and use MobSF.

In the Mobile-Security-Framework-MobSF folder, run:

Bash

./setup.sh

4. Launch MobSF

When done, run this command:

Bash

./run.sh 127.0.0.1:8000

Now, you can access MobSF by browsing to http://localhost:8000/.

Log in and navigate to DYNAMIC ANALYSER. Your Genymotion SaaS instance should appear as connected at localhost:XXXXX:

MobSF Dynamic Analyzer Page