gpt4 book ai didi

objective-c - (iOS, TheOS) %hook into global app function

转载 作者:行者123 更新时间:2023-12-02 04:41:21 26 4
gpt4 key购买 nike

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

更具体地说,我想在启动时将代码注入(inject)到应用程序中,这只会影响应用程序,而不影响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

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

我怀疑过滤器也需要更改,但这取决于函数所在的位置(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 into global app function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20775715/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com