> For the complete documentation index, see [llms.txt](https://simon-6.gitbook.io/simoncyber/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simon-6.gitbook.io/simoncyber/ctf-writeups/picoctf-2024/forensics/mob-psycho-medium.md).

# Mob psycho (Medium)

This is my first APK challenge, hence I'll do a little of bit research before the challenge.

<figure><img src="/files/x7FwsSvZQc9yNR4vkDgr" alt=""><figcaption></figcaption></figure>

***

### What is a APK

{% embed url="<https://www.geeksforgeeks.org/techtips/what-is-an-apk-file/>" %}

"An **APK file,** or **Android Package Kit**, is a type of file format used to distribute and install applications on the [**Android** ](https://www.geeksforgeeks.org/android/android-tutorial/)**operating system.** It's like the same thing as downloading files as exe on windows, except for files you download lets say from the app store would be APK files.&#x20;

The two most commonly associated tools associated with APK ctfs is JADX and apktool.

```
sudo apt install jadx
sudo apt install apktool
```

> More or less, "Use **JADX** and **APKTool** together, **JADX** for readable code, **APKTool** for precise resource mapping."

There's 7 main compendents of a APK file. I'll go through them quickly.&#x20;

1. AndriodManifest.xml: The identity card, contains the apps settings and permissions
2. classes.dex: Contains the code of the program
3. resources.arsc: Contains all the resources shown on the screen (Like CSS)
4. res/: Uncomplied resources of the app
5. META-INF/: Contains security information and certificates
6. lib/: Contains the libraries &#x20;
7. assets/: Contains the files, like images, sounds, fonts

***

### Solving it&#x20;

The hint says to unzip it so the first thing to is that.

```
unzip mobpsycho.apk
```

Once we unzip it, we get a lot of files to sort through.&#x20;

<figure><img src="/files/AS97EyGN6NEG7bo83xXp" alt=""><figcaption></figcaption></figure>

Sorting through this manually isn't efficient, let's use grep!

```
strings mobphysco.apk | grep -i flag 
```

<figure><img src="/files/cpDM1TrB0LAKyZONv54C" alt=""><figcaption></figcaption></figure>

After this we could just do "cat ./res/color/flag.txt to get a hex version of the flag.

<figure><img src="/files/P3eBZsgL9fiMTUTkkyaQ" alt=""><figcaption></figcaption></figure>
