pinas pinas - 3 months ago 34
Android Question

Get APK of installed app

I am looking for a possibility to extract the apk files of an installed android app WITHOUT root permission. Until 5 min ago I thought that this is not possible, since all app apks are located in /data/app (non-system-apps) and accessing this folder is just possible with root permission.

Then I found the virus.total Android app in the google play store (https://play.google.com/store/apps/details?id=com.virustotal) and they seem to have access to the apks even on non rooted devices.

Can someone tell me how this is possible ? Aren't there backup apps which backup the apks without root ???

mah mah
Answer

Accessing /data/app is possible without root permission; the permissions on that directory are rwxrwx--x. Execute permission on a directory means you can access it, however lack of read permission means you cannot obtain a listing of its contents -- so in order to access it you must know the name of the file that you will be accessing. Android's package manager will tell you the name of the stored apk for a given package.

To do this from the command line, use adb shell pm list packages to get the list of installed packages and find the desired package.

With the package name, we can get the actual file name and location of the APK using adb shell pm path your-package-name.

And knowing the full directory, we can finally pull the adb using adb pull full/directory/of/the.apk