iOS hook:fishhook
作者:
Liu____ | 来源:发表于
2020-07-09 17:31 被阅读0次//
// ViewController.m
// testFishHook
//
// Created by liuyaqiang on 2020/7/9.
// Copyright © 2020 KTM. All rights reserved.
//
#import "ViewController.h"
#import "fishhook.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
struct rebinding nslog;
nslog.name = "NSLog"; //原函数名
nslog.replacement = myNSLog; //新函数地址
nslog.replaced = (void **)&sys_nslog;//要保存的原始函数的地址
struct rebinding rebs[1] = {nslog};
//arge1:rebs存放rebinding机构体数组,arg2:数组的长度
rebind_symbols(rebs, 1);
}
static void (* sys_nslog)(NSString *format, ...);
void myNSLog(NSString *format, ...){
format = [format stringByAppendingFormat:@"my log"];
sys_nslog(format);
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
NSLog(@"touch");
}
@end
本文标题:iOS hook:fishhook
本文链接:https://www.haomeiwen.com/subject/sxpscktx.html
网友评论