As far as I know, both apktool and baksmali are able to produce smali code out of .apk (.dex) files, and apktool makes use of the dexlib2. They are both APK packing/unpacking tools
But still I am not clear what are the main differences between apktool and smali/baksmali. in temrs of functionality with .dex files and extended features?
PS: One of the difference that I just found out is that apktool is able to work with multiple dex files inside an apk while baksmali cannot (at least for the time being)
I did try to read the source code but due to the lack of experience, I could not really understand the working flow of both tools. I would really appreciate If anyone could suggest some readings or flow charts, etc.
Thank you!
Smali is intended to serve as a basis for further analysis of Android applications and security implementation techniques. Android applications are mainly written in Java. The Java source code is first compiled into a Java Virtual Machine (JVM) bytecode using a standard Java compiler called Javac.
smali/baksmali are an assembler/disassembler pair for the dex format. Baksmali takes a dex file and produces human readable assembly, and smali takes the human readable assembly and produces a dex file.
Apktool is a more general took for unpacking and repacking an apk. It actually uses smali/baksmali under the hood in order to assemble/disassemble the dex file. It also unpacks the binary resources and binary xml files back into the standard textual format, etc.
In short, apktool
is for APK files and baksmali
is for DEX files.
APK file is a zip archive with specific structure. This represents the Android app. This is what your smart phone or tablet downloads from the market, usually Google Play. The archive consists of the manifest, resources, asserts/data files, native libraries and the DEX file.
DEX file contains the app code. See https://source.android.com/devices/tech/dalvik/dex-format.html for details.
One more thing to say, is that apktool
is capable to extract and pack back the resources file. (I believe baksmali
doesn't do that, need to check.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With