Skip to content

Disassembling

Vincenzo Musco edited this page Oct 8, 2018 · 1 revision

The sa-disassemble command is a short hand script to invoke the baksmali tool offered by @JesusFreke. To sum up, it simply:

  • Extract the dexes classes from apk file;
  • Feed these to the baksmali tool;
  • Produce a ZIP archive containing all the smali files.

⚠️ This archive is the expected input format for the scripts present in this repo (as it mainly work on smali).

$ ./sa-disassemble --help
usage: sa-disassemble [-h] [--overwrite] [--folder] [--dont-merge]
                      [--custom-baksmali CUSTOM_BAKSMALI]
                      apkpath [output]

Extract smali content.

positional arguments:
  apkpath               The full path to the apk
  output                Where to output smali files

optional arguments:
  -h, --help            show this help message and exit
  --overwrite, -o       Delete all previous exportation
  --folder, -f          Disassemble in a folder instead than a ZIP file
                        (deprecated)
  --dont-merge, -D      If --folder, don't merge back all dexes in one folder
  --custom-baksmali CUSTOM_BAKSMALI, -b CUSTOM_BAKSMALI
                        Do not use the included baksmali binary and specify
                        one

If you omit the output parameter, it will produce the archive in the same folder as the one the apk is read (appending the .smali extension).

# Produce /Users/vince/base.apk.smali (a zip file)
$ ./sa-disassemble /Users/vince/base.apk
$ unzip -l /Users/vince/base.apk.smali
Archive:  /Users/vince/base.apk.smali
  Length      Date    Time    Name
---------  ---------- -----   ----
     4781  09-24-2018 14:46   bdx.smali
[...ommited for brievty...]
Clone this wiki locally