# LAB Setup 1

### 1. Tool and LAB Setup with Android Studio

For some exercises we need Android Studio that we can install and emulate android apps. To run a virtualization inside a virtual machine is not even easy and it's possible that the emulator won't work or bring the whole VM to crash.  I got it to work inside my Kali Linux box, but it's also possible to run Android Studio native on the client.

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2F6780Jg3s9hxVaZqNThYz%2Femulator01.png?alt=media&#x26;token=b4ae6971-5923-406d-834f-4c70b773442f" alt=""></div>

If you use Windows you can't use Hyper-V and VMware, because they are in conflict with each other.

Use this command in powershell to disable hyper-v and reboot the machine:&#x20;

```
bcdedit /set hypervisorlaunchtype off
```

My VMware Configuration looks like this:

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FczTKND0JABk0WNkHqtjc%2Fsetup01.png?alt=media&#x26;token=ced622f5-d1d6-49e5-9b93-f26f3769da02" alt=""></div>

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FXSibu8cODALgcn1bjDyE%2Fsetup02.png?alt=media&#x26;token=9929de7b-1019-4515-9815-ef4f1d6b2f94" alt=""></div>

Download and Install Android Studio:

{% embed url="<https://developer.android.com/studio/install#linux>" %}

Unpack tar.gz file

```
tar -xvf android-studio-ide-2021.2.1.15-linux.tar.gz -C <DIRECTORY>
```

Launch Android Studio:

```
~/android-studio/bin# ./studio.sh
```

Create an Android virtual Device (AVD) in Android Studio:

Tools --> AVD Manager

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FHulPSoO23bkXbbD50Xu4%2Fsetup03.png?alt=media&#x26;token=38837d77-d5ef-4359-ae7c-5b3f08332d60" alt=""></div>

Emulator starten:

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FrNPv3FvAKcihTgM5juYz%2Fsetup04.png?alt=media&#x26;token=56369158-6ba9-4be4-8bff-2271c83aa95b" alt=""></div>

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FJ2hq7Z9OVKrILPHz47Lj%2Fsetup05.png?alt=media&#x26;token=57957b20-cda1-4d44-b3c6-844586fb7c68" alt=""></div>

The emulator is in directory `~/Android/Sdk/emulator`

Install apktool:

```
apt install apktool
```

Install apksigner:

```
apt install apksigner
```

Install adb:

```
apt install adb
```

Install Android Asset packaging tool:

```
apt install aapt
```

Install jadx:

```
git clone https://github.com/skylot/jadx.git
cd jadx
./gradlew build
./gradlew dist

./build/jadx/bin/jadx

./build/jadx/bin/jadx-gui
```

Install Frida:

Frida requires python >=3.6 and should be installed in a virtual environment

```
pipenv --python 3 shell
pip install frida
pip install frida-tools
pip install objection
pip install frida-android-helper
```

Workaround if pip install frida-android-helper gets errors:

```
git clone https://github.com/Hamz-a/frida-android-helper.git
cd frida-android-helper
python3 setup.py install
```
