def zipalign(apk_path): output_apk_name = os.path.splitext( os.path.basename(apk_path))[0] + '_aligned.apk' retcode, msg = star.runcmd2([ PathManager.get_zipaligin_tool_path(), '-f', '4', apk_path, os.path.join(Utils.getparent(apk_path), output_apk_name) ]) if retcode == 0: print('zipalign successed') return retcode, msg
def viewsign(f): infoFile = os.path.splitext(f)[0] + '_signinfo.txt' check_v2sign_tool_path = PathManager.get_checkV2_sign_tool_path() code, info = star.runcmd2(['java', '-jar', check_v2sign_tool_path, f]) if code == 0: msg_dic = json.loads(info) if msg_dic['isV1OK']: # 如果使用了v1签名,不管是否使用了v2签名检测v1签名 code, info = star.runcmd2( [Constant.KEYTOOL_FILENAME, '-printcert', '-jarfile', f]) if msg_dic['isV2']: info += u"该apk使用了V1+V2签名,其中V1签名信息如上所示" else: info += u"该apk仅仅用了V1签名,其签名信息如上所示" if msg_dic['isV2'] and not msg_dic['isV1OK']: # 未使用v1签名,仅仅使用了v2签名 info += u"该apk仅仅使用了v2签名,未使用v1签名,具体信息如上所示" if code == 0: star.log(info, infoFile) if os.path.exists(infoFile): star.run_cmd_asyn(['notepad', infoFile]) return code, info
def md2pdf(f): return star.runcmd2([PathManager.get_mdconverter_path(), f, 'pdf'])
def md2html(f): return star.runcmd2([PathManager.get_mdconverter_path(), f])
def smali(f): return star.runcmd2([PathManager.get_apktool_path(), 'b', f])
def baksmali(f): print(u'反编译完成') return star.runcmd2([PathManager.get_apktool_path(), 'd', '-f', f])
def get_package(f): retcode, msg = star.runcmd2( [PathManager.get_aapt_path(), 'dump', 'badging', f]) if retcode == 0: package = star.find("package: name='(.*?)'", msg) return package
def sign_v1_v2(f): print(u"使用v1+v2签名") return star.runcmd2([PathManager.get_v2_sign_tool_path(), f])
def sign(f): return star.runcmd2([PathManager.get_signtool_path(), f])