M 145: Making a Rooted Android Emulator (10 pts extra)

What You Need for This Project


To create an emulator with root privileges.

Creating a Device

Launch Android Studio.

On the right side, click Device Manager, Create Device.

In the Select Hardware box, click "Pixel 3a XL", as shown below

In the System Image box, click the "x86 Images" tab.

Click "Android 11.0" without Google API, as shown below.

Click the down-arrow on the left side of the "Android 11.0" line to download it, as shown below

Click Next. Click Finish.

Adjusting RAM and Storage Sizes

In the "Android Virtual Device" screen, on the left side, at the bottom, click the "Show Advanced Settings" button.

Increase the Internal Storage to 2000 MB, as shown below.

Click Finish.

Start your Emulator

Start your emulator, as shown below.

Connecting with ADB

The steps depend on your operating system. Follow the appropriate instructions below.

Mac Users

In a Terminal, execute this command:
adb devices
If you see an error message saying "command not found", execute this command to fix the Path:
export PATH=$PATH:~/Library/Android/sdk/platform-tools
Then execute this command again:
adb devices

Windows Users

Open a Command Prompt window and execute this command:
adb devices
If you see an error message saying "Not found: adb", close the Command Prompt window.

Open an Administrator Command Prompt window and execute this command to fix the Path:

setx /M PATH "%PATH%;%userprofile%\appdata\local\android\sdk\platform-tools"
Close the Administrator Comand Prompt window and open a normal Comand Prompt window.

Then execute this command:

adb devices
You should see your device listed, as shown below.

Opening a Root Shell

In a Command Prompt or Terminal, execute these commands:
adb shell
You get a root shell, as shown below.

M 145.1: ps (10 pts)

In your root shell, execute this command:
Find the line ending with "ps".

Find the text covered by a green box in the image below. That's the flag.



Posted 10-7-22
PATH command fixed 10-17-11
Minor updates to instructions 3-13-23
Internal storage increase added 10-3-23