예제 #1
0
from apkutils import APK

file_path = os.path.abspath(
    os.path.join(os.path.dirname(__file__), "..", 'data', 'test'))
apk = APK(file_path)

package = apk.get_manifest().get('@package', None)
if not package:
    exit()

icon_id = apk.get_manifest().get('application', {}).get('@android:icon', None)
if not icon_id:
    exit()

icon_id = icon_id[1:].lower()
datas = xmltodict.parse(apk.get_arsc().get_public_resources(package))


def get_icon_path():
    for item in datas['resources']['public']:
        if icon_id not in item.get('@id'):
            break
        return (item.get('@type'), item.get('@name'))


icon = get_icon_path()
for item in apk.get_files():
    name = item.get('name')
    if icon[0] in name and icon[1] in name:
        print(name)
예제 #2
0
파일: youtube.py 프로젝트: defer/apkutils
import os
import os
import unittest
import zipfile
from collections import OrderedDict

import xmltodict
from apkutils.axml.arscparser import ARSCParser

from apkutils import APK

file_path = os.path.abspath(
    os.path.join(os.path.dirname(__file__), "..", 'data', 'youtube.zip'))

# file_path = os.path.abspath(os.path.join(
#     os.path.dirname(__file__), "..", 'data', 'i15.zip'))
apk = APK(file_path)

arsc = apk.get_arsc()

# file_path = os.path.abspath(os.path.join(
#     os.path.dirname(__file__), "..", 'data', 'youtube.zip'))

# with zipfile.ZipFile(file_path, mode="r") as zf:
#     data = zf.read('resources.arsc')
#     arscobj = ARSCParser(data)

# apk = apkutils.APK(file_path)
# arsc = apk.get_asrc()
package = arsc.get_packages_names()[0]
print(package)