All right, let's have a look at the compiling and Android application.
But before we can decompile an Android application, we need to get this from the device because last
time we downloaded it via a third party store.
But this option is not always possible.
For example, if you have downloaded an APK or an app from the Google Play Store, we cannot simply
download the APK file directly from the play store.
We need to retrieve this app from the device.
So let's have a look how this can be done.
Here we have our smartphone and also the app, which is on the smartphone right now.
The easiest way is to simply establish an ADB connection to this device and then be open or connect
to this device.
And we use the package manager to identify the package name because the package name is a unique identifier
for this application and this identifier can be used with p m path to retrieve the reference of this
APK file on the device.
So when you install an application, the whole APK still exists on the device and with P and path and
the package identifier of this application, we can retrieve the path to this whole APK and this APK
can afterwards be downloaded via ADB pull.
And the good thing is we do not need certain permissions or requirements.
We simply can use ADB in a normal user context so no route is required.
These three steps or four steps, let's say, are regarding to getting the APK.
When we have to apk we come to the original topic.
They compiling this application and this can be done with a tool named APK Tool.
This is a simple char binary and we can simply run java desh char apk toolkit char and we can interact
with this APK file.
With a peek tour, we can decompile an Android application and we can also build it back again in the
structure path.
We have already seen that an APK simply consists of single files which are compressed into one block
and thus block.
This compressed zip blocked is the APK.
So by compiling this APK file, we can edit those single files and then we can build it back again.
Well, you might ask yourself, we already have done this in the unzipping path.
Yes, but we will look at the difference between unzipping an APK and compiling an APK because those
two are different.
And you will see pretty clearly that the compiling in Android application is much more convenient and
better to handle than simply just unzipping it.
So I would say let's start by getting this APK from our mobile device.
Therefore I switched to our ubuntu VM.
We are our ubuntu vm and I'm making an ADB connection to this device.
If you do not know the IP address of this device, simply go on the virtual machine.
Swipe this app, open the terminal emulator.
And run IP address, then you will find this IP address.
And if this device has not assigned an IP address, make sure you are connected to the virtual wi fi
right here.
All right.
If you still have issues regarding to the connection to the virtual machine, to the Android device,
please take a look at the PDF sheet which is attached in this course because there's a huge troubleshooting
guide which now consists or is based on seven years of experience in this topic.
And I faced a lot of problems and this might help you.
And in case it doesn't, please drop me a message.
I try my best.
I will reach out to you and we will figure out and make this work.
I promise you, after establishing the connection, we go into our ADB shell and we have downloaded
the APK file the space Peng apk before.
But we do this now again regarding to retrieving this apk directly from the mobile device.
So this example shows you how to handle real world targets.
For example, if you have download an APK from the Google Play store, you do not have directly to APK
file.
You need to retrieve it.
And this is how you can do this.
We are on the device.
We can see or verify this by having this 86 prompt right here.
I'm going to maximize this and also make it a little bit bigger.
All right.
We have the package manager, which is a binary on the device, and we can use this.
This package manager has a lot of options and some of them are really useful.
But we do not take too deep into this.
What we need is we simply just need to list these packages.
So PM for package manager list packages and then we have all those packages, all those applications
which are installed on the device.
So we can look through all those packages right here, but we can also use a grep command.
To retrieve this application, which we are interested in, and we know our application has seen a space
in it.
So we say grep dash e for ignore k sensitive.
So we do not have to care about about upper and lower cases.
Here we can see the package name of our application, this one right here and now we can say PM path
with the package name to retrieve the path of this APK file.
And this is located right here.
It's under data app space ping some wiht base64 which we do not care too much about this and the space
apk file right here.
So we take this whole path.
Be quiet.
The old menu terminal.
And.
Yeah.
So let's make a new directory.
So we name this space pang decompile.
And there I click, right click, open a new terminal.
Then we are directly in this directory here.
And then I say adb pull and I use this path.
And we can see OC four and BS has been downloaded in all 2 seconds and here's our APK.
This is our space paying application which has been installed on the device.
In this section we have seen how to download an APK file directly from the mobile device.
For example, if you have installed this application via the Google Play Store and the next section,
we take a look at the compiler.
In this Android application.
We will therefore install the APK tool and we will also figure out some parameters of the APK tool and
we will take a look at the difference between unzipping and compiling an app.
So I'm looking forward to see you in the next section.