diff --git a/IPC.m b/IPC.m old mode 100644 new mode 100755 index 6358ede..5e131b5 --- a/IPC.m +++ b/IPC.m @@ -7,6 +7,7 @@ // #import +#import #import #import #import @@ -47,13 +48,41 @@ static inline void socketServerCallback(CFSocketRef s, CFSocketCallBackType type } } +@interface BSAuditToken : NSObject + +- (int)pid; + +@end + +// I don't think the first arugment even is a BSAuditToken, leaving it as a +//TODO: find actual function parameters to check if SpringBoard is requesting or some other proc +static BOOL (*original_BSAuditTokenTaskHasEntitlement)(BSAuditToken *token, NSString *entitlement); +static inline BOOL replaced_BSAuditTokenTaskHasEntitlement(BSAuditToken *token, NSString *entitlement) +{ + + if ([entitlement isEqualToString:@"com.apple.multitasking.unlimitedassertions"]) { + + // override the original result + // as mentioned, trying to access the first parameter crashes the device, and since it's happening on assertiond, it'll look like a bootloop. we could've used [token pid] == pidForProcess... or [token bundleIdentifier] + + return YES; + } + + return original_BSAuditTokenTaskHasEntitlement(token, entitlement); +} + static OBJCIPC *sharedInstance = nil; @implementation OBJCIPC + (void)load { - if ([self isBackBoard]) { + if( [self isAssertiond]) { + // replace the function. testing if is iOS 8 by checking if it responds to iOS 8-only method + if([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) { + MSHookFunction(((int *)MSFindSymbol(NULL, "_BSAuditTokenTaskHasEntitlement")), (int*)replaced_BSAuditTokenTaskHasEntitlement, (void**)&original_BSAuditTokenTaskHasEntitlement); + } + } else if ([self isBackBoard]) { // load the library dlopen(XPCObjects, RTLD_LAZY); @@ -79,6 +108,19 @@ + (void)load { } } ++ (BOOL)isAssertiond { + + static BOOL queried = NO; + static BOOL result = NO; + + if(!queried) { + queried = YES; + result = [[NSProcessInfo processInfo].processName isEqualToString:@"assertiond"]; + } + + return result; +} + + (BOOL)isSpringBoard { static BOOL queried = NO; @@ -230,7 +272,12 @@ + (BOOL)launchAppWithIdentifier:(NSString *)identifier stayInBackground:(BOOL)st SpringBoard *app = (SpringBoard *)[UIApplication sharedApplication]; SBApplicationController *controller = [objc_getClass("SBApplicationController") sharedInstance]; - SBApplication *application = [controller applicationWithDisplayIdentifier:identifier]; + SBApplication *application = nil; + if([controller respondsToSelector:@selector(applicationWithBundleIdentifier:)]) { + application = [controller applicationWithBundleIdentifier:identifier]; + } else { + application = [controller applicationWithDisplayIdentifier:identifier]; + } if (application == nil) { IPCLOG(@"App with identifier <%@> cannot be found", identifier); diff --git a/interface.h b/interface.h old mode 100644 new mode 100755 index 9a6306d..3f4571d --- a/interface.h +++ b/interface.h @@ -39,6 +39,7 @@ typedef enum + (instancetype)sharedInstance; - (SBApplication *)applicationWithDisplayIdentifier:(NSString *)identifier; +- (SBApplication *)applicationWithBundleIdentifier:(NSString *)identifier; @end diff --git a/layout/.DS_Store b/layout/.DS_Store new file mode 100644 index 0000000..a59d260 Binary files /dev/null and b/layout/.DS_Store differ diff --git a/layout/DEBIAN/.DS_Store b/layout/DEBIAN/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/layout/DEBIAN/.DS_Store differ diff --git a/layout/DEBIAN/control b/layout/DEBIAN/control old mode 100644 new mode 100755 index 3e46a93..103dcd1 --- a/layout/DEBIAN/control +++ b/layout/DEBIAN/control @@ -1,7 +1,7 @@ Package: cc.tweak.libobjcipc Name: libobjcipc -Depends: firmware (>= 7.0), mobilesubstrate -Version: 1.0.1 +Depends: firmware (>= 7.0), mobilesubstrate (>= 0.9.5101) +Version: 1.0.2 Architecture: iphoneos-arm Description: Maintainer: Alan Yip diff --git a/layout/DEBIAN/preinst b/layout/DEBIAN/preinst index 5e3a025..8a62e5a 100755 --- a/layout/DEBIAN/preinst +++ b/layout/DEBIAN/preinst @@ -5,7 +5,7 @@ cydia=($CYDIA) if [[ $1 == install || $1 == upgrade || $1 == reinstall || $1 == remove ]]; then if [[ ${CYDIA+@} ]]; then - eval "echo 'finish:restart' >&${cydia[0]}" + eval "echo 'finish:reboot' >&${cydia[0]}" fi fi diff --git a/layout/Library/.DS_Store b/layout/Library/.DS_Store new file mode 100644 index 0000000..9a0defe Binary files /dev/null and b/layout/Library/.DS_Store differ diff --git a/layout/Library/MobileSubstrate/.DS_Store b/layout/Library/MobileSubstrate/.DS_Store new file mode 100644 index 0000000..4e2f735 Binary files /dev/null and b/layout/Library/MobileSubstrate/.DS_Store differ diff --git a/layout/Library/MobileSubstrate/DynamicLibraries/libobjcipc.plist b/layout/Library/MobileSubstrate/DynamicLibraries/libobjcipc.plist old mode 100644 new mode 100755 index 48f01e0..2cbda2e --- a/layout/Library/MobileSubstrate/DynamicLibraries/libobjcipc.plist +++ b/layout/Library/MobileSubstrate/DynamicLibraries/libobjcipc.plist @@ -1 +1,12 @@ -{ Filter = { Bundles = ("com.apple.UIKit"); Executables = ("backboardd"); Mode = "Any"; }; } \ No newline at end of file +{ + Filter = { + Bundles = ( + "com.apple.UIKit" + ); + Executables = ( + "backboardd", + "assertiond" + ); + Mode = Any; + }; +} \ No newline at end of file