Private
Public Access
1
0

Try to not use private entitlements

This commit is contained in:
James Magahern
2018-11-13 22:39:03 -08:00
parent ce7e6e7dd8
commit f462ee68ca
12 changed files with 309 additions and 51 deletions

View File

@@ -8,9 +8,14 @@
#import <Foundation/Foundation.h>
// See note in hooking.m about why this was a bad idea
#define HOOK_IMAGENT 0
NS_ASSUME_NONNULL_BEGIN
@interface MBIMBridge : NSObject
@property (nonatomic, assign) const char *dylibPath;
+ (instancetype)sharedInstance;
- (instancetype)init NS_UNAVAILABLE;

View File

@@ -8,6 +8,7 @@
#import "MBIMBridge.h"
#import "MBIMBridgeOperation.h"
#import "hooking.h"
#import <GCDWebServers/GCDWebServers.h>
@@ -55,14 +56,32 @@ static NSString *const MBIMBridgeToken = @"net.buzzert.kordophone";
return self;
}
- (void)_terminate
{
// *shrug*
exit(0);
}
#pragma mark -
#pragma mark Connection
- (void)connect
{
#if HOOK_IMAGENT
char *errorString = nil;
BOOL hooked = HookIMAgent(self.dylibPath, &errorString);
if (!hooked) {
NSString *errorNSString = [NSString stringWithUTF8String:errorString];
NSLog(@"Error hooking imagent: %@", errorNSString);
return;
}
#endif
if (![sDaemonController hasListenerForID: MBIMBridgeToken]) {
if (![sDaemonController addListenerID:MBIMBridgeToken capabilities:(kFZListenerCapFileTransfers | kFZListenerCapManageStatus | kFZListenerCapChats | kFZListenerCapMessageHistory | kFZListenerCapIDQueries | kFZListenerCapSendMessages)]) {
NSLog(@"Failed to connect to imagent");
[self _terminate];
}
}
}
@@ -158,6 +177,7 @@ static NSString *const MBIMBridgeToken = @"net.buzzert.kordophone";
NSLog(@"iMessage account connected: %@", iMessageAccount);
} else {
NSLog(@"imagent returned no accounts (not entitled?)");
[self _terminate];
}
}