Skip to main content

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

Project description

ARParser

Androguard's axml

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 Method

๐Ÿ’ข Requirement PKG ๐Ÿ’ข

termux-setup-storage && pkg update -y && pkg upgrade -y && pkg install python libxslt -y && pip install click pygments rich lxml

๐Ÿ‘‰๐Ÿป To install ARParser, Run only any one cmd from the Installation Method

๐Ÿ’ข PYPI ( Just Testing ) ๐Ÿ’ข

pip install ARParser

1st. Method

๐Ÿ’ข For Latest Commit ( From Mainย  Branch )ย  ๐Ÿ’ข

pip install --force-reinstall https://github.com/TechnoIndian/ARParser/archive/refs/heads/main.zip

Or

pip install --force-reinstall https://github.com/TechnoIndian/ARParser/archive/refs/heads/main.tar.gz

Or

curl -Ls https://github.com/TechnoIndian/Tools/releases/download/Tools/ARParser.sh | bash

2nd. Method

pkg install python git && pip install --force-reinstall git+https://github.com/TechnoIndian/ARParser.git

Uninstall ARParser

pip uninstall ARParser

Usage

AXMLPrinter

โ”œโžข AXMLPrinter ( Support APK & XML )

ARParser axml -i AndroidManifest.xml

Or

ARParser axml AndroidManifest.xml

With APK

ARParser axml Apk_Path.apk

โ”œโžข ID2Name, Default is ID ( @7F140004 ๐’ @xml/network_security_config | _attr_01010003 ๐’ android:name )

ARParser axml Apk_Path.apk -n

โ”œโžข ResParser ( Res AXML Parse )

ARParser axml Apk_Path.apk -r res/xml/xyz.xml

ID2Name

ARParser axml Apk_Path.apk -r res/xml/xyz.xml -n

Mode Help ( --help )

ARParser axml --help 

ARSCParser

โ”œโžข Public XML ( Default )

ARParser arsc Apk_Path.apk

โ”œโžข hex ID ( Resolve ๐’ locale and package )

ARParser arsc Apk_Path.apk -id 7f060008

โ”œโžข Locale ( en-rIN, en-rGB, zh-rCN etc. )

ARParser arsc Apk_Path.apk -l en-rIN

โ”œโžข Type [string|strings|bool|id|color|dimen|integer|public]

ARParser arsc Apk_Path.apk -t string

Mode Help ( --help )

ARParser arsc --help 

Current status

  • Passing androguard tests for axml and arsc.

Structure

axml/
โ”œโ”€โ”€ axml/
โ”‚   โ”œโ”€โ”€ __init__.py       # Expose the public API (parse_axml, AXMLParser, AXMLPrinter)
โ”‚   โ”œโ”€โ”€ apk.py            # input APK_Path.apk, AndroidManifest.xml, resources.arsc
โ”‚   โ”œโ”€โ”€ cli.py            # Command Helper
โ”‚   โ”œโ”€โ”€ main.py           # Script Execution 
โ”‚   โ”œโ”€โ”€ constants.py      # All constants (chunk types, flag values...)
โ”‚   โ”œโ”€โ”€ exceptions.py     # Custom exceptions (like ResParserError)
โ”‚   โ”œโ”€โ”€ stringblock.py    # The StringBlock class and its helper functions (_decode8, _decode16...)
โ”‚   โ”œโ”€โ”€ parser_arsc.py    # The resources parser class and related parsing functions
โ”‚   โ”œโ”€โ”€ parser_axml.py    # The AXMLParser class and related parsing functions
โ”‚   โ”œโ”€โ”€ printer.py        # The AXMLPrinter class for converting parsed AXML into an ElementTree
โ”‚   โ””โ”€โ”€ formatters.py     # Helper functions like format_value and any formatting utilities
โ”‚   โ”œโ”€โ”€ resources
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ public.json
โ”‚   โ”‚   โ”œโ”€โ”€ public.py
โ”‚   โ”‚   โ””โ”€โ”€ public.xml
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_*.py    # Unit tests for each module
โ”œโ”€โ”€ setup.py              # Packaging file
โ”œโ”€โ”€ pyproject.toml        # Build configuration
โ””โ”€โ”€ README.md             # Project description and usage instructions

Goals

  • Write tests early approach, so we can immediately verify breaking changes.
  • Expose a clean public API
  • Standalone capabilities for axml parsing
  • Provide basic documentation

Coding style

  • Follow PEP 257 guidelines using the reStructuredText (reST) format for all docstrings.

AXML binary format

Some references about the binary AXML format:

Android binary XML

๐Ÿ‡ฎ๐Ÿ‡ณ Welcome By Techno India ๐Ÿ‡ฎ๐Ÿ‡ณ

Credit

  • axml compiles XML to protobuf-based AXML
  • androguard compiles XML to protobuf-based AXML

Telegram

Telegram

Project details


Release history Release notifications | RSS feed

This version

0.2

Download files

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

Source Distribution

arparser-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.

arparser-0.2-py3-none-any.whl (106.6 kB view details)

Uploaded Python 3

File details

Details for the file arparser-0.2.tar.gz.

File metadata

  • Download URL: arparser-0.2.tar.gz
  • Upload date:
  • Size: 103.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for arparser-0.2.tar.gz
Algorithm Hash digest
SHA256 5cd66228618ebac89a940977895e1a366a349a9081c75efe905433f78f9b90e5
MD5 4f2426fd46ff0d99a9dbe7f62d2bf835
BLAKE2b-256 49a6b9a53a45c0fdeefe3fdcce03ebb832aa19851c7360917c1a25c491d853a9

See more details on using hashes here.

File details

Details for the file arparser-0.2-py3-none-any.whl.

File metadata

  • Download URL: arparser-0.2-py3-none-any.whl
  • Upload date:
  • Size: 106.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for arparser-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88206cf5cd5b79bb19d16b169055878059afad46210b143e93585fa0c4f70748
MD5 afb91df56130303729fa11bfb68b3824
BLAKE2b-256 8193f6662f0daf97420b6944defe8b2edc202fe436570c207d56a09e27d8f9e6

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