【class-dump】Fat file doesn't contain a valid Mach-O file for the specified architecture (arm64). It probably means that class-dump was run on a static library, which is not supported


#1

使用class-dump.a静态库进行dump, 我输入的命令是

sudo class-dump --arch armv7 -s -S -H ./libTest.a -o ~/Documents/output

但是返回下面的错误

Fat file doesn't contain a valid Mach-O file for the specified architecture (armv7).  It probably means that class-dump was run on a static library, which is not supported.

然后使用file命令查看.a文件

./libTest.a: Mach-O universal binary with 5 architectures: [arm_v7: current ar archive] [arm_v7s] [i386] [x86_64] [arm64]
./libTest.a (for architecture armv7):	current ar archive
./libTest.a (for architecture armv7s):	current ar archive
./libTest.a (for architecture i386):	current ar archive
./libTest.a (for architecture x86_64):	current ar archive
./libTest.a (for architecture arm64):	current ar archive

我看过狗神在这个帖子里的回复Class-dump: class-dump-x和class-dump-z如何分析dylib等文件?

难道我分析的这个.a文件不是标准的Mach-O格式?

求老司机带带我。


#2

class-dump 不支持静态库分析


#3

翻开小黄书, 看到醒目的"class-dump的对象是mach-o格式的二进制文件,如framework 的库文件和app的可执行文件"。

so, .a的静态库我该如何dump?


#4

直接IDA


#5

好, 不过idaq只是查看头文件觉得还是挺麻烦的


#6

写个dummy的程序把这个force link进去然后再dump主程序就好了吧


#7

otool -tV BINARY


#8

把.a文件放入demo中,打个包,然后dump包里面的macho就可以了