gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 21:38:59 37 4
gpt4 key购买 nike

我正在为 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/

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