-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Mobile App Reverse Engineering
By :
Native Android applications are written mainly in Java or Kotlin. The Android SDK tools compile the code along with any data and resource files into an APK or an Android App Bundle. The compiled application is in a specific format, specified by the extension .apk. That is, an Android package is an archive file containing multiple application files and metadata.
Fun Fact
Rename the file extension of an APK to .zip and use unzip to open. You will be able to see its contents.
The following are the major components of an APK:
AndroidManifest.xml: The application manifest file containing app details such as the name, version, referenced libraries, and component details in XML format. The Android operating system relies on the presence of this file to identify relevant information about the application and related files.classes.dex files). META-INF:MANIFEST.MF (manifest file) CERT.RSA (certificate of the application)CERT.SF (list of resources with SHA-1 digest of the corresponding lines in the MANIFEST.MF file)lib: This contains the compiled code that is specific to a selection of processors, as follows:armeabi: Compiled code for all ARM-based processorsarmeabi-v7a: Compiled code for all processors based on ARMv7 and abovex86: Compiled code for x86 processorsmips: Compiled code for MIPS processorsres: Resources that are not compiled into resources.arsc.assets: Contains application assets.resources.arsc: Pre-compiled resources.Important Note
Java code in Android devices does not run in the Java Virtual Machine (JVM). Rather, it is compiled in the Dalvik Executable (DEX) bytecode format. A DEX file contains code that is ultimately executed by Android Runtime.
Let's see how to create a simple hello world application for Android and then unzip it to look at its components:
Figure 1.5 – Creating a new project in Android Studio
Figure 1.6 – Selecting project type
Figure 1.7 – Project details
Figure 1.8 – Running the app on the emulator
.zip:
Figure 1.9 – Diagram of rename process
# unzip MARE-Chapter-1.zip
For reference, the result is as follows:
Figure 1.10 – Extracting the content of the APK, after renaming it to .zip
Figure 1.11 – Extracted content of the APK
The following diagram shows the processes of forward and reverse engineering an Android application:
Figure 1.12 – The forward and reverse engineering processes with an Android application
Android applications are mainly developed using Java and Kotlin. The internals of an Android package are the same whether it is based on Java or Kotlin. Therefore, the approach to reverse engineer the application is also the same.
We've now learned about the fundamentals of Android applications. iOS apps are also packaged into a specific format and have a specific structure. Let's look into the iOS application fundamentals now.
Change the font size
Change margin width
Change background colour