iOS是怎么检测虚拟定位的


#22

这个也试过 但是还是有问题的 不知道你们使用不使用外勤打卡 单纯改这个外勤打卡是不能打的,hook dladdr后是可以打外勤了


#24

虚拟定位检测是高德sdk做的


%hook AMapLocationManager

  • (_Bool )detectRiskOfFakeLocation {
    return NO;
    }
    %end
    屏蔽了就可以了

#25

楼主怎么hook dladdr的?


#26

试过 不行的


#27

extern int my_dladdr(const void * imp,Dl_info * info){
Dl_info new_info;
old_dladdr_func(imp,&new_info);
// NSLog(@“method CLLocation coordinate:”);
NSString * string = [NSString stringWithUTF8String:new_info.dli_sname];
if ([string rangeOfString:@“coordinate”].location != NSNotFound) {
NSLog(@"%@",@“yty_123”);
new_info.dli_fname = “/System/Library/Frameworks/CoreLocation.framework/CoreLocation”;
new_info.dli_sname = “CLGetStatusBarIconState”;
NSLog(@“yty_dli_fname:%s”,new_info.dli_fname);
NSLog(@“yty_dli_sname:%s”,new_info.dli_sname);
NSLog(@“yty_dli_fbase:%p”,new_info.dli_fbase);
NSLog(@“yty_dli_saddr:%p”,new_info.dli_saddr);
}

//	info = &new_info;
(*info).dli_fname = new_info.dli_fname;
(*info).dli_sname = new_info.dli_sname;
(*info).dli_fbase = new_info.dli_fbase;
(*info).dli_saddr = new_info.dli_saddr;

return old_dladdr_func(imp,&new_info);

}


#28

我刚试的 hook detectRiskOfFakeLocation 外勤和正常 打卡都可以.


#29

是么:joy:可能一开始我的姿势不对


#30

detectRiskOfFakeLocation 楼主这个你可以了么?


#31

额 我之后没有测试这个了,我就简单的hook 了 dladdr ,然后勉强能用


#32
extern int my_dladdr(const void * imp,Dl_info * info){
Dl_info new_info;
old_dladdr_func(imp,&new_info);
NSString * string = [NSString stringWithUTF8String:new_info.dli_sname];
if ([string rangeOfString:@"coordinate"].location != NSNotFound) {
new_info.dli_fname = "/System/Library/Frameworks/CoreLocation.framework/CoreLocation";
new_info.dli_sname = "CLGetStatusBarIconState";
}

//	info = &new_info;
(*info).dli_fname = new_info.dli_fname;
(*info).dli_sname = new_info.dli_sname;
(*info).dli_fbase = new_info.dli_fbase;
(*info).dli_saddr = new_info.dli_saddr;

return old_dladdr_func(imp,&new_info);
}

这个 Dl_info 我需要使用什么框架么? 使用captainhook 报错


#35
#import <dlfcn.h>

#36

:joy:问了这么傻的问题, 自己敲出来了


#37

:slight_smile:


#39

我用 fishhook 尝试了一下, 在 load 方法里面进行 hook 失败啦…求帮助


#40

你确定rebind_symbols是这样写的吗my_dladdr是神恶魔鬼


#41
rebind_symbols((struct rebinding[1]){{"dladdr", my_dladdr, (void *)&old_dladdr_func}},1);

#42

:joy:我的错打扰大神们了


#43

:joy:我的错打扰大神了


#44

亲测可以


#45

最近我发现这个方法在 iOS 8上会闪退的…