Skip to main content

Python library for the Android binary XML (AXML) file format.

Project description

AXML

AXML/ARSC: The Rosetta Stone for Android's Binary XML

Powered By: Androguard

Android doesn't speak in plain text XML. To save space and speed up parsing, it uses a compressed, obfuscated binary format (AXML) for its manifests and a complex table (ARSC) for its resources. axml is your translator.

This is a standalone, dependency-free, native Python library built to decode the secrets of Android's binary XML and resource files. It is a battle-hardened pillar of the new Androguard Ecosystem, providing the critical ability to turn machine-optimized formats back into human-readable intelligence.

This is a library for handling the AXML file format. AXML is the informal common name for the compiled binary XML data format used in Android app files. The Android Open Source Project does not seem to have named the format, other than referring to is as binary XML or compiled XML.So AXML stands for Android XML. The file format is based on compiling XML source into a binary format based on protobuf. There are a number of different Android XML file types that are compiled to AXML, these are generically known as Android Resources.

All of these files are included in the APK's ZIP package with the file extension .xml even though they are actually AXML and not XML.

Some specific data files, like String Resources and Style Resources, are instead compiled into a single file resources.arsc in its own data format, known as ASRC. AXML files often refer to values that are in resources.arsc.

The entry point for an app is the "app manifest" defines the essential data points that every app must have, like Package Name and Version Code, and includes lots of other metadata that describe the app. Every Android app file (APK) must include AndroidManifest.xml, which in the APK is the compiled binary AXML format, not XML, despite the file extension. The source code files for the binary app manifest file are also called AndroidManifest.xml, but they are actually XML. There can be multiple source files, but there is only ever one single compiled binary AndroidManifest.xml that is valid in the APK.

https://developer.android.com/guide/topics/manifest/manifest-intro#reference

Installation

If you would like to install it locally, please create a new venv to use it directly, and then:

$ git clone https://github.com/androguard/axml.git
$ pip install -e .

or directly via pypi:

$ pip install axml

Usage

Two new commands will be exported in your current environnement: axml and arsc, that will allow to read and display the corresponding files.

$ axml -i AndroidManifest.xml
$ arsc -i resources.arsc

API

The most easy way to use this project is probably directly via using the API:

>>> from axml.axml import AXMLPrinter
>>> from axml.arsc import ARSCPrinter
>>> AXMLPrinter(open("AndroidManifest.xml", "rb").read())
>>> obj
<axml.axml.printer.AXMLPrinter object at 0x76b5a34b0550>
>>> obj.package
'org.t0t0.androguard.TC'
>>> obj.androidversion
{'Code': '1', 'Name': '1.0'}

>>> obj = ARSCPrinter(open("test.arsc", "rb").read())
>>> obj
<axml.arsc.printer.ARSCPrinter object at 0x76b5a34b1310>
>>> obj.get_xml()
b'<resources>\n<public type="drawable" name="icon" id="0x7f020000"/>\n<public type="drawable" name="icon" id="0x7f020000"/>\n<public type="drawable" name="icon" id="0x7f020000"/>\n<public type="layout" name="main" id="0x7f030000"/>\n<public type="string" name="hello" id="0x7f040000"/>\n<public type="string" name="app_name" id="0x7f040001"/>\n</resources>\n'

AXML binary format

Some references about the binary AXML format:

Android binary XML

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

axml-0.0.2.tar.gz (103.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

axml-0.0.2-py3-none-any.whl (100.5 kB view details)

Uploaded Python 3

File details

Details for the file axml-0.0.2.tar.gz.

File metadata

  • Download URL: axml-0.0.2.tar.gz
  • Upload date:
  • Size: 103.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for axml-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4f0244afadda2997b6ce045dbda448efcc120acd05af85bf8aa4b86cfcf9eb3e
MD5 846e54ecda02b0f465f910d21f68222f
BLAKE2b-256 b8535700f69439db56c8bafd4ebf96d841494aea0182065f1830d4cd91280310

See more details on using hashes here.

File details

Details for the file axml-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: axml-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 100.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for axml-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa2dbda0938425306b32d4601ff4a8b7d0935c62a1ede47e54099dbd2d79b9de
MD5 e59f0454234b6bbcc4722a5d79734e81
BLAKE2b-256 9261f12b64e22f0785dc5aabc32771aa3b5a5f638bb65673bcd2c369fc74d8b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page