Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Core OCRuntime+TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
Naville committed Mar 12, 2016
1 parent 286806b commit 1978322
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 195 deletions.
45 changes: 42 additions & 3 deletions Hooks/API/ObjCRuntime.xm
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,29 @@
#import <Foundation/Foundation.h>

/*
FOUNDATION_EXPORT NSString *NSStringFromSelector(SEL aSelector);
FOUNDATION_EXPORT SEL NSSelectorFromString(NSString *aSelectorName);
To Implement:
Class objc_getClass(const char *name)
const char *object_getClassName(id obj)
objc_getMetaClass(const char *name)
IMP class_getMethodImplementation(Class cls, SEL name)
BOOL class_respondsToSelector(Class cls, SEL sel)
class_addMethod(Class cls, SEL name, IMP imp,
const char *types)
class_replaceMethod(Class cls, SEL name, IMP imp,
const char *types)
And Runtime Method Implementation Related Funcs
*/

//Old Func Pointers
Class (*old_NSClassFromString)(NSString *aClassName);
NSString* (*old_NSStringFromClass)(Class aClass);
NSString* (*old_NSStringFromProtocol)(Protocol* proto);
Protocol* (*old_NSProtocolFromString)(NSString* namestr);
NSString* (*old_NSStringFromSelector)(SEL aSelector);
SEL (*old_NSSelectorFromString)(NSString* aSelectorName);


//New Func
Expand Down Expand Up @@ -55,10 +70,34 @@ Protocol* new_NSProtocolFromString(NSString* namestr){
return old_NSProtocolFromString(namestr);
}

NSString* new_NSStringFromSelector(SEL aSelector){
NSString* orig=old_NSStringFromSelector(aSelector);
if(WTShouldLog){
WTInit(@"ObjCRuntime",@"NSStringFromSelector");
WTAdd(orig,@"SelectorName");
WTSave;
WTRelease;
}
return orig;


}
SEL new_NSSelectorFromString(NSString* aSelectorName){
if(WTShouldLog){
WTInit(@"ObjCRuntime",@"NSSelectorFromString");
WTAdd(aSelectorName,@"SelectorName");
WTSave;
WTRelease;
}
return old_NSSelectorFromString(aSelectorName);

}

extern void init_ObjCRuntime_hook() {
MSHookFunction((void*)NSClassFromString,(void*)new_NSClassFromString, (void**)&old_NSClassFromString);
MSHookFunction((void*)NSStringFromClass,(void*)new_NSStringFromClass, (void**)&old_NSStringFromClass);
MSHookFunction((void*)NSStringFromProtocol,(void*)new_NSStringFromProtocol, (void**)&old_NSStringFromProtocol);
MSHookFunction((void*)NSProtocolFromString,(void*)new_NSProtocolFromString, (void**)&old_NSProtocolFromString);

MSHookFunction((void*)NSStringFromSelector,(void*)new_NSStringFromSelector, (void**)&old_NSStringFromSelector);
MSHookFunction((void*)NSSelectorFromString,(void*)new_NSSelectorFromString, (void**)&old_NSSelectorFromString);
}
3 changes: 0 additions & 3 deletions Hooks/API/UIPasteboard.xm
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#import "../Utils/SQLiteStorage.h"
#import "../Utils/PlistObjectConverter.h"
#import "../Utils/CallStackInspector.h"
#import "../SharedDefine.pch"
%group UIPasteboard
%hook UIPasteboard
Expand Down
47 changes: 0 additions & 47 deletions Hooks/ThirdPartyTools/DeviceIDFake.xm

This file was deleted.

47 changes: 0 additions & 47 deletions Hooks/ThirdPartyTools/InspectiveC.xm

This file was deleted.

47 changes: 0 additions & 47 deletions Hooks/ThirdPartyTools/RuntimeClassDump.xm

This file was deleted.

47 changes: 0 additions & 47 deletions Hooks/ThirdPartyTools/dumpdecrypted.xm

This file was deleted.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
338
339

0 comments on commit 1978322

Please sign in to comment.