The Android experience V

After banning nearly a dozen of apps, I realized that some apps cannot be identified based on their apk name. It is quite impossible to associate a apk name with an app, if the name is sth. like starter.apk. APK (Android Package) files are special JAR (JAVA Archive) files, which contain the app, a signature of the app and so on. The signature tries to verify that the app is trusted and harmless. This should prevent manipulations and/or malware like trojan horses. Another part of the apk file is the AndroidManifest.xml, which is a required part of every apk file. The following (meta-)data is stored in this file:

  • Name of the app
  • Version
  • Permissions
  • references

You can find very good and detailed information about apk files here and here.

Well, this won’t solve the problem. The apk file contains all the needed information. Thank god, I’m not the only one who has problems with cryptic names. Some brains created some applications which could help me with this problem. One of the tools is the APK Batch Rename tool which I hereby recommend ;) .

The tool creates duplicates of apk files and renames them based on the name stored in the AndroidManifest.xml. The developer gives the following example:

For example a com.example.hw.apk will make Hello World! 1.21.apk provided that the label inside the package was set to Hello World! and version is 1.21.

This great tool is provided by the xda-developers.com and is available for Windows and Linux. I’ll use the Linux version of course. After creating the new files, we’ll tune them a little.

After downloading and extracting the program (on your normal workstation), we’ll switch to the Android based device and open the Android Terminal Emulator. This process requires a usable memorycard (e.g. SD-Card) in your phone. A copy of my /system/app directory is round about 150M in sum.

Type the following to your Terminal to copy /system/app to the SD-Card:

  $ mkdir /mnt/sdcard/apk-dump
  $ cp /system/app /mnt/sdcard/apk-dump

The folder /mnt/sdcard/apk-dump contains the copy of your /system/app folder. You can either disconnect (unmount) the SD-Card or connect your phone to your workstation.

My phone is recognised as a storage device. I’ve created a mountpoint:

# mkdir /mnt/sdcard
# mount /dev/sdc /mnt/sdcard

The card is recognised on the most Linux systems and can be found in /media.

The APK Batch Rename tool requires an input and output folder, the easiest way is to copy the apk files to the APK Batch Rename tool directory:

$ mv /mnt/sdcard/apk-dump/* /path/to/APKBatchRenameTool/input

cd to the directory where you extracted the APK Batch Rename tool and execute it:

$ cd /path/to/APKBatchRenameTool
$ ./apkbatchrename

The output looks like this:

APK Batch Rename Tool V1.10 Linux
 
Starting to copy files...
 
SNS 1.0
Network Location 2.2.1
Samsung Apps 1.2.192
DataCreate 1.0
Write and Go 1.0
[...]
BluetoothTest 1.0
Unknown 2.2
Calendar 1.1
 
Completed. Now check output directory.

The renamed apk files can be found in the output directory. Most of the apps could be renamed, some didn’t deliver the required information.

Well, this doesn’t help us again. It is clear now which apk file contains which app, but the association is not made yet. We’ll use this little bash script to do this:

#!/bin/sh
OUTF=AppDictionary.txt;
find "$@" -type f -exec md5sum {} \; |
    sort --key=1,32 | uniq -w 32 -d --all-repeated=separate |
    sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/\1/' >> $OUTF;

A short explanation:

This bash script creates a MD5 hashsum for every file found in the directory where the script is stored. If two or more apps have the same MD5 hash, they are paired and written to AppDictionary.txt.

In order to work properly you need to copy all apk files into one directory:

$ mkdir merge
$ cp input/* merge
$ cp output/* merge

The code above requires that you are still in the APK Batch Rename tool – path.

Execute the script above (download here). You’ll need to adjust the permission to execute the script:

$ chmod a+x find_appPairs.sh

The script takes some time, based on the number of apk files and you computers performance. The results are written to AppDictionary.txt and can be viewed in every editor. Cryptic apk name and human readable names are listed in pairs. Find below an exampled taken from my AppDictionary.txt:

./FM\ Radio\ 2.2.apk
./FmRadio.apk

./DataCreate\ 1.0.apk
./DataCreate.apk

./OMACP\ 1.0.apk
./wssomacp.apk

./LauncherActivity.apk
./Navigon\ Start\ 1.0.apk

./Network\ Location\ 2.2.1.apk
./NetworkLocation.apk

./wssyncmlnps\ 1.0.0.apk
./wssyncmlnps.apk

./CP\ Message\ 1.0.0.apk
./OtaProvisioningService.apk

./Superuser\ 2.3.6.1\ -\ Added\ clear\ log\ to\ menu\ in\ log\ tab\,\ More\ languages\,\ Bugfixes.apk
./Superuser.apk

./Feeds\ and\ Updates\ 10.10.07.01.apk
./SamsungWidget_FeedAndUpdate.apk

./Samsung\ Apps\ 1.2.192.apk
./SamsungApps.apk

[...]

Use the list to clean your system, and get rid of the “hidden” enemies :) I’ve found the Navigon Start and the Jukebox by using this way.

Part six is already done …

5 Responses to The Android experience V

  1. Pingback: more and more visitors | blog.speen.it

  2. Great beat ! I wish to apprentice while you amend your web site, how could i subscribe for a blog web site? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear idea

  3. I enjoy you because of every one of your work on this site. Ellie takes pleasure in managing investigations and it is simple to grasp why. My partner and i notice all about the powerful medium you deliver priceless items via the web blog and as well as attract contribution from website visitors on this area of interest so my child is now learning a great deal. Take advantage of the rest of the year. You’re carrying out a useful job.

  4. What i do not understood is if truth be told how you’re no longer actually a lot more neatly-appreciated than you might be right now. You’re very intelligent. You realize therefore significantly relating to this topic, produced me in my opinion imagine it from a lot of varied angles. Its like men and women aren’t interested until it is one thing to accomplish with Girl gaga! Your own stuffs great. At all times care for it up!

  5. ?? says:

    I am a extended time in the past I read your blog and has extended been declaring that you are a fantastic writer

Leave a Reply