一步一步學逆向
theos-tweak 應該是我們動態(tài)分析中,最為常用的工具了纹坐。 先做個簡單介紹奕污。
準備: 越獄的iPhone手機
theos的安裝
從github下載theos,將theos-master文件名改為theos放在 /opt/
文件下涂炎,如下:
image-20220726212035860.png
theos 使用命令:
創(chuàng)建工程:nic.pl
? ios /opt/theos/bin/nic.pl
NIC 2.0 - New Instance Creator
------------------------------
[1.] iphone/activator_event
[2.] iphone/activator_listener
[3.] iphone/application_modern
[4.] iphone/application_swift
[5.] iphone/control_center_module-11up
[6.] iphone/cydget
[7.] iphone/flipswitch_switch
[8.] iphone/framework
[9.] iphone/library
[10.] iphone/notification_center_widget
[11.] iphone/notification_center_widget-7up
[12.] iphone/preference_bundle
[13.] iphone/preference_bundle_swift
[14.] iphone/theme
[15.] iphone/tool
[16.] iphone/tool_swift
[17.] iphone/tweak
[18.] iphone/tweak_with_simple_preferences
[19.] iphone/xpc_service
[20.] iphone/xpc_service_modern
Choose a Template (required): 18
Project Name (required): bwlTest
Package Name [com.yourcompany.bwltest]: com.wesk.bwltest
Author/Maintainer Name [wujian]: weskhen
[iphone/tweak_with_simple_preferences] MobileSubstrate Bundle filter [com.apple.springboard]: com.apple.mobilenotes
[iphone/tweak_with_simple_preferences] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]:
Instantiating iphone/tweak_with_simple_preferences in bwltest/...
Done.
結構對應解釋:
- 填寫項目信息:創(chuàng)建的方式秃流,一般選擇
iphone/tweak
或iphone/tweak_with_simple_preferences
的編號 - Project Name:項?名稱赂蕴,無要求
- Package Name:項?ID,隨便寫舶胀? 當前要求必需要小寫
- Author/Maintainer Name:作者概说,直接敲回車按照默認做法就?(默認是Mac上的?戶名) ,隨便寫
- [iphone/tweak] MobileSubstrate Bundle filter :需要修改的目標APP的Bundle Identifier(系統備忘錄com.apple.mobilenotes) 可以通過Cycript查看APP的Bundle Identifier
- [iphone/tweak] List of applications to terminate upon installation:安裝后終止的應用程序列表,可忽略
創(chuàng)建的目錄:
-
Tweak.x:重要文件嚣伐,類的hook實現
需要hook具體類糖赔,具體查看Logos語法:http://iphonedevwiki.net/index.php/Logos
control:工程配置的信息
-
Makefile:重要文件,THEOS項目配置信息
如下結構:
TARGET := iphone:clang:latest:7.0
# 指手機系統中的進程
INSTALL_TARGET_PROCESSES = SpringBoard
# 局域網內的手機ip地址轩端, 默認通過USB端口
THEOS_DEVICE_IP = 10.15.48.140
# 監(jiān)聽端口放典,默認就是22
THEOS_DEVICE_PORT = 22
# 支持的架構
ARCHS = armv7 arm64
# Tweak.x文件需要的 famework 庫
iOSRE_FRAMEWORKS=UIKit Foundation
include $(THEOS)/makefiles/common.mk
# 工程名
TWEAK_NAME = tphook
tphook_FILES = Tweak.x
tphook_CFLAGS = -fobjc-arc
include $(THEOS_MAKE_PATH)/tweak.mk
上面的通道,如果開發(fā)中船万,可以直接使用usb的刻撒,利用愛思助手等工具骨田,一鍵“打開ssh通道”耿导。
- .theos :隱藏文件夾
常見命令
修改Tweak.x文件之后,即可使用相關命令:
- 編譯命令:
make
- 打包成deb命令:
make package
- 安裝命令:
make install
- 打包成deb命令并安裝:
make package install
- 清除緩存命令:
make clean
常見異常
報錯:Nothing to be done for `internal-library-compile'..
原因:之前已經編譯過态贤,有緩存導致的舱呻,需要clean一下,命令 make clean報錯:ERROR: package name has characters that aren't lowercase alphanums or '-+.'.
原因:Package Name : 需要小寫悠汽, com.wesk.appleBWL 不符合規(guī)范箱吕,需要改成小寫,??