Q:

Analyzing an APK without tools

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. 

A:

Amazing exercise.
Here are the steps you can do broadly:

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

