iOS逆向, 基礎(chǔ)工具之class-dump

class-dump

顧名思義就是來dump頭文件的工具, 簡單好用
下載地址
先下載class-dump.dmg, 然后把里面的class-dump復(fù)制出來就可以用了, 如果希望直接運行可執(zhí)行文件那么加到/usr/bin里.

但是macos的限制, /usr/bin不讓寫文件, 可以參考這里修改權(quán)限.

然后直接復(fù)制到/usr/bin下,

chomd 777 /usr/bin/class-dump

直接調(diào)用 class-dump使用即可.

另一種在自己的用戶目錄下配置(推薦)

在當(dāng)前用戶新建一個bash_profile

mkdir ~/bin

mv ../class-dump ~.bin

open -e .bash_profile 輸入 export PATH=?$HOME/bin/:$PATH

source ~/.bash_profile

就可以了(后面theos的一些配置也可以放在bash_profile里, 還是比較方便的).

在dump有swift類可能會報錯

Error: Cannot find offset for address 0x6800f3c2 in stringAtAddress:

swift的解決方案

運行實例

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)

一般用法

找到對應(yīng)的xxx.app文件, 然后定位app的可執(zhí)行文件

cd SpringBoard.app
plutil -p info.plist | grep CFBundleExecutable
  "CFBundleExecutable" => "SpringBoard"
class-dump -S -s -H SpringBoard -o ~/hfiles/SpringBoardHeaders

至此SpringBoard的所有頭文件就dump出來了


SpringBoard.png

至于如何導(dǎo)出SpringBoard.app, 首先是需要一臺越獄的設(shè)備, 使用SSH或者其他文件管理從手機中導(dǎo)出, 這里不多贅述, 會有其它文檔詳細(xì)介紹, 這里只記錄工具的配置和基本使用.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容