當(dāng)Mac升級(jí)了OSX 10.11后奖恰,配置class-dump的時(shí)候钩述,會(huì)發(fā)現(xiàn)逆向書(shū)上推薦的class-dump存放目錄/usr/bin,class-dump存放不進(jìn)去寨躁,嘗試過(guò)用sudo 還是不被允許。
- 原因是 OSX10.11的一個(gè)新特性 Rootless,也叫System Integrity Protection(SIP)和SELinux差不多牙勘,都是限制root用戶(hù)的權(quán)限职恳。
其實(shí)可以在RecoveryMode關(guān)閉這個(gè)特性,這樣就直接可以讀寫(xiě)/usr/bin了方面,不過(guò)不建議放钦。
(關(guān)閉方法:開(kāi)機(jī)的時(shí)候按住option出現(xiàn)選擇磁盤(pán)的界面按command + R進(jìn)入RecoveryMode,選擇實(shí)用工具終端恭金,輸入csrutil disable回車(chē)搞定)
查找網(wǎng)上的資料操禀,目前我用的方法是改變 class-dump 的環(huán)境變量來(lái)使用。
class-dump下載地址:http://stevenygard.com/projects/class-dump/
- 首先打開(kāi)Terminal蔚叨,輸入mkdir ~/bin床蜘,在當(dāng)前用戶(hù)根目錄下創(chuàng)建一個(gè)bin目錄。
- 把下載下來(lái)的 dmg 打開(kāi)蔑水,復(fù)制文件里面的class-dump到創(chuàng)建的bin目錄下廉涕。賦予其可執(zhí)行權(quán)限:
chmod +x ~/bin/class-dump
- 打開(kāi)bash_profile文件配置環(huán)境變量:
vim ~/.bash_profile
**按下 i 鍵進(jìn)入編輯狀態(tài)涧至,在最下方加一行 **
export PATH=$HOME/bin/:$PATH
按下esc鍵,再按 shift + ":" 輸入 "wq" 進(jìn)行保存退出編輯
- 在Terminal中執(zhí)行
source ~/.bash_profile
完成右犹!
- 測(cè)試是否改變成功
測(cè)試結(jié)果為:
MelodydeMBP:~ melody$ class-dump
class-dump 3.5 (64 bit)
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 in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS<version>.sdk
--sdk-mac specify Mac OS X version (will look in /Developer/SDKs/MacOSX<version>.sdk
--sdk-root specify the full SDK root path (or use --sdk-ios/--sdk-mac for a shortcut)
MelodydeMBP:~ melody$
到了這里 class-dump的安裝基本完成了^ ^
感謝你們的閱讀执赡,歡迎來(lái)糾錯(cuò)與交流。
參考鏈接:
http://bbs.iosre.com/t/10-11-usr-bin-class-dump/1936/8
http://blog.csdn.net/majiakun1/article/details/52064435