-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* zsign POC * new jitless mode & remove unused files * better project structure * recover info.plist * readme update * Update app hiding in readme
- Loading branch information
Showing
48 changed files
with
323 additions
and
1,943 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
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 |
---|---|---|
@@ -1,64 +1,66 @@ | ||
@import Foundation; | ||
@import Security; | ||
|
||
void LCCopyKeychainItems(NSString *oldService, NSString *newService) { | ||
// Query to find all keychain items with the old service | ||
NSData* getKeyChainItemFromService(NSString* key, NSString* service) { | ||
NSDictionary *query = @{ | ||
(__bridge id)kSecAttrService: oldService, | ||
(__bridge id)kSecAttrService: service, | ||
(__bridge id)kSecAttrAccount: key, | ||
(__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword, | ||
(__bridge id)kSecReturnData: @YES, | ||
(__bridge id)kSecAttrSynchronizable: (__bridge id)kSecAttrSynchronizableAny, | ||
(__bridge id)kSecMatchLimit: (__bridge id)kSecMatchLimitAll, | ||
(__bridge id)kSecReturnAttributes: @YES | ||
(__bridge id)kSecMatchLimit: (__bridge id)kSecMatchLimitOne, | ||
}; | ||
|
||
CFTypeRef result = NULL; | ||
OSStatus status = SecItemCopyMatching((CFDictionaryRef)query, &result); | ||
|
||
if (status == errSecSuccess) { | ||
NSArray *items = (__bridge NSArray *)result; | ||
NSData *data = (__bridge NSData *)result; | ||
return data; | ||
|
||
for (NSDictionary *item in items) { | ||
// Retrieve attributes and data of the keychain item | ||
NSString *account = item[(id)kSecAttrAccount]; | ||
NSData *passwordData = item[(id)kSecValueData]; | ||
|
||
NSDictionary *deleteQuery = @{ | ||
(__bridge id)kSecAttrService: newService, | ||
(__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword, | ||
(__bridge id)kSecAttrSynchronizable: (__bridge id)kSecAttrSynchronizableAny, | ||
(__bridge id)kSecAttrAccount: account | ||
}; | ||
|
||
OSStatus deleteStatus = SecItemDelete((CFDictionaryRef)deleteQuery); | ||
if (deleteStatus != errSecSuccess && deleteStatus != errSecItemNotFound) { | ||
NSLog(@"[LC] Delete failed %d", (int)deleteStatus); | ||
continue; | ||
} | ||
|
||
// Create a new keychain entry with the new service name | ||
NSDictionary *newItem = @{ | ||
(__bridge id)kSecAttrService: newService, | ||
(__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword, | ||
(__bridge id)kSecAttrSynchronizable: (__bridge id)kSecAttrSynchronizableAny, | ||
(__bridge id)kSecAttrAccount: account, | ||
(__bridge id)kSecValueData: passwordData | ||
}; | ||
OSStatus addStatus = SecItemAdd((CFDictionaryRef)newItem, NULL); | ||
if (addStatus != errSecSuccess) { | ||
NSLog(@"[LC] Add item failed %d", (int)deleteStatus); | ||
} | ||
} | ||
} else { | ||
NSLog(@"[LC] Error retrieving keychain items: %d", (int)status); | ||
return nil; | ||
} | ||
} | ||
|
||
BOOL synced = NO; | ||
__attribute__((constructor)) | ||
static void LCAltstoreHookInit(void) { | ||
if (!synced) { | ||
LCCopyKeychainItems(@"com.rileytestut.AltStore", [NSBundle.mainBundle bundleIdentifier]); | ||
synced = YES; | ||
if (synced) { | ||
return; | ||
} | ||
NSLog(@"[LC] LiveContainer AltStore Tweak build %s", CONFIG_COMMIT); | ||
NSString* bundleId = [NSBundle.mainBundle bundleIdentifier]; | ||
NSString* serviceName; | ||
NSArray<NSString*>* appGroups = [NSBundle.mainBundle.infoDictionary objectForKey:@"ALTAppGroups"]; | ||
if(appGroups == nil || [appGroups count] == 0) { | ||
NSLog(@"[LC] Invalid install method! Failed to find App Group ID."); | ||
return; | ||
} | ||
|
||
NSString* appGroupId = appGroups.firstObject; | ||
if([bundleId containsString:@"SideStore"]) { | ||
serviceName = @"com.SideStore.SideStore"; | ||
} else if ([bundleId containsString:@"AltStore"]) { | ||
serviceName = @"com.rileytestut.AltStore"; | ||
} else { | ||
NSLog(@"[LC] Failed to figure out which store this is!"); | ||
return; | ||
} | ||
NSData *certData = getKeyChainItemFromService(@"signingCertificate", serviceName); | ||
if(certData == nil) { | ||
NSLog(@"[LC] Failed to retrive certificate data!"); | ||
return; | ||
} | ||
NSData *certPassword = getKeyChainItemFromService(@"signingCertificatePassword", serviceName); | ||
if(certPassword == nil) { | ||
NSLog(@"[LC] Failed to retrive certificate password!"); | ||
return; | ||
} | ||
NSUserDefaults* appGroupUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:appGroupId]; | ||
[appGroupUserDefaults setObject:certData forKey:@"LCCertificateData"]; | ||
[appGroupUserDefaults setObject:[NSString stringWithUTF8String:certPassword.bytes] forKey:@"LCCertificatePassword"]; | ||
NSLog(@"[LC] Successfully updated JIT-Less certificate!"); | ||
synced = YES; | ||
} |
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
LiveContainerUI/LCAppDelegateSwiftUI.m → LiveContainerSwiftUI/LCAppDelegateSwiftUI.m
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
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
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
File renamed without changes.
Oops, something went wrong.