Posted in Python onJanuary 10, 2020
这篇文章主要介绍了python如何获取apk的packagename和activity,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
实现代码如下:
# 找出packagename和activity import os import re class packagename_activity: def get_packagename(self, path): aapt = [] os.system(f'aapt dump badging {path}> ../xc_logs/AaptLog.txt') with open('../xc_logs/AaptLog.txt', 'rb') as f: p1 = "package: name='(.+?)'" results1 = re.finditer(pattern=p1, string=f.readline().decode('utf-8')) for r in results1: packagename = r.group(1) aapt.append(packagename) p2 = "launchable-activity: name='(.+?)'" st = str(f.readlines()) results2 = re.findall(p2, st) activity = results2[0] aapt.append(activity) return aapt if __name__ == '__main__': a=packagename_activity() b=a.get_packagename('../xc_apk/wangyiyunyinyue.apk') print(b)
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持三水点靠木。
python如何获取apk的packagename和activity
- Author -
badbadboy声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@