Skip to content

subdiox/hooker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

hooker

Function hooker (injector) for macOS

Installation

Just add hooker.h and hooker.m to your Xcode project.

Hooking

#import "hooker.h"

@interface Sample : NSObject<Hook>
@end

@implementation Sample
+ (NSArray)targetClasses {
    return @[@"SampleClass"];
}

- (void)hook_sampleMethod1 {
    NSLog(@"instance method 'sampleMethod1' is hooked!");
    [self orig_sampleMethod1];
    // do whatever you want
}

+ (id)hook_sampleMethod2 {
    NSLog(@"class method 'sampleMethod2' is hooked!");
    return [self orig_sampleMethod2];
}

- (void)orig_sampleMethod1 {}
+ (id)orig_sampleMethod2 { return nil }
@end

How to use after building

$ DYLD_INSERT_LIBRARIES=(path to dylib file) (executable file)

About

Function hooker for macOS

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors