Exemplo n.º 1
0
 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
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    def _init_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

                    if self.org_manifest:
                        try:
                            self.manifest = xmltodict.parse(
                                self.org_manifest, False)['manifest']
                        except xml.parsers.expat.ExpatError as e:
                            print(self.apk_path, e)
                        except Exception as e:
                            raise e
        except Exception as e:
            raise e