iOS扫描项目中是否有UIWebview
2020-08-26 本文已影响0人
wealon
为什么要检查是否包含UIWebview呢? 因为苹果爸爸强制要求升级。
检测脚本(checkUIWebView.py)如下:
#!/usr/bin/python
# -*-coding:utf-8 -*-=
import os
import commands
def main():
for path, dir_list, file_list in os.walk('./'):
for file_name in file_list:
# 略过 .DS_Store 文件
if file_name.find('.DS_Store') != -1:
continue
# 略过 没有framework .a 的文件
if path.find('.framework') == -1 and file_name.find('.a') == -1:
continue
full_path = os.path.join(path, file_name)
# print(full_path)
if full_path.endswith('.h'):
continue
(status, output) = commands.getstatusoutput('file %s' % full_path)
index = output.find('Mach-O universal binary')
if index != -1:
# print(full_path)
(status, output) = commands.getstatusoutput('strings %s | grep -ir "uiwebview"' % full_path)
if len(output) > 0:
print full_path
if __name__ == "__main__":
print('Start to check library')
main()
注:
这是一个python脚本,执行需要安装有python环境