def batch_check(app_folder, excel_path): ''' 批量检测多个ipa,并产生excel报告 ''' #遍历folder,找出.ipa文件 if not app_folder or not excel_path: return False check_results = [] ipa_list = os.listdir(app_folder) for ipa in ipa_list: result = {} #每个app的检查结果 print 'start check :', ipa if ipa.endswith('.ipa'): ipa_path = os.path.join(app_folder, ipa) pid = utils.get_unique_str() #获得ipa信息和静态检查 # ipa_parse = IpaParse.IpaParse(ipa_path) # result['name'] = ipa_parse.app_name() # result['version'] = ipa_parse.version() # result['bundle_id'] = ipa_parse.bundle_identifier() # result['tar_version'] = ipa_parse.target_os_version() # result['min_version'] = ipa_parse.minimum_os_version() result['md5'] = get_file_md5(ipa_path) print result['md5'] rsts = check_app_info_and_provision(ipa_path) for key in rsts.keys(): result[key] = rsts[key] #检查ios私有api app = get_executable_path(ipa_path, pid) methods_in_app, methods_not_in_app, private = check_private_api(app, pid) result['private_apis'] = methods_in_app result['private_frameworks'] = list(private) #检查ipa 64支持情况 arcs = check_architectures(app) result['arcs'] = arcs #检查ghost情况 ghost = check_xcode_ghost(app) result['ghost'] = ghost #检查codesign codesign = check_codesign(app) result['codesign'] = codesign check_results.append(result) cur_dir = os.getcwd() #删除检查临时目录 dest_tmp = os.path.join(cur_dir, 'tmp/' + pid) if os.path.exists(dest_tmp): shutil.rmtree(dest_tmp) #将结果转化成excel报告 report_utils.excel_report(check_results, excel_path) return excel_path
def batch_check(app_folder, excel_path): ''' 批量检测多个ipa,并产生excel报告 ''' #遍历folder,找出.ipa文件 if not app_folder or not excel_path: return False check_results = [] ipa_list = os.listdir(app_folder) for ipa in ipa_list: result = {} #每个app的检查结果 print 'start check :', ipa if ipa.endswith('.ipa'): ipa_path = os.path.join(app_folder, ipa) pid = utils.get_unique_str() #获得ipa信息和静态检查 # ipa_parse = IpaParse.IpaParse(ipa_path) # result['name'] = ipa_parse.app_name() # result['version'] = ipa_parse.version() # result['bundle_id'] = ipa_parse.bundle_identifier() # result['tar_version'] = ipa_parse.target_os_version() # result['min_version'] = ipa_parse.minimum_os_version() result['md5'] = get_file_md5(ipa_path) print result['md5'] rsts = check_app_info_and_provision(ipa_path) for key in rsts.keys(): result[key] = rsts[key] #检查ios私有api app = get_executable_path(ipa_path, pid) methods_in_app, methods_not_in_app, private = check_private_api( app, pid) result['private_apis'] = methods_in_app result['private_frameworks'] = list(private) #检查ipa 64支持情况 arcs = check_architectures(app) result['arcs'] = arcs #检查ghost情况 ghost = check_xcode_ghost(app) result['ghost'] = ghost #检查codesign codesign = check_codesign(app) result['codesign'] = codesign check_results.append(result) cur_dir = os.getcwd() #删除检查临时目录 dest_tmp = os.path.join(cur_dir, 'tmp/' + pid) if os.path.exists(dest_tmp): shutil.rmtree(dest_tmp) #将结果转化成excel报告 report_utils.excel_report(check_results, excel_path) return excel_path
def batch_check(ipa_folder, excel_path): if not ipa_folder or not excel_path: return False check_results = [] for ipa in os.listdir(ipa_folder): if ipa.endswith('.ipa'): print('start check ipa %s' % ipa) ipa_path = os.path.join(ipa_folder, ipa) print(ipa_path) try: r = check_ipa(ipa_path) if r: check_results.append(r) except Exception as e: print(e) continue # 将结果导出为Excel report_utils.excel_report(check_results, excel_path) return excel_path
ipa_list = os.listdir(app_folder) for ipa in ipa_list: print 'start check :', ipa if ipa.endswith('.ipa'): ipa_path = os.path.join(app_folder, ipa) #单个app的检查结果 try: r = check_ipa(ipa_path) if r: check_results.append(r) except Exception, e: print e continue #将结果转化成excel报告 report_utils.excel_report(check_results, excel_path) return excel_path def export_excel_report(ipa_list): excel_dir = PathUtil.excel_dir() excel_path = os.path.join(excel_dir + utils.get_unique_str() + '.xlsx') ipa_folder = PathUtil.upload_dir() check_results = [] for ipa in ipa_list: if ipa.endswith('.ipa'): ipa_path = os.path.join(ipa_folder, ipa) # 单个app的检查结果 try: r = check_ipa(ipa_path) if r:
ipa_list = os.listdir(app_folder) for ipa in ipa_list: print 'start check :', ipa if ipa.endswith('.ipa'): ipa_path = os.path.join(app_folder, ipa) #单个app的检查结果 try: r = check_ipa(ipa_path) if r: check_results.append(r) except Exception, e: print e continue #将结果转化成excel报告 report_utils.excel_report(check_results, excel_path) return excel_path if __name__ == '__main__': ####### #check one app # ipa_path = "/Users/summer-wj/code/svn/ljsg_for_netease_20150928_resign.ipa" # private_1 = open("tmp/private_1.txt", "w") # private_2 = open("tmp/private_2.txt", "w") # #将strings内容输出到文件中 # pid = app_utils.get_unique_str() # app = get_executable_path(ipa_path, pid) # print app # arcs = check_architectures(app) # print arcs