0

I know you can unpack APKs with apktool and the likes, however we're doing an exercise at uni where we're supposed to get some info like permissions declared and permissions used from some APKs without using tools. Not really sure where to start. I'm guessing I'll need to unzip and apply some public-private signing.

  • 3
    You need to be a bit more specific what your problem is. Yes, an APK is a zip file, so you can unzip it. But isn't unzip a tool as well? No, you don't need to apply any signing as long as you aren't trying to generate a new modified APK. To see permissions, you need to check Android.xml, but inside an APK, this isn't a text XML file, it has a binary encoding. Are you allowed to use a tool to convert that back to readble XML? – Guntram Blohm supports Monica Apr 29 '16 at 10:27
1

Amazing exercise.

Here are the steps you can do broadly:

  1. Unzip the apk file (APK files are compressed zip files)
  2. All the xml files including the AndroidManifest.xml are encoded in a binary format, also better known as AXML
  3. Parse the AXML files by writing your own scripts. See examples AXML Parser in GO and AXML Parser in C
  4. you would find classes.dex file which is a DEX file or better known as Dalvik Executable
  5. The Dalvik opcode might come handy, if you can read the hex-version of the dexfile and write your own script
  6. If you have installed android sdk properly, there is a tool dexdump which comes by default in it
  7. In order to use the tool the following command can help

    $ dexdump -d classes.dex
    000418: 2b02 0c00 0000               |0000: packed-switch v2,0000000c // +0x0c
    00041e: 12f0                         |0003: const/4 v0, #int -1 // #ff
    000420: 0f00                         |0004: return v0
    000422: 1220                         |0005: const/4 v0, #int 2 // #2
    000424: 28fe                         |0006: goto 0004 // -0002
    000426: 1250                         |0007: const/4 v0, #int 5 // #5
    000428: 28fc                         |0008: goto 0004 // -0004
    00042a: 1260                         |0009: const/4 v0, #int 6 // #6
    00042c: 28fa                         |000a: goto 0004 // -0006
    00042e: 0000                         |000b: nop // spacer
    000430: 0001 0300 faff ffff 0500 ... |000c: packed-switch-data (10 units)
    

Not the answer you're looking for? Browse other questions tagged or ask your own question.