借助Android sdk提过的aapt工具获取apk包名和首activity

借助Android sdk提过的aapt工具获取apk包名和首activity

def get_packer_activity(addr):
    # 提过apk路径,获取包名和首页activity
    cmd = ‘aapt dump badging ‘+ addr+‘>abc.log‘
    flag = []
    if 0 == os.system(cmd):
        try:
            with open(‘abc.log‘, ‘r‘, encoding=‘UTF-8‘) as file:
                abc = file.readlines()
                for line in abc:
                    if ‘launchable-activity‘ == line.strip()[:19]                             or ‘package: name‘ == line.strip()[:13]:
                        flag.append(line.strip().split(‘\‘‘)[1])
        except FileNotFoundError:
            print(‘未找到需要的文件‘)
        return flag


print(get_packer_activity(‘C:\\Users\\Administrator\\Desktop\\AnTuTu.apk‘))

  

借助Android sdk提过的aapt工具获取apk包名和首activity

上一篇:总汇/2018手机号正则


下一篇:C语言之强制类型转换与指针--#define DIR *((volatile unsigned int *) 0x0022)