ChaosField.

iOS Hook

字数统计: 255阅读时长: 1 min
2020/11/24 Share

XCode 11 Monkey 报错
iOS 逆向 - 钉钉在家打卡插件实战

准备

  1. 越狱手机一台, 安装 openssh
  2. 安装 MonkeyDev
  3. 上文中实战讲的很清楚了, 按照步骤来即可, 最重要和复杂的就是找到需要 hook 的函数, 以及参数

原文中 hook 代码调整

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
%hook LAPluginInstanceCollector
- (void)handleJavaScriptRequest:(NSDictionary *)arg1 callback:(void(^)(id))arg2{
if([arg1[@"action"] isEqualToString:@"start"]){//有可能需要修改定位信息!
//定义一个myBlock
id myCallBack = ^(NSDictionary * block_arg){
if([block_arg[@"keep"] isEqualToString:@"1"]){//需要修改GPS
NSMutableDictionary * tempDic = [NSMutableDictionary dictionaryWithDictionary:block_arg];
NSMutableDictionary * result = [NSMutableDictionary dictionaryWithDictionary:tempDic[@"result"]];
//修改block中的字典的值!
result[@"latitude"] = @"28.1924070001";
result[@"longitude"] = @"112.9788130003";
tempDic[@"result"] = result;
//使用修改后的!
arg2(tempDic);
}else{
//保持原有掉用!!
arg2(block_arg);
}
};
%orig(arg1,myCallBack);
}else{
%orig;
}
}
%end

若只是为了打卡可以更直接一些

1
2
3
4
5
6
7
8
9
10
11
12
13
#import <CoreLocation/CoreLocation.h>

%hook CLLocation
-(CLLocationCoordinate2D) coordinate
{
CLLocationCoordinate2D location;
//纬度
location.latitude = 25.012345;
//经度
location.longitude = 109.49328;
return location;
}
%end
CATALOG
  1. 1. 准备
  2. 2. 原文中 hook 代码调整