Reversing

In this part we will extract the legitimate apk from emulator or the device and get the source code.

Tool

Android Debug Bridge (ADB) is a development tool that facilitates communication between an Android device and a personal computer.

How to Install ADB on Windows, macOS, and Linuxarrow-up-right

Note: You need debug usb enable in your emulator or device.

How view devices?

adb devices

How extract apk?

For this you need have installed the application in your device and know package name.

adb shell pm path package_name

This command print the path to the APK of the given

adb pull <remote> [<localDestination>]

This command pulls the file remote to local. If local isn’t specified, it will pull to the current folder.

Now, how to get to the source code?

jadxarrow-up-right: The jadx suite allows you to simply load an APK and look at its Java source code. What’s happening under the hood is that jADX is decompiling the APK to smali and then converting the smali back to Java.

Usage

jadx -d [path-output-folder] [path-apk-or-dex-file]

Dex2Jararrow-up-right: use dex2jar to convert an APK to a JAR file.

d2j-dex2jar.sh or .bat /path/application.apk

Once you have the JAR file, simply open it with JD-GUIarrow-up-right and you’ll see its Java code.

apktoolarrow-up-right: This tool get a source code in smali.

apktool d file.apk

jadx-gui: UI version of jadx

jadx\bin\jadx-gui

Last updated