objective-c - (iOS, TheOS) %hook 到全局应用程序功能

标签 objective-c ios7 hook jailbreak theos

我正在为 iOS 7 中的应用寻找全局函数

更具体地说,我想在启动时将代码注入(inject)到应用程序中,这只会影响 app,而不是 SpringBoard

我尝试了一些方法,但它们只影响 SpringBoard:

%hook SBApplicationIcon
    - (id)application {
        return %orig;
    }
    - (id)initWithApplication:(id)arg1 {
        return %orig;
    }
%end

%hook SBApplicationController
    - (id)init {
         return %orig;
    }
%end

%hook SBUIController
    - (void)launchIcon:(id)arg1 fromLocation:(int)arg2 {
        %orig;
    }
    - (id)contentView {
        return %orig;
    }
%end

%hook SBApplication
    - (void)didLaunch:(id)arg1 {
        %orig;
    }
%end

这些只是我尝试过的几个函数示例。

我怀疑过滤器也需要更改,但这取决于函数位于 ofc 的位置(com.apple.springboard 设置为 atm)。

我收到了将过滤器设置为 * 的提示,但如果我不知道 function 是什么,这对我没有多大好处%钩子(Hook)

如果可能,请解释您的答案。

最佳答案

您的代码仅在 SpringBoard 中运行,因为您选择 Hook SpringBoard 类中的方法(例如 SBUIControllerSBApplicationController 等),并且您的过滤器设置为仅 Hook SpringBoard 本身。

Try checking out the MobileSubstrate docs here

我不是 100% 确定我明白你想要做什么,但听起来你只是想要任何可以在所有正常“应用程序”中运行的方法?

如果是这样,您可以更改过滤器以 Hook 使用 UIKit 的所有内容:

Filter = {
  Bundles = (com.apple.UIKit);
};

然后您可以尝试使用 MSHookFunction() Hook C 函数 as shown in this example .

在您的代码中,尝试 Hook UIApplicationMain() ,我相信所有普通应用程序都会使用它。

更新:

另一种潜在的技术是从 UIApplicationDelegate 协议(protocol)中 Hook 任何常用的启动回调方法。不过,为了使用 Hook ,您需要发现哪些实现了此协议(protocol)。 See this answer for an example of doing this (with another protocol) .

关于objective-c - (iOS, TheOS) %hook 到全局应用程序功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20775715/

相关文章:

php - 向 mysql 结果添加 HOOK (PHP)

objective-c - 使用多个 nsarraycontroller 更改选定对象

iphone - 将文件复制到文档目录导致失败

ios - 将复选框列表添加到 UIAlertController

ios - 更改 View 变换会更改 iOS 7 上的 View 位置,但不会更改 ios8

git - Hg 相当于 git post-receive hook

ios - 从 NIB 加载 View 返回零帧 View - 怎么办?

objective-c - NSWindow - 右键单击​​菜单

ios - 是否有快速替代弃用的 `SKPaymentTransaction.transactionReceipt` ?

c++ - Detours 3.0 Hook 崩溃 MessageBoxA