AndroidManifest.xml
in an APK file is binary
encoded. This tool accepts either a binary or a text XML file and prints the
decoded XML to the standard output or a file. It also allows you to extract the
decoded AndroidManifest.xml
and any other xml file directly from an APK file.
Tools such as Apktool are designed to process the whole APK file including the resource files for reverse engineering purpose. They may also need a Java virtual machine to run. As a result, they are too slow for batch processing many APK files just to get the XML information. In contrast, axmldec is specialized for binary XML decoding and written in simple modern C++, so it runs nicely within a shell script.
The parser is taken from Jitana, a
graph-based static-dynamic hybrid DEX code analysis tool. You can use
jitana::read_axml()
instead of the standard
boost::property_tree::read_xml()
to read a binary XML file into
boost::property_tree::ptree
(Boost Property Tree) in your C++
program.
You can install the original project by Yutaka Tsutano using Homebrew:
brew tap ytsutano/toolbox
brew install axmldec
Or, download the binary from the original Releases page.
Download the .exe file from Releases.
Build the tool from the source code (see below).
Pass the manifest file (either binary or text) to decode:
axmldec -o output.xml AndroidManifest.xml
This will write the decoded XML to output.xml
. You can specify the same
filename for input and output to decode the file in-place.
If an APK file is specified, axmldec automatically extracts and decodes
AndroidManifest.xml
:
axmldec -o output.xml com.example.app.apk
If the -x
option is passed, axmldec can decode a different xml file (requires forward slashes)
axmldec -o output.xml com.example.app.apk -x res/layout/preference.xml
axmldec can read bytes from the standard input as an encoded xml file:
type input.xml | axmldec -o output.xml
axmldec writes to the standard output if the -o
option is not specified. This
is useful when additional processing is required. For example, you can extract
the package name from an APK file using xmllint:
axmldec com.example.app.apk | xmllint --xpath 'string(/manifest/@package)' -
-
Install Boost, zlib, and CMake. Make sure you have a latest C++ compiler.
-
Clone axmldec and its submodule from GitHub:
git clone --recursive https://github.com/alesimula/axmldec.git
-
Compile axmldec:
cmake -DCMAKE_BUILD_TYPE=Release . && make
- Yutaka Tsutano at University of Nebraska-Lincoln.
- See LICENSE.md for license rights and limitations (ISC).