How to parse the AndroidManifest.xml file inside an .apk package

前端 未结 16 1416
暖寄归人
暖寄归人 2020-11-22 10:32

This file appears to be in a binary XML format. What is this format and how can it be parsed programmatically (as opposed to using the aapt dump tool in the SDK)?

16条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 10:42

    If your into Python or use Androguard, the Androguard Androaxml feature will do this conversion for you. The feature is detailed in this blog post, with additional documentation here and source here.

    Usage:

    $ ./androaxml.py -h
    Usage: androaxml.py [options]
    
    Options:
    -h, --help            show this help message and exit
    -i INPUT, --input=INPUT
                          filename input (APK or android's binary xml)
    -o OUTPUT, --output=OUTPUT
                          filename output of the xml
    -v, --version         version of the API
    
    $ ./androaxml.py -i yourfile.apk -o output.xml
    $ ./androaxml.py -i AndroidManifest.xml -o output.xml
    

提交回复
热议问题