在做逆向的时候最经常遇到了, 怎么查看被人写的 app
的头文件的呢,
这个一定是你的不二之选 class-dump
ta可以将 Objective-C
编写的二进制文件反编出头文件,需要是已砸壳的二进制文件。
1. 安装
下载之后解压
然后把他放在 /usr/local/bin
文件夹下面
打开终端,执行class-dump
,如打印如下信息,说明可安装成功
~ class-dump
class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48)
Usage: class-dump [options] <mach-o-file>
where options are:
-a show instance variable offsets
-A show implementation addresses
--arch <arch> choose a specific architecture from a universal binary (ppc, ppc64, i386, x86_64, armv6, armv7, armv7s, arm64)
-C <regex> only display classes matching regular expression
-f <str> find string in method name
-H generate header files in current directory, or directory specified with -o
-I sort classes, categories, and protocols by inheritance (overrides -s)
-o <dir> output directory used for -H
-r recursively expand frameworks and fixed VM shared libraries
-s sort classes and categories by name
-S sort methods by name
-t suppress header in output, for testing
--list-arches list the arches in the file, then exit
--sdk-ios specify iOS SDK version (will look for /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS<version>.sdk
or /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS<version>.sdk)
--sdk-mac specify Mac OS X version (will look for /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX<version>.sdk
or /Developer/SDKs/MacOSX<version>.sdk)
--sdk-root specify the full SDK root path (or use --sdk-ios/--sdk-mac for a shortcut)
~
如果权限不够咋办, 那就赋予它权限就是了
chmod +x class-dump
2. 使用
使用:将 .ipa
包体修改成 .zip
再解压,进入包体找到 Mach-O
可执行文件 XXX
(一般都和项目一个名字的)
class-dump -H xxx -o outputPath
-
-H 表示要生成头文件
-
-o 用于制定头文件的存放目录
如果出现错误
class-dump[6911:783784] Error: Cannot find offset for address 0x9000000001000626 in stringAtAddress:
说明项目使用了 swift
, 可以使用下面的这个 clas-dump
, 这个被大神修改了, 能
End