-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.x
57 lines (44 loc) · 1.47 KB
/
Tweak.x
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* How to Hook with Logos
Hooks are written with syntax similar to that of an Objective-C @implementation.
You don't need to #include <substrate.h>, it will be done automatically, as will
the generation of a class list and an automatic constructor.
%hook ClassName
// Hooking a class method
+ (id)sharedInstance {
return %orig;
}
// Hooking an instance method with an argument.
- (void)messageName:(int)argument {
%log; // Write a message about this call, including its class, name and arguments, to the system log.
%orig; // Call through to the original function with its original arguments.
%orig(nil); // Call through to the original function with a custom argument.
// If you use %orig(), you MUST supply all arguments (except for self and _cmd, the automatically generated ones.)
}
// Hooking an instance method with no arguments.
- (id)noArguments {
%log;
id awesome = %orig;
[awesome doSomethingElse];
return awesome;
}
// Always make sure you clean up after yourself; Not doing so could have grave consequences!
%end
*/
#import <substrate.h>
#import <mach-o/dyld.h>
#import <dlfcn.h>
void (*old_sub)(void);
void new_sub(void)
{
// old_sub_ACF0();
NSLog(@"iOSRE: anti-debugging");
}
%ctor
{
@autoreleasepool
{
unsigned long _sub = (_dyld_get_image_vmaddr_slide(0) + 0x1003D810C);
if (_sub) NSLog(@"iOSRE: Found sub!");
MSHookFunction((void *)_sub, (void *)&new_sub, (void **)&old_sub);
}
}