|
| 1 | +# Dynamic Analyzer |
| 2 | + |
| 3 | +!> Dynamic analysis using real mobile device is possible, **but not supported by us.** If you need Dynamic Analysis, do not setup MobSF inside Docker or Virtual Machine. |
| 4 | + |
| 5 | +## Genymotion Android x86 |
| 6 | +?> Supports x86 architecture Android **4.1 - 9.0**, upto **API 28** |
| 7 | + |
| 8 | +Genymotion is the preferred dynamic analysis environment that you can setup with the least friction. Run a Genymotion Android VM **before starting MobSF.** Everything will be configured automatically at runtime. We recommend using **Android 7.0** and above. |
| 9 | + |
| 10 | +* **Android 5.0 - 9.0** - These versions uses **Frida** and works out of the box with zero configuration or setup. |
| 11 | +* **Android 4.1 - 4.4** - These versions uses **Xposed Framework** and requires that you should MobSFy the runtime prior to Dynamic Analysis for the first time. These versions also require VM reboot after installing Xposed Modules. |
| 12 | + |
| 13 | +Click **MobSFy Android Runtime** button in Dynamic Analyzer page to MobSFy the android runtime environment. |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +**HTTPS Proxy** |
| 18 | + |
| 19 | +* For Android versions **4.4 - 9.0**, global proxy settings are automatically applied at runtime. |
| 20 | +* For Android version **4.1 - 4.3**, set Android VM proxy as displayed in Dynamic Analyzer page. |
| 21 | + |
| 22 | +If Dynamic Analyzer doesn't detect your android device, you need to manually configure `ANALYZER_IDENTIFIER` in `MobSF/settings.py`. |
| 23 | + |
| 24 | +Example: `ANALYZER_IDENTIFIER = '192.168.56.101:5555'`. |
| 25 | +You can find the Android Device IP from the Genymotion title bar and the default port is `5555`. |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +## Android Studio Emulator |
| 30 | +?> Supports arm, arm64 and x86 architecture Android **5.0 - 9.0**, upto **API 28** |
| 31 | + |
| 32 | +Android Emulator image with Google Play Store is considered as production image and you cannot use that with MobSF. |
| 33 | +Create an Android Virtual Device (AVD) **without Google Play Store**. Do not start the AVD from Android Studio, instead start the AVD with writable system using `emulator` command line options. |
| 34 | + |
| 35 | +For that, add your Android SDK emulator directory to `PATH`. |
| 36 | + |
| 37 | +Some example locations |
| 38 | + |
| 39 | +* Mac - `/Users/<user>/Library/Android/sdk/emulator` |
| 40 | +* Linux - `/home/<user>/Android/Sdk/emulator` |
| 41 | +* Windows - `C:\Users\<user>\AppData\Local\Android\Sdk\emulator` |
| 42 | + |
| 43 | +**List available Android Virtual Devices (AVD)** |
| 44 | + |
| 45 | +```bash |
| 46 | +$ emulator -list-avds |
| 47 | +Pixel_2_API_29 |
| 48 | +Pixel_3_API_28 |
| 49 | +Pixel_XL_API_24 |
| 50 | +Pixel_XL_API_25 |
| 51 | +``` |
| 52 | + |
| 53 | +!>Only Android images upto **API 28** are supported! |
| 54 | + |
| 55 | + |
| 56 | +Set `ADB_BINARY` path in `MobSF/settings.py`. |
| 57 | + |
| 58 | +Make sure that you are using the adb binary that comes with Android Studio. If you use a different version, that might cause conflicts and introduce issues while attempting dynamic analysis. |
| 59 | + |
| 60 | +Some example locations |
| 61 | + |
| 62 | +```python |
| 63 | +ADB_BINARY = '/Users/<user>/Library/Android/sdk/platform-tools/adb' # Mac |
| 64 | +ADB_BINARY = '/home/<user>/Android/Sdk/platform-tools/adb' # Linux |
| 65 | +ADB_BINARY = 'C:\\Users\\<user>\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe' # Windows |
| 66 | +ADB_BINARY = 'C:/Users/<user>/AppData/Local/Android/sdk/platform-tools/adb.exe' # Windows |
| 67 | +``` |
| 68 | + |
| 69 | +**Run Android Virtual Device (AVD)** |
| 70 | + |
| 71 | +Run an AVD **before starting MobSF** using `emulator` command line options. |
| 72 | + |
| 73 | +```bash |
| 74 | +$ emulator -avd <non_production_avd_name> -writable-system -no-snapshot |
| 75 | +``` |
| 76 | + |
| 77 | +Everything will be configured automatically at runtime. MobSF requires AVD version **5.0 to 9.0** for dynamic analysis. We recommend using **Android 7.0** and above. |
| 78 | + |
| 79 | +**HTTPS Proxy** |
| 80 | + |
| 81 | +* For Android versions **5.0 - 9.0**, global proxy settings are automatically applied at runtime. |
| 82 | + |
| 83 | +**GApps on AVD (Optional)** |
| 84 | + |
| 85 | +If you need GApps, find the appropriate package from <https://opengapps.org/> |
| 86 | + |
| 87 | +```bash |
| 88 | +unzip open_gapps-<your-version>.zip 'Core/*' |
| 89 | +rm Core/setup* |
| 90 | +lzip -d Core/*.lz |
| 91 | +for f in $(ls Core/*.tar); do |
| 92 | + tar -x --strip-components 2 -f $f |
| 93 | +done |
| 94 | +adb remount |
| 95 | +adb push etc /system |
| 96 | +adb push framework /system |
| 97 | +adb push app /system |
| 98 | +adb push priv-app /system |
| 99 | +adb shell stop |
| 100 | +adb shell start |
| 101 | +``` |
0 commit comments