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
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 axmldec using Homebrew:
brew tap ytsutano/toolbox
brew install axmldec
Or, download the binary from Releases.
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
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)' -
Example of using the python binding:
from pyaxmldec import AXMLDec
dec = AXMLDec()
with open("./axmldec_test_data", "rb") as f:
data = f.read()
res = dec.process(data, len(data))
print(res)
-
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/ytsutano/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).