Roberto Huertas
Roberto Huertas Just a humble software developer wandering through cyberspace. Organizer of bcn_rust. Currently working at Datadog.

Rust powered CLI apk decompiler

Rust powered CLI apk decompiler

Lately I’ve been needing to reverse engineer some apks and I’ve been manually using some third-party tools to do so. But, how could we speed up the process? A little bit of Rust can be very helpful! :wink:

Rust is awesome for building CLI

If you weren’t aware of it, Rust is also a superb choice for building CLI tools. It even has a dedicated page for this! :wink:

Take a look at this awesome tools:

  1. quicli,
  2. clap,
  3. structopt,
  4. console

Entering apk-decompiler

Let’s be honest, we don’t like doing repetetive boring tasks and going through dex2jar, apktool and Java Decompiler again and again would inevitably lead to everyone of us to try to automate this process.

And that’s precisely why I built my own CLI utility which is unexcitingly called apk-decompiler :tada:.

How to get an apk

You have several ways to do this.

The easiest one is to browse to ApkPure and just download it to your computer.

The more convoluted one would require you to have a rooted phone and pull the apk from there. If you’re curious about this process you can just read apk-decompiler readme, it’s succintly detailed there.

How to use it

At the moment, apk-decompiler only supports MacOS and Linux.

You can get the software from the releases page of the project and download it right away.

Once you have downloaded it, you can add it to your path and use it like this:

apk-decompiler <name-of-your-apk>

What you’ll get

You’ll get a new folder called output with the following folders in it:

  1. decompiled: This is the output of running dex2jar.
  2. extracted: This folder contains the output of unzipping the apk.
  3. xml: This is basically the output of running apktool.
  4. Optional file that you will get in case there are some errors during the decompilation process.

Known issues

If you have folders with empty spaces this may be a problem for jd-cli which is one of the dependencies of this project. So… just try to avoid them! :stuck_out_tongue_winking_eye:

Just in case you somehow missed the link to apk-decompiler, you can find it here.

Feel free to improve it, fork it or raise issues in the Github repository.