This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Naville
committed
Mar 12, 2016
1 parent
877a5f7
commit 286806b
Showing
13 changed files
with
313 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#import "../SharedDefine.pch" | ||
#import <objc/runtime.h> | ||
#import <Foundation/Foundation.h> | ||
|
||
/* | ||
FOUNDATION_EXPORT NSString *NSStringFromSelector(SEL aSelector); | ||
FOUNDATION_EXPORT SEL NSSelectorFromString(NSString *aSelectorName); | ||
*/ | ||
//Old Func Pointers | ||
Class (*old_NSClassFromString)(NSString *aClassName); | ||
NSString* (*old_NSStringFromClass)(Class aClass); | ||
NSString* (*old_NSStringFromProtocol)(Protocol* proto); | ||
Protocol* (*old_NSProtocolFromString)(NSString* namestr); | ||
|
||
|
||
//New Func | ||
Class new_NSClassFromString(NSString* aClassName){ | ||
if(WTShouldLog){ | ||
WTInit(@"ObjCRuntime",@"NSClassFromString"); | ||
WTAdd(aClassName,@"ClassName"); | ||
WTSave; | ||
WTRelease; | ||
} | ||
return old_NSClassFromString(aClassName); | ||
} | ||
NSString* new_NSStringFromClass(Class aClass){ | ||
NSString* orig=old_NSStringFromClass(aClass); | ||
if(WTShouldLog){ | ||
WTInit(@"ObjCRuntime",@"NSStringFromClass"); | ||
WTAdd(orig,@"ClassName"); | ||
WTSave; | ||
WTRelease; | ||
} | ||
return orig; | ||
} | ||
|
||
NSString* new_NSStringFromProtocol(Protocol* proto){ | ||
NSString* orig=old_NSStringFromProtocol(proto); | ||
if(WTShouldLog){ | ||
WTInit(@"ObjCRuntime",@"NSStringFromProtocol"); | ||
WTAdd(orig,@"ProtocalName"); | ||
WTSave; | ||
WTRelease; | ||
} | ||
return orig; | ||
} | ||
|
||
Protocol* new_NSProtocolFromString(NSString* namestr){ | ||
if(WTShouldLog){ | ||
WTInit(@"ObjCRuntime",@"NSProtocolFromString"); | ||
WTAdd(namestr,@"ProtocalName"); | ||
WTSave; | ||
WTRelease; | ||
} | ||
return old_NSProtocolFromString(namestr); | ||
} | ||
|
||
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); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//Shall We Use Marcos instead of this shit? | ||
#import "../SharedDefine.pch" | ||
#import <mach-o/getsect.h> | ||
#import <dlfcn.h> | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//Shall We Use Marcos instead of this shit? | ||
#import "../SharedDefine.pch" | ||
#import <mach-o/getsect.h> | ||
#import <dlfcn.h> | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//Shall We Use Marcos instead of this shit? | ||
#import "../SharedDefine.pch" | ||
#import <mach-o/getsect.h> | ||
#import <dlfcn.h> | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//Shall We Use Marcos instead of this shit? | ||
#import "../SharedDefine.pch" | ||
#import <mach-o/getsect.h> | ||
#import <dlfcn.h> | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./.theos/obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./.theos/obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./.theos/obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./.theos/obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
337 | ||
338 |
Oops, something went wrong.