123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- #import <Foundation/Foundation.h>
- #include <mach-o/dyld.h>
- #import <objc/runtime.h>
- %class LSContext
- %class FSNode
- id (*original_func2)();
- id (*original_func3)();
- /*
- Build = Build;
- FullVersionString = "Version 10.2.2 (Build 14W756)";
- MarketingVersion = "10.2.2";
- ProductBuildVersion = 14W756;
- ProductCopyright = "1983-2017 Apple Inc.";
- ProductName = "Apple TVOS";
- ProductVersion = "10.2.2";
- Version = Version;
- */
- id serverversiondict()
- {
- NSLog(@"called server version!");
- //NSArray *callStack = [NSThread callStackSymbols];
- //NSLog(@"callstack: %@", callStack);
- id retv = original_func3();
- NSMutableDictionary *a = [retv mutableCopy];
- a[@"MarketingVersion"] = @"11.1";
- a[@"ProductVersion"] = @"11.1";
- a[@"ProductBuildVersion"] = @"15J582";
- NSLog(@"og deets: %@", retv);
- NSLog(@"new g: %@", a);
- return retv;
- }
- id systemversiondict()
- {
- NSLog(@"called system version!");
- //NSArray *callStack = [NSThread callStackSymbols];
- //NSLog(@"callstack: %@", callStack);
- id retv = original_func2();
- //NSMutableDictionary *a = [retv mutableCopy];
- //a[@"MarketingVersion"] = @"11.1";
- //a[@"ProductVersion"] = @"11.1";
- //a[@"ProductBuildVersion"] = @"15J582";
- //NSLog(@"og deets: %@", retv);
- //NSLog(@"new g: %@", a);
- return retv;
- }
- id (*original_func)(id a);
- //hook for _MobileInstallationCopyInstalledAppsForLaunchServices
- id we_really_out_here(id a)
- {
- HBLogInfo(@"#### EXCEPTION CATCHER FOUND UNCAUGHT EXCEPTION: %@", a);
- NSLog(@"#### EXCEPTION CATCHER FOUND UNCAUGHT EXCEPTION: %@", a);
- id retv = original_func(a);
- NSLog(@"retv: %@", retv);
- return retv;
- }
- %ctor
- {
- dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", RTLD_LAZY);
-
- MSImageRef gangshit = MSGetImageByName("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation");
- if (gangshit != NULL)
- {
- NSLog(@"cf loaded!");
- }
- //tvos 10 symbol
- void* weouthere = MSFindSymbol(gangshit, "___handleUncaughtException");
- NSLog(@"CoreFoundation tvOS 10 hooking %p", weouthere);
- if (weouthere)
- {
- NSLog(@"Found symbol!");
- MSHookFunction((void*)weouthere, (void*)we_really_out_here, (void**)&original_func);
- }
- /*
- void* weouthere2 = MSFindSymbol(gangshit, "__CFCopySystemVersionDictionary");
- NSLog(@"CF hooking _CFCopySystemVersionDictionary: %p", weouthere2);
- if (weouthere2)
- {
- NSLog(@"Found _CFCopySystemVersionDictionary!");
- MSHookFunction((void*) weouthere2, (void*)systemversiondict, (void**)&original_func2);
- }
- void* weouthere3 = MSFindSymbol(gangshit, "__CFCopyServerVersionDictionary");
- NSLog(@"CF hooking _CFCopyServerVersionDictionary: %p", weouthere2);
- if (weouthere3)
- {
- NSLog(@"Found _CFCopyServerVersionDictionary!");
- MSHookFunction((void*) weouthere3, (void*)serverversiondict, (void**)&original_func3);
- }
- */
-
- }
|