iOS之重签注入代码

50 阅读1分钟

1、源码参考

    NSString *urlString = @"xxx";
    urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    NSURL *url =[NSURL URLWithString:urlString];
    NSMutableURLRequest *request =[NSMutableURLRequest requestWithURL:url];
    request.HTTPMethod = @"POST";
    NSString *bundleId = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
    NSString *equipmentNumber =[[[UIDevice currentDevice] identifierForVendor] UUIDString];
    NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
    NSDictionary * paramDic = @{
        @"packageName": bundleId,
        @"deviceId": equipmentNumber,
        @"appName": appName,
    };
    NSLog(@"检测参数--->%@",paramDic);
    NSError* error2;
    NSData *postData = [NSJSONSerialization dataWithJSONObject:paramDic options:0 error:&error2];
    [request setHTTPBody:postData];
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    NSURLSessionConfiguration * configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
    NSURLSession *sharedSession =[NSURLSession sessionWithConfiguration:configuration];
    NSURLSessionDataTask *dataTask = [sharedSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error){
        if(error == nil){
            @try {
                if(data){
                    NSError *err;
                    NSDictionary *result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&err];
                    if(err){
                        NSLog(@"json解析失败:%@",err);
                    }else{
                        if([result[@"code"] integerValue] == 200){
                            NSDictionary * dataDic = result[@"data"];
                            NSLog(@"检测结果--->%@",dataDic);
                            if([dataDic[@"onlineStatus"] integerValue] == 0){
                                exit(0);
                            }
                        }
                    }
                }
            } @catch (NSException *exception) {
                NSLog(@"------>%@",exception);
            } @finally {
                NSLog(@"123");
            }
        }
    }];
    [dataTask resume];
}

2、调用位置

image.png

3、产物

image.png

4、相关参考文献

iOS逆向开发:MonkeyDev调试

Xcode16安装MonkeyDev小记及问题解决