My Hook Notes

今天尝试hook CLLocationManager,编写好后,运行没有效果,后多方调研发现plist文件不能写成{Filter = {};} 而是{Filter = {Bundles = {“com.apple.corelocation”,};};}


在编译CocoaHttpServer为libCocoaHttpServer.a时,使用控制台make && make headers报错libxml2/parser.h file not found.。原因是mac没有安装command line tool。 在终端输入"xcode-select --install"安装command line tool之后,问题解决。

官方微博里也全是干货,应该及时关注

那条微博,刚好是我遇到的问题!

希望微博里面有用的东西留在论坛里啊

我是一个初学者,你是怎么弄的,能不能发个实例代码看看,我怎么弄都不行,想hook CLLocationManager的- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations得到位置,然后弹框显示。

1.plist文件:
{
Filter = {
Bundles = (
“com.apple.Security”,
);
};
}

2.makefile文件:
THEOS_DEVICE_IP = 192.168.1.125
ARCHS = armv7 arm64
TARGET = iPhone:latest:8.0

include theos/makefiles/common.mk

TWEAK_NAME = HookLocation
HookLocation_FILES = Tweak.xm
HookLocation_FRAMEWORKS = Foundation UIKit CoreLocation

include $(THEOS_MAKE_PATH)/tweak.mk

3.这是我的TWeak文件,只是一个小demo,证明运行成功了


#import 
#import 
#import 
#import 

%hook CLLocationManager
- (id)init
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"程序初始化了CLLocationManager" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alertView show];
[alertView release];
return %orig;
}
%end

用markdown里的
Code
语法把你的代码段包起来,就不会影响了

好的,正在学习

thx,试了一下,可以的。

http://iosre.com/t/installing-iosopendev-for-xcode-7/1842?u=comtex