How to use the apkutils.axml.axmlparser.AXML function in apkutils

To help you get started, we’ve selected a few apkutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mikusjelly / apkutils / apkutils / apk.py View on Github external
def _init_manifest(self):
        ANDROID_MANIFEST = "AndroidManifest.xml"
        try:
            with zipfile.ZipFile(self.apk_path, mode="r") as zf:
                if ANDROID_MANIFEST in zf.namelist():
                    zipinfo = zf.getinfo(ANDROID_MANIFEST)
                    zipinfo.flag_bits = 0
                    data = zf.read(ANDROID_MANIFEST)
                    try:
                        axml = AXML(data)
                        if axml.is_valid:
                            self.org_manifest = axml.get_xml()
                            self.manifest = xmltodict.parse(
                                self.org_manifest)['manifest']
                    except Exception as e:
                        raise e
        except Exception as e:
            raise e
github mikusjelly / apkutils / apkutils / __init__.py View on Github external
def _init_org_manifest(self):
        ANDROID_MANIFEST = "AndroidManifest.xml"
        try:
            with apkfile.ZipFile(self.apk_path, mode="r") as zf:
                if ANDROID_MANIFEST in zf.namelist():
                    data = zf.read(ANDROID_MANIFEST)
                    try:
                        axml = AXML(data)
                        if axml.is_valid:
                            self.org_manifest = axml.get_xml()
                    except Exception as e:
                        raise e
        except Exception as e:
            raise e

        # fix manifest
        self.org_manifest = re.sub(
            r'\s:(="[\w]*?\.[\.\w]*")', r' android:name\1', self.org_manifest)