什么是加殼掏膏?
利用特殊的算法劳翰,對可執(zhí)行文件的編碼進(jìn)行改變(比如壓縮、加密)馒疹,以達(dá)到保護(hù)程序代碼的目的
什么是脫殼佳簸?
摘掉殼程序,將未加密的可執(zhí)行文件還原出來(有些人也稱為“砸殼”)
脫殼主要有2種方法:硬脫殼颖变、動(dòng)態(tài)脫殼
iOS中采取“硬脫殼”的方式
iOS中有很多好用的脫殼工具
Clutch:https://github.com/KJCracks/Clutch
dumpdecrypted:https://github.com/stefanesser/dumpdecrypted/
凡是App Store上的應(yīng)用都有加殼
如何驗(yàn)證可執(zhí)行文件是否已經(jīng)脫殼生均?
1.使用MachOView軟件
查看Load Commands -> LC_ENCRYPTION_INFO -> Crypt ID的值,0代表未加密
machOView2.jpeg
2.通過otool命令行也可以:
otool -l 可執(zhí)行文件路徑 | grep crypt
示例
otool -l MoneyAssistant | grep crypt
輸出
cryptoff 16384
cryptsize 8404992
cryptid 1
cryptoff 16384
cryptsize 9142272
cryptid 1
說明PP助手是有加密的
一.Clutch安裝
1.下載最新版本Clutch文件
https://github.com/KJCracks/Clutch/releases
2.建議去掉版本號(hào)腥刹,改名為Clutch
3.將Clutch文件拷貝到iPhone的/usr/bin目錄
二.Clutch 使用
登錄服務(wù)器
輸入
Clutch
如果出現(xiàn)了
-sh: /usr/bin/Clutch: Permission denied
說明權(quán)限不夠马胧,賦予“可執(zhí)行的權(quán)限
chmod +x /usr/bin/Clutch
再次輸入Clutch
指令
Usage: Clutch [OPTIONS]
-b --binary-dump <value> Only dump binary files from specified bundleID
-d --dump <value> Dump specified bundleID into .ipa file
-i --print-installed Print installed applications
--clean Clean /var/tmp/clutch directory
--version Display version and exit
-? --help Display this help and exit
-n --no-color Print with colors disabled
列出已安裝在手機(jī),未脫殼的應(yīng)用
Clutch -i
輸出
Installed apps:
1: 愛思加強(qiáng)版 <com.pd.A4Player>
2: 微信 <com.tencent.xin>
3: こつこつ家計(jì)簿-無料のカレンダー家計(jì)簿 <com.doubibi74.money76>
4: 今日頭條 <com.ss.iphone.article.News>
輸入APP序號(hào)或者Bundle Id進(jìn)行脫殼操作:Clutch -d APP序號(hào)或BundleId
Clutch -d 3
輸出
…
Zipping CodePush.framework
Zipping DOUAudioStreamer.framework
Zipping DoubleConversion.framework
Zipping FLAnimatedImage.framework
Zipping Masonry.framework
Zipping REFrostedViewController.framework
Zipping RNFS.framework
Zipping React.framework
Zipping SDWebImage.framework
Zipping SwiftyJSON.framework
Zipping ZFPlayer.framework
Zipping folly.framework
Zipping glog.framework
Zipping react_native_fetch_blob.framework
Zipping react_native_video.framework
Zipping react_native_wkwebview.framework
Zipping yoga.framework
DONE: /private/var/mobile/Documents/Dumped/com.pd.A4Player-iOS9.0-(Clutch-2.0.4).ipa
脫殼的地址:
/private/var/mobile/Documents/Dumped/com.pd.A4Player-iOS9.0-(Clutch-2.0.4).ipa
這個(gè)ipa包就是脫殼后的ipa包,解壓拿到Mach-O文件后,可以使用MachOView進(jìn)行驗(yàn)證是否已經(jīng)脫殼
查看文件類型
比如PP助手可執(zhí)行文件MoneyAssistant
file MoneyAssistant
輸出
MoneyAssistant: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O executable arm_v7] [arm64]
MoneyAssistant (for architecture armv7): Mach-O executable arm_v7
MoneyAssistant (for architecture arm64): Mach-O 64-bit executable arm64