我参考了http://bbs.iosre.com/t/hook-c/136这篇讨论,想尝试对一个C++写的iOS手游进行逆向。发现还是有一些不懂的问题,想请教下。
类似这种C++类
我自己写的Tweak.xm代码为
#include <substrate.h>
CIosAppContainer (*original_getInstance)(void);
CIosAppContainer *replace_getInstance(void) {
printf("haha");
return original_getInstance();
}
%ctor {
printf("ctor");
MSHookFunction((void *)GetInstance,(void *)replace_getInstance,(void * *)&original_getInstance);
}
Makefile
THEOS_DEVICE_IP = 192.168.0.109
THEOS_DEVICE_PORT = 22
ARCHS = armv7
TARGET = iphone:latest:7.0
ADDITIONAL_OBJCFLAGS = -fobjc-arc
include ~/Desktop/iosre/theos/makefiles/common.mk
TWEAK_NAME = str
str_FILES = Tweak.xm
str_FRAMEWORKS = UIKit
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 stritz"
编译结果是
Tweak.xm:3:1: error: unknown type name 'CIosAppContainer'
CIosAppContainer (*original_getInstance)(void);
^
Tweak.xm:5:1: error: unknown type name 'CIosAppContainer'
CIosAppContainer *replace_getInstance(void) {
^
Tweak.xm:12:25: error: use of undeclared identifier 'GetInstance'
MSHookFunction((void *)GetInstance,(void *)replace_getInstance,(void * *)&original_getInstance);
这种手写的C++类应该怎么Hook呢? 有大神说要用“ MSFindSymbol来找到符号地址” 有没有例子演示下,网上关于这个的资料很难找。谢谢大神们