LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

baksmali

Android DEX file disassembler

TLDR

Disassemble a DEX file
$ baksmali disassemble [classes.dex]
copy
Disassemble to a specific directory
$ baksmali disassemble -o [output/] [classes.dex]
copy
Specify API level for disassembly
$ baksmali disassemble -a [28] [classes.dex]
copy
List available subcommands
$ baksmali --help
copy
List DEX classes without disassembling
$ baksmali list classes [classes.dex]
copy

SYNOPSIS

baksmali command [options] dex-file

DESCRIPTION

baksmali is a disassembler for Android DEX (Dalvik Executable) files. It converts DEX bytecode into smali assembly language, enabling analysis, modification, and reverse engineering of Android applications.The tool is the counterpart to smali, together forming a complete assembler/disassembler suite for Android. Since version 2.0, baksmali uses a subcommand-based interface.

PARAMETERS

disassemble (or d)

Disassemble a DEX file into smali files.
list type
List items (classes, methods, fields, etc.) from a DEX file.
deodex (or x)
Deodex an odex/oat file.
-o, --output dir
Output directory (default: out/).
-a, --api-level level
API level for disassembly.
-j, --jobs num
Number of threads for parallel processing.
-b, --bootclasspath classpath
Colon-separated bootclasspath jars for analysis.
-d, --bootclasspath-dir dir
Directory containing framework files.
--no-debug-info
Don't write debug information (.local, .param, .line directives).
--use-locals
Use .locals directive instead of .registers.
--classes LIST
Comma-separated list of classes to disassemble.

FEATURES

- DEX to smali conversion- Multi-DEX support- API level awareness- Parallel processing- Debug info preservation- Local variable names

WORKFLOW

$ # Disassemble DEX
baksmali disassemble classes.dex

# Reassemble with smali
smali assemble out/ -o new-classes.dex
copy

CAVEATS

Requires Java runtime. Obfuscated code produces hard-to-read output. API level affects instruction interpretation. For research and educational purposes only. Respect software licenses and terms of service.

HISTORY

baksmali (Icelandic for "disassembler") was created by Ben Gruver (JesusFreke) around 2010 as part of the smali project for Android reverse engineering.

SEE ALSO

apktool(1), dex2jar(1), jadx(1)

Copied to clipboard
Kai