- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想 Hook 在 ImageIO 框架中本地声明的名为 png_handle_IHDR
的函数。我使用 MobileSafari 作为过滤器。但是在调用原始功能时,mobilesafari 崩溃了。检查 NSLog 后,我得到了这个:
Jun 5 17:21:08 unknown MobileSafari[553] <Warning>: dlopen ImageIO success!
Jun 5 17:21:08 unknown MobileSafari[553] <Warning>: Zeroing of nlist success!
Jun 5 17:21:08 unknown MobileSafari[553] <Warning>: method name successfully assigned!
Jun 5 17:21:08 unknown MobileSafari[553] <Warning>: nlist SUCCESS! nlsetting..
Jun 5 17:21:08 unknown MobileSafari[553] <Warning>: nlset success! Hooking..
Jun 5 17:21:09 unknown MobileSafari[553] <Warning>: Png IHDR handle hooking!
Jun 5 17:21:09 unknown UIKitApplication:com.apple.mobilesafari[0x819][553] <Notice>: libpng error: Invalid IHDR chunk
Jun 5 17:21:09 unknown ReportCrash[554] <Notice>: Formulating crash report for process MobileSafari[553]
Jun 5 17:21:09 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.apple.mobilesafari[0x819]) Job appears to have crashed: Abort trap: 6
Jun 5 17:21:09 unknown SpringBoard[530] <Warning>: Application 'Safari' exited abnormally with signal 6: Abort trap: 6
我马上想到,很有可能是我弄错了png_handle_IHDR
的函数原型(prototype)。以下是我在调整中的代码:
#import <CoreFoundation/CoreFoundation.h>
#include <substrate.h>
#define ImageIO "/System/Library/Frameworks/ImageIO.framework/ImageIO"
void (*png_handle_IHDR)();
MSHook(void, png_handle_IHDR){
NSLog(@"Png IHDR handle hooking!\n");
_png_handle_IHDR(); //crashed here!!
NSLog(@"Png IHDR handle hooking finished!\n");
}
template <typename Type_>
static void nlset(Type_ &function, struct nlist *nl, size_t index) {
struct nlist &name(nl[index]);
uintptr_t value(name.n_value);
if ((name.n_desc & N_ARM_THUMB_DEF) != 0)
value |= 0x00000001;
function = reinterpret_cast<Type_>(value);
}
MSInitialize {
if (dlopen(ImageIO, RTLD_LAZY | RTLD_NOLOAD)!=NULL)
{
NSLog(@"dlopen ImageIO success!\n");
struct nlist nl[2];
bzero(&nl, sizeof(nl));
NSLog(@"Zeroing of nlist success!\n");
nl[0].n_un.n_name = (char*) "_png_handle_IHDR";
NSLog(@"method name successfully assigned!\n");
nlist(ImageIO,nl);
NSLog(@"nlist SUCCESS! nlsetting..\n");
nlset(png_handle_IHDR, nl, 0);
NSLog(@"nlset success! Hooking..\n");
MSHookFunction(png_handle_IHDR,MSHake(png_handle_IHDR));
}
}
我的 makefile 是这样的:
include theos/makefiles/common.mk
TWEAK_NAME = privateFunctionTest
privateFunctionTest_FILES = Tweak.xm
include $(THEOS_MAKE_PATH)/tweak.mk
privateFunctionTest_FRAMEWORKS = UIKit ImageIO CoreGraphics Foundation CoreFoundation
编辑:问题是,了解成功 Hook 所必需的原始函数参数吗?如果是,从反汇编中获取函数原型(prototype)是唯一的方法吗?在任何 SDK header 中都没有对此的定义。谢谢。
最佳答案
好的,我反编译了函数,得到了反编译器猜到的函数原型(prototype)。只要参数和返回类型广泛匹配,例如bool : int
, unsigned int : int
,它仍然可以工作而不会终止执行。所以这有效:
int *png_handle_IHDR(int a1, int a2, int a3);
MSHook(int, png_handle_IHDR, int a1, int a2, int a3){
NSLog(@"png_handle_IHDR(%d,%d,%d)", a1,a2,a3);
int val = _png_handle_IHDR(a1,a2,a3);
NSLog(@"Png IHDR handle hooking finished, returning %d as result!", val);
return val;
}
关于iphone - mobilesubstrate 可以 Hook 这个吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10894838/
我正在制作一个 MobileSubstrate 插件,它应该:a) Hook 一个或多个特定类的实例方法和b) 根据包含该对象(具体来说是 UIResponder 子类)的应用程序的包 ID 执行不同
我有一个 SpringBoard Hook ,可以监听分布式通知。我已经 Hook 了在 SpringBoard 中收到的各种其他应用程序发布通知。 如果我将 userInfo 传递为 null,则
调试 MobileSubstrate 扩展的最佳方法是什么,即放置断点等?在 Xcode 中有办法做到这一点吗? GNU 调试器? 最佳答案 我使用系统日志和尾部。您需要来自 Cydia 的 sysl
我想 Hook 在 ImageIO 框架中本地声明的名为 png_handle_IHDR 的函数。我使用 MobileSafari 作为过滤器。但是在调用原始功能时,mobilesafari 崩溃了。
我浏览了this tutorial创建 MobileSubstrate 插件。我可以编译 example hook没有错误。 但是一旦我添加 #import 在ExampleHookProtocol
我在谷歌上搜索了很多关于如何为 iPhone 创建 mobilesubstrate 插件的信息,但找不到任何基本教程。有人知道如何做到这一点吗?我正在寻找对其的基本了解。 谢谢:) 最佳答案 此脚本会
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我在为 iOS 5 调整 Mobile Substrate 时遇到问题。 大多数关于调整 Cydia 的教程都有这个步骤:“下载私有(private)框架头文件”。所以,我从以下位置下载了它:http
我正在尝试找出解锁设备的方法在哪里。我正在使用 SBAwayLockBar,但 SpringBoard 崩溃并返回 SBAwayLockBar 的实例可能无法响应选择器、解锁。那么,是否有一种私有(p
来自 the example of hooking C++ methods with MobileSubstrate我发现了这个: void (*X_ZN20WebFrameLoaderClient2
我正在使用 Logos 构建一个 MobileSubstrate 调整,并且我正在尝试添加一种新方法来将设备锁定到设备上的每个应用程序中,这将在接近更改通知后运行。到目前为止,我的代码是 #impor
我想编写一个 MobileSubstrate ( http://www.iphonedevwiki.net/index.php/MobileSubstrate) 插件,它接受每个 HTTP 请求并修改
-(id)initWithUserSettings:(id)userSettings mqttSender:(id)sender; NSDictionary *settings3=[[NSDi
我是一名优秀的程序员,十分优秀!