Skip to content

androguard/axml-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

axml-parser

Android binary XML (AXML) and resource (ARSC) parser in pure Rust. Port of androguard/axml Python library.

Features

  • AXML: Full parser for Android binary XML (e.g. AndroidManifest.xml inside APKs)
    • Decodes chunk-based binary XML to readable XML
    • Extracts package, version, permissions, and manifest metadata
    • Handles namespaces, attributes, and edge cases (null bytes, wrong chunk start, etc.)
  • ARSC: Parser for resources.arsc (Android resource table)
    • Reads chunk headers and package names
    • Resource ID parsing (@7F040001 style)
    • Full resource value resolution can be extended

Installation

cargo add axml-parser

Or add to Cargo.toml:

[dependencies]
axml-parser = "0.0.2"

Usage

CLI

# Decode binary AndroidManifest.xml to XML
axml -i AndroidManifest.xml

# Decode resources.arsc to public resources XML
arsc -i resources.arsc

Library API

use axml_parser::{AXMLPrinter, ARSCParser, ARSCHeader, ARSCResTableConfig};

// AXML: binary manifest -> XML and metadata
let data = std::fs::read("AndroidManifest.xml").unwrap();
let ap = AXMLPrinter::new(&data);
assert!(ap.is_valid());
println!("Package: {}", ap.package());
println!("Version: {:?}", ap.androidversion());
let xml = ap.get_xml(true);

// ARSC: parse resources.arsc
let arsc_data = std::fs::read("resources.arsc").unwrap();
let arsc = ARSCParser::new(&arsc_data).unwrap();
for name in arsc.get_packages_names() {
    println!("Package: {}", name);
}

// Parse resource ID
let (res_id, package) = ARSCParser::parse_id("@7F040001").unwrap();

Testing

Tests are ported from the Python androguard/axml suite. Test data is under tests/AXML/ and tests/ARSC/.

cargo test

License

Apache-2.0 (same as androguard/axml).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages