Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions IPC.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <arpa/inet.h>
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions interface.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ typedef enum

+ (instancetype)sharedInstance;
- (SBApplication *)applicationWithDisplayIdentifier:(NSString *)identifier;
- (SBApplication *)applicationWithBundleIdentifier:(NSString *)identifier;

@end

Expand Down
Binary file added layout/.DS_Store
Binary file not shown.
Binary file added layout/DEBIAN/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions layout/DEBIAN/control
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion layout/DEBIAN/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file added layout/Library/.DS_Store
Binary file not shown.
Binary file added layout/Library/MobileSubstrate/.DS_Store
Binary file not shown.
13 changes: 12 additions & 1 deletion layout/Library/MobileSubstrate/DynamicLibraries/libobjcipc.plist
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
{ Filter = { Bundles = ("com.apple.UIKit"); Executables = ("backboardd"); Mode = "Any"; }; }
{
Filter = {
Bundles = (
"com.apple.UIKit"
);
Executables = (
"backboardd",
"assertiond"
);
Mode = Any;
};
}