iOS逆向工具-Theos

閱讀此文前,請(qǐng)確保iOS設(shè)備已越獄,否則一切都是空談!

1.環(huán)境安裝

a.指定xcode(根據(jù)自己xcode路徑來(lái)):

sudo xcode-select -s/Applications/Xcode.app/Contents/Developer

b.下載Theos(export很重要):

export THEOS=/opt/theos sudo git clone git://github.com/theos/theos.git $THEOS

c.下載ldid :
http://joedj.net/ldid 然后復(fù)制到/opt/theos/bin 然后sudo chmod 777 /opt/theos/bin/ldid

d.配置CydiaSubstrate:

注意
新版本Theos請(qǐng)直接跳過(guò) 運(yùn)行Theos自動(dòng)化配置腳本 直接使用iFunBox提取CydiaSubstrate

用iFunBox等iPhone上的工具,將iOS上/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate拷貝到電腦上 然后改名為libsubstrate.dylib , 然后拷貝到/opt/theos/lib 中.

e.配置dkpg

deb 是越獄開(kāi)發(fā)安裝包的標(biāo)準(zhǔn)格式,而 dpkg-deb 是操作 deb 文件的工具,有了這個(gè)工具,Theos 才能將工程正確地打包成 deb 包。
從[下載](https://raw.githubusercontent.com/DHowett/dm.pl/master/dm.pl)下載dm.pl,將其重命名為 dpkg-deb 后(如果后綴名還是.pl,顯示簡(jiǎn)介中可以修改),
放到 “/opt/theos/bin/“ 目錄下,然后設(shè)置它的可執(zhí)行權(quán)限:

sudo chmod 777 /opt/theos/bin/dpkg-deb

其實(shí),Theos 已經(jīng)是一個(gè) tweak 的開(kāi)發(fā)環(huán)境了,但是由于這里只是因?yàn)樾枰幾g tweak 而用到它,所以它的很多后續(xù)配置也沒(méi)有詳細(xì)講解了。

至此,我們的安裝環(huán)境就搭建完了,下一步可以正式地開(kāi)始安裝 tweak 了。

2.Theos用法

輸入
/opt/theos/bin/nic.pl 
NIC 2.0 - New Instance Creator
------------------------------
  [1.] iphone/activator_event
  [2.] iphone/application_modern
  [3.] iphone/cydget
  [4.] iphone/flipswitch_switch
  [5.] iphone/framework
  [6.] iphone/ios7_notification_center_widget
  [7.] iphone/library
  [8.] iphone/notification_center_widget
  [9.] iphone/preference_bundle_modern
  [10.] iphone/tool
  [11.] iphone/tweak
  [12.] iphone/xpc_service
Choose a Template (required):

選擇 [11.] iphone/tweak

Choose a Template (required): 11
Project Name (required): iOSREProject
Package Name [com.yourcompany.iosreproject]: com.yuhao.iosreproject
Author/Maintainer Name [yuhao]: sthyuhao
[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]: com.apple.springboard
[iphone/tweak] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]: SpringBoard
Instantiating iphone/tweak in iosreproject/...
Done.

第一個(gè)相當(dāng)于工程文件夾的名字
第二個(gè)相當(dāng)于bundle id
第三個(gè)就是作者
第四個(gè)是作用對(duì)象的bundle identifier
第五個(gè)是要重啟的應(yīng)用

完成這幾步之后,一個(gè)iosreproject文件夾就在當(dāng)前目錄生成了,該文件夾就是剛創(chuàng)建的tweak工程。

編寫(xiě)Tweak

%hook SpringBoard
-(void)applicationDidFinishLaunching:(id)application {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome"message:@"Welcome to your iPhone!"delegate:nilcancelButtonTitle:@"Thanks"otherButtonTitles:nil];
[alert show];
[alert release];
%orig;
}
%end

為什么要release 因?yàn)門(mén)weak默認(rèn)編碼方式是MRC
如果需要ARC的話 在MakeFile中插入TweakName_CFLAGS = -fobjc-arc

在Tweak注入之前需要先在終端執(zhí)行

export THEOS=/opt/theos/
export THEOS_DEVICE_IP=xxx.xxx.xxx.xxx(手機(jī)的ip地址)

3.構(gòu)建工程

make package install

過(guò)程會(huì)讓你輸入兩次iphoen密碼 , 默認(rèn)是alpine

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

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

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