diff --git a/Hooks/API/ObjCRuntime.xm b/Hooks/API/ObjCRuntime.xm index eddc536..b6afc9c 100644 --- a/Hooks/API/ObjCRuntime.xm +++ b/Hooks/API/ObjCRuntime.xm @@ -3,14 +3,29 @@ #import /* -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 @@ -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); } diff --git a/Hooks/API/UIPasteboard.xm b/Hooks/API/UIPasteboard.xm index c2d0663..fe0744d 100644 --- a/Hooks/API/UIPasteboard.xm +++ b/Hooks/API/UIPasteboard.xm @@ -1,6 +1,3 @@ -#import "../Utils/SQLiteStorage.h" -#import "../Utils/PlistObjectConverter.h" -#import "../Utils/CallStackInspector.h" #import "../SharedDefine.pch" %group UIPasteboard %hook UIPasteboard diff --git a/Hooks/ThirdPartyTools/DeviceIDFake.xm b/Hooks/ThirdPartyTools/DeviceIDFake.xm deleted file mode 100644 index 5af3081..0000000 --- a/Hooks/ThirdPartyTools/DeviceIDFake.xm +++ /dev/null @@ -1,47 +0,0 @@ -//Shall We Use Marcos instead of this shit? -#import "../SharedDefine.pch" -#import -#import -extern NSString* RandomString(); -extern void init_DeviceIDFake_hook(){ -#ifdef PROTOTYPE -//Because We Ain't Ready Yet. No Test - for(int i=0;i<_dyld_image_count();i++){ - const char * Nam=_dyld_get_image_name(i); - NSString* curName=[[NSString stringWithUTF8String:Nam] autorelease]; - if([curName containsString:WTFJHTWEAKNAME]){ - intptr_t ASLROffset=_dyld_get_image_vmaddr_slide(i); - //We Found Ourself -#ifndef _____LP64_____ - uint32_t size=0; - const struct mach_header* selfHeader=(const struct mach_header*)_dyld_get_image_header(i); - char * data=getsectdatafromheader(selfHeader,"WTFJH","DeviceIDFake",&size); - -#elif - uint64_t size=0; - const struct mach_header_64* selfHeader=(const struct mach_header_64*)_dyld_get_image_header(i); - char * data=getsectdatafromheader_64(selfHeader,"WTFJH","DeviceIDFake",&size); -#endif - data=ASLROffset+data;//Add ASLR Offset To Pointer And Fix Address - NSData* SDData=[NSData dataWithBytes:data length:size]; - NSString* randomPath=[NSString stringWithFormat:@"%@/Documents/%@",NSHomeDirectory(),RandomString()]; - [SDData writeToFile:randomPath atomically:YES]; - dlopen(randomPath.UTF8String,RTLD_NOW); - //Inform Our Logger - CallTracer *tracer = [[CallTracer alloc] initWithClass:@"WTFJH" andMethod:@"LoadThirdPartyTools"]; - [tracer addArgFromPlistObject:@"dlopen" withKey:@"Type"]; - [tracer addArgFromPlistObject:randomPath withKey:@"Path"]; - [tracer addArgFromPlistObject:@"DeviceIDFake" withKey:@"ModuleName"]; - [traceStorage saveTracedCall: tracer]; - [tracer release]; - //End - - [SDData release]; - break; - } - - - - } -#endif -} diff --git a/Hooks/ThirdPartyTools/InspectiveC.xm b/Hooks/ThirdPartyTools/InspectiveC.xm deleted file mode 100644 index 4cc1c3f..0000000 --- a/Hooks/ThirdPartyTools/InspectiveC.xm +++ /dev/null @@ -1,47 +0,0 @@ -//Shall We Use Marcos instead of this shit? -#import "../SharedDefine.pch" -#import -#import -extern NSString* RandomString(); -extern void init_InspectiveC_hook(){ -#ifdef PROTOTYPE -//Because We Ain't Ready Yet. No Test - for(int i=0;i<_dyld_image_count();i++){ - const char * Nam=_dyld_get_image_name(i); - NSString* curName=[[NSString stringWithUTF8String:Nam] autorelease]; - if([curName containsString:WTFJHTWEAKNAME]){ - intptr_t ASLROffset=_dyld_get_image_vmaddr_slide(i); - //We Found Ourself -#ifndef _____LP64_____ - uint32_t size=0; - const struct mach_header* selfHeader=(const struct mach_header*)_dyld_get_image_header(i); - char * data=getsectdatafromheader(selfHeader,"WTFJH","InspectiveC",&size); - -#elif - uint64_t size=0; - const struct mach_header_64* selfHeader=(const struct mach_header_64*)_dyld_get_image_header(i); - char * data=getsectdatafromheader_64(selfHeader,"WTFJH","InspectiveC",&size); -#endif - data=ASLROffset+data;//Add ASLR Offset To Pointer And Fix Address - NSData* SDData=[NSData dataWithBytes:data length:size]; - NSString* randomPath=[NSString stringWithFormat:@"%@/Documents/%@",NSHomeDirectory(),RandomString()]; - [SDData writeToFile:randomPath atomically:YES]; - dlopen(randomPath.UTF8String,RTLD_NOW); - //Inform Our Logger - CallTracer *tracer = [[CallTracer alloc] initWithClass:@"WTFJH" andMethod:@"LoadThirdPartyTools"]; - [tracer addArgFromPlistObject:@"dlopen" withKey:@"Type"]; - [tracer addArgFromPlistObject:randomPath withKey:@"Path"]; - [tracer addArgFromPlistObject:@"InspectiveC" withKey:@"ModuleName"]; - [traceStorage saveTracedCall: tracer]; - [tracer release]; - //End - - [SDData release]; - break; - } - - - - } -#endif -} diff --git a/Hooks/ThirdPartyTools/RuntimeClassDump.xm b/Hooks/ThirdPartyTools/RuntimeClassDump.xm deleted file mode 100644 index 72a1b65..0000000 --- a/Hooks/ThirdPartyTools/RuntimeClassDump.xm +++ /dev/null @@ -1,47 +0,0 @@ -//Shall We Use Marcos instead of this shit? -#import "../SharedDefine.pch" -#import -#import -extern NSString* RandomString(); -extern void init_RuntimeClassDump_hook(){ -#ifdef PROTOTYPE -//Because We Ain't Ready Yet. No Test - for(int i=0;i<_dyld_image_count();i++){ - const char * Nam=_dyld_get_image_name(i); - NSString* curName=[[NSString stringWithUTF8String:Nam] autorelease]; - if([curName containsString:WTFJHTWEAKNAME]){ - intptr_t ASLROffset=_dyld_get_image_vmaddr_slide(i); - //We Found Ourself -#ifndef _____LP64_____ - uint32_t size=0; - const struct mach_header* selfHeader=(const struct mach_header*)_dyld_get_image_header(i); - char * data=getsectdatafromheader(selfHeader,"WTFJH","RuntimeClassDump",&size); - -#elif - uint64_t size=0; - const struct mach_header_64* selfHeader=(const struct mach_header_64*)_dyld_get_image_header(i); - char * data=getsectdatafromheader_64(selfHeader,"WTFJH","RuntimeClassDump",&size); -#endif - data=ASLROffset+data;//Add ASLR Offset To Pointer And Fix Address - NSData* SDData=[NSData dataWithBytes:data length:size]; - NSString* randomPath=[NSString stringWithFormat:@"%@/Documents/%@",NSHomeDirectory(),RandomString()]; - [SDData writeToFile:randomPath atomically:YES]; - dlopen(randomPath.UTF8String,RTLD_NOW); - //Inform Our Logger - CallTracer *tracer = [[CallTracer alloc] initWithClass:@"WTFJH" andMethod:@"LoadThirdPartyTools"]; - [tracer addArgFromPlistObject:@"dlopen" withKey:@"Type"]; - [tracer addArgFromPlistObject:randomPath withKey:@"Path"]; - [tracer addArgFromPlistObject:@"RuntimeClassDump" withKey:@"ModuleName"]; - [traceStorage saveTracedCall: tracer]; - [tracer release]; - //End - - [SDData release]; - break; - } - - - - } -#endif -} diff --git a/Hooks/ThirdPartyTools/dumpdecrypted.xm b/Hooks/ThirdPartyTools/dumpdecrypted.xm deleted file mode 100644 index 3409aa5..0000000 --- a/Hooks/ThirdPartyTools/dumpdecrypted.xm +++ /dev/null @@ -1,47 +0,0 @@ -//Shall We Use Marcos instead of this shit? -#import "../SharedDefine.pch" -#import -#import -extern NSString* RandomString(); -extern void init_dumpdecrypted_hook(){ -#ifdef PROTOTYPE -//Because We Ain't Ready Yet. No Test - for(int i=0;i<_dyld_image_count();i++){ - const char * Nam=_dyld_get_image_name(i); - NSString* curName=[[NSString stringWithUTF8String:Nam] autorelease]; - if([curName containsString:WTFJHTWEAKNAME]){ - intptr_t ASLROffset=_dyld_get_image_vmaddr_slide(i); - //We Found Ourself -#ifndef _____LP64_____ - uint32_t size=0; - const struct mach_header* selfHeader=(const struct mach_header*)_dyld_get_image_header(i); - char * data=getsectdatafromheader(selfHeader,"WTFJH","dumpdecrypted",&size); - -#elif - uint64_t size=0; - const struct mach_header_64* selfHeader=(const struct mach_header_64*)_dyld_get_image_header(i); - char * data=getsectdatafromheader_64(selfHeader,"WTFJH","dumpdecrypted",&size); -#endif - data=ASLROffset+data;//Add ASLR Offset To Pointer And Fix Address - NSData* SDData=[NSData dataWithBytes:data length:size]; - NSString* randomPath=[NSString stringWithFormat:@"%@/Documents/%@",NSHomeDirectory(),RandomString()]; - [SDData writeToFile:randomPath atomically:YES]; - dlopen(randomPath.UTF8String,RTLD_NOW); - //Inform Our Logger - CallTracer *tracer = [[CallTracer alloc] initWithClass:@"WTFJH" andMethod:@"LoadThirdPartyTools"]; - [tracer addArgFromPlistObject:@"dlopen" withKey:@"Type"]; - [tracer addArgFromPlistObject:randomPath withKey:@"Path"]; - [tracer addArgFromPlistObject:@"dumpdecrypted" withKey:@"ModuleName"]; - [traceStorage saveTracedCall: tracer]; - [tracer release]; - //End - - [SDData release]; - break; - } - - - - } -#endif -} diff --git a/VERSION b/VERSION index 4b74f22..832f62a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -338 \ No newline at end of file +339 \ No newline at end of file