logify与theos的二三事

        最近逆向一个软件,无奈类名、方法名混淆的太厉害,class-dump后,很难猜出大致是哪个方法在起作用。用reveal 和 cycript 找到了viewcontrol 类,但类方法太多,还是不能确定是哪个方法被调用了。尝试为方法下断点,结果下了好几个都没有断下来。因此想到了用logify为指定类的每个函数写hook 方法,用theos生成tweak。

        logify使用方法比较简单,安装theos后,在bin目录下就有logify.pl。相应的用法比较简单,在此不做说明。

        thoes使用网上教程也很多。

        本文主要把我需要的障碍做下表述:

1、设置环境变量,可以每次在终端上运行

export THEOS=/opt/theos
export PATH=/opt/theos/bin/:$PATH

但这样比较麻烦,可以#vi /etc/profile,在这个文件中加上以上命令,重新打开终端,环境变量就生效了。这样就无需每次要去终端里export环境变量了。

2、运行nic.pl时,选择11,

 1 tong:Applications xxxxxxx$ nic.pl
 2 NIC 2.0 - New Instance Creator
 3 ------------------------------
 4   [1.] iphone/activator_event
 5   [2.] iphone/application_modern
 6   [3.] iphone/cydget
 7   [4.] iphone/flipswitch_switch
 8   [5.] iphone/framework
 9   [6.] iphone/ios7_notification_center_widget
10   [7.] iphone/library
11   [8.] iphone/notification_center_widget
12   [9.] iphone/preference_bundle_modern
13   [10.] iphone/tool
14   [11.] iphone/tweak
15   [12.] iphone/xpc_service
16 Choose a Template (required): 11
17 Project Name (required): mytweak
18 Package Name [com.yourcompany.mytweak]: com.mycompany.mytweak
19 Author/Maintainer Name [xxx]: wu
20 [iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]: com.apple.Security
21 [iphone/tweak] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]: -

这其中,MobileSubstrate Bundle filter 是指本插件需要作用的app 的id,在plist 中可以找到。如果需要作用于所有app,那么需要

com.apple.Security。
Insert your tweak into all processes

Leaving the filter plist file empty and simply deleting the file no longer work. The new solution would be modifying the filter plist to: { Filter = { Bundles = ( "com.apple.Security", ); }; } Since all processes will import Security.framework implicitly, your tweak can now hook into all processes​[:wink:]” 

3、将 logify生成的tweak.xm文件替换nic.pl生成的tweak.xm文件。
执行命令make,如果make后 要重新make,只需要先执行make clean即可。

4、打包,执行make package。

posted @ 2017-07-30 15:28  iamonion  阅读(1520)  评论(0编辑  收藏  举报