Extract the specified archive members into the files named by the command line arguments.
解压静态库的object文件
lipo -info
➜ tmp lipo -info AFNetworking_arm64 Non-fat file: AFNetworking_arm64 is architecture: arm64
lipo AFNetworking -thin arm64 -output AFNetworking_arm64
ar -x
ar -x /Users/devzkn/Library/Developer/Xcode/DerivedData/KNCocoaTouchStaticLibrary-abyviwmexygzznfnvgkfphqmjayr/Build/Products/Debug-iphoneos/libKNCocoaTouchStaticLibrary.a -rw-r--r--@ 1 devzkn staff 4267 May 30 11:41 Info.plist -rw-r--r-- 1 devzkn staff 2040 Jul 2 10:02 __.SYMDEF SORTED -rw-r--r-- 1 devzkn staff 42744 Jul 2 10:02 UIWebView+TS_JavaScriptContext.o -rw-r--r-- 1 devzkn staff 19184 Jul 2 10:02 KNTestWebViewController.o -rw-r--r-- 1 devzkn staff 4480 Jul 2 10:02 CMPayConst.o -rw-r--r-- 1 devzkn staff 4136 Jul 2 10:02 KNCocoaTouchStaticLibrary.o -rw-r--r-- 1 devzkn staff 14472 Jul 2 10:02 HCPEnvrionmentalVariables.o -rw-r--r-- 1 devzkn staff 67672 Jul 2 10:02 KNBaseWebViewController.o -rw-r--r-- 1 devzkn staff 24904 Jul 2 10:02 IPLoadingTool.o -rw-r--r-- 1 devzkn staff 42680 Jul 2 10:02 HCPCMPayProgress.o -rw-r--r-- 1 devzkn staff 58784 Jul 2 10:02 HCPPopLoadingDialog.o
分析object文件
使用ld 将所有的.o文件链接成一个object文件,以便使用hopper 对一个object文件进行分析
➜ tmp ld -r -arch arm64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk ./*.o -o ../output ➜ tmp ls -lrt ../output -rw-r--r-- 1 devzkn staff 99284 Jul 2 10:13 ../output
判断object文件是否包含bitcode,如果不包含,将不会有内容输出。
➜ tmp otool -l IPLoadingTool.o | grep bitcode
查询包含xx字符的object文件
➜ tmp grep "_winLoading" -rn ./ Binary file .//IPLoadingTool.o matches
See Also
/Users/devzkn/bin//knpost ar create and maintain library archives -t iosre #原来""的参数,需要自己加上""