Android Tools

Apktool

Baksmali

Wrapper functions for JADX decompiler and dex-tools using subprocess. Note that these functions are designed to be used within docker containers.

mastf.android.tools.baksmali.decompile(dex_path: str, dest_path: str, baksmali_path: str, options: list = None) None[source]

Decompiles a dex file using Baksmali.

Parameters:
  • dex_path (str) – The path to the dex file to decompile.

  • dest_path (str) – The path to the directory where the decompiled files will be placed.

  • baksmali_path (str) – The path to the Baksmali executable.

  • options (list, optional) – Additional command-line options to pass to Baksmali. Defaults to None.

Raises:

RuntimeError – If Baksmali executable is not found.

mastf.android.tools.baksmali.to_java(dex_dir: str, dex_path: str, dest_path: str, jadx_path: str, options: list = None) None[source]

Converts a dex file to Java source code using jadx.

Note

The extracted files will be placed in the destination directory directly without having the extra sources/ directory.

Parameters:
  • dex_dir (str) – The path to the directory containing the dex file.

  • dex_path (str) – The name of the dex file to convert.

  • dest_path (str) – The path to the directory where the Java source files will be placed.

  • jadx_path (str) – The path to the jadx executable.

  • options (list, optional) – Additional command-line options to pass to jadx. Defaults to None.

Raises:

RuntimeError – If jadx executable is not found.