Compare commits

...

3 Commits

Author SHA1 Message Date
opa334 3913abfd8d Add skip-uicache option 2024-02-01 22:46:06 +01:00
alfiecg24 600193f7b4 Bump ChOma version 2024-02-01 21:42:51 +00:00
alfiecg24 11eb142d3b Fix signing unsupported MachO types 2024-02-01 21:40:23 +00:00
4 changed files with 30 additions and 9 deletions

2
ChOma

@ -1 +1 @@
Subproject commit b819acbad86eae7a187062d344a1cb62c60daa9b
Subproject commit 985302d7c14ba38e7275927b56a10887e899f594

View File

@ -128,6 +128,18 @@ int apply_coretrust_bypass(const char *machoPath)
return 2;
}
if (macho->machHeader.filetype == MH_OBJECT) {
printf("Error: MachO is an object file, please use a MachO executable or dynamic library!\n");
macho_free(macho);
return 3;
}
if (macho->machHeader.filetype == MH_DSYM) {
printf("Error: MachO is a dSYM file, please use a MachO executable or dynamic library!\n");
macho_free(macho);
return 3;
}
CS_SuperBlob *superblob = macho_read_code_signature(macho);
if (!superblob) {
printf("Error: no code signature found, please fake-sign the binary at minimum before running the bypass.\n");

View File

@ -72,6 +72,10 @@ int main(int argc, char *argv[]) {
}
char *machoPath = extract_preferred_slice(input);
if (!machoPath) {
printf("Failed extracting best slice\n");
return -1;
}
printf("Extracted best slice to %s\n", machoPath);
printf("Applying CoreTrust bypass...\n");

View File

@ -709,6 +709,8 @@ int signApp(NSString* appPath)
// If not, we can continue but want to show a warning after the app is installed
hasAdditionalEncryptedBinaries = YES;
}
} else if (r == 3) { // Non-fatal - unsupported MachO type
NSLog(@"[%@] Cannot apply CoreTrust bypass on an unsupported MachO type!", filePath);
}
else {
NSLog(@"[%@] CoreTrust bypass failed!!! :(", filePath);
@ -796,7 +798,7 @@ void applyPatchesToInfoDictionary(NSString* appPath)
// 180: tried to sign app where the main binary is encrypted
// 184: tried to sign app where an additional binary is encrypted
int installApp(NSString* appPackagePath, BOOL sign, BOOL force, BOOL isTSUpdate, BOOL useInstalldMethod)
int installApp(NSString* appPackagePath, BOOL sign, BOOL force, BOOL isTSUpdate, BOOL useInstalldMethod, BOOL skipUICache)
{
NSLog(@"[installApp force = %d]", force);
@ -978,9 +980,11 @@ int installApp(NSString* appPackagePath, BOOL sign, BOOL force, BOOL isTSUpdate,
// Also permissions need to be fixed
NSURL* updatedAppURL = findAppURLInBundleURL(appContainer.url);
fixPermissionsOfAppBundle(updatedAppURL.path);
if (!registerPath(updatedAppURL.path, 0, YES)) {
[[NSFileManager defaultManager] removeItemAtURL:appContainer.url error:nil];
return 181;
if (!skipUICache) {
if (!registerPath(updatedAppURL.path, 0, YES)) {
[[NSFileManager defaultManager] removeItemAtURL:appContainer.url error:nil];
return 181;
}
}
// Handle developer mode after installing and registering the app, to ensure that we
@ -1112,7 +1116,7 @@ int uninstallAppById(NSString* appId, BOOL useCustomMethod)
// 167: IPA does not appear to contain an app
// 180: IPA's main binary is encrypted
// 184: IPA contains additional encrypted binaries
int installIpa(NSString* ipaPath, BOOL force, BOOL useInstalldMethod)
int installIpa(NSString* ipaPath, BOOL force, BOOL useInstalldMethod, BOOL skipUICache)
{
cleanRestrictions();
@ -1131,7 +1135,7 @@ int installIpa(NSString* ipaPath, BOOL force, BOOL useInstalldMethod)
return 168;
}
int ret = installApp(tmpPackagePath, YES, force, NO, useInstalldMethod);
int ret = installApp(tmpPackagePath, YES, force, NO, useInstalldMethod, skipUICache);
[[NSFileManager defaultManager] removeItemAtPath:tmpPackagePath error:nil];
@ -1234,7 +1238,7 @@ int installTrollStore(NSString* pathToTar)
_installPersistenceHelper(persistenceHelperApp, trollStorePersistenceHelper, trollStoreRootHelper);
}
int ret = installApp(tmpPackagePath, NO, YES, YES, YES);
int ret = installApp(tmpPackagePath, NO, YES, YES, YES, NO);
NSLog(@"[installTrollStore] installApp => %d", ret);
[[NSFileManager defaultManager] removeItemAtPath:tmpPackagePath error:nil];
return ret;
@ -1464,8 +1468,9 @@ int MAIN_NAME(int argc, char *argv[], char *envp[])
// use system method when specified, otherwise use custom method
BOOL useInstalldMethod = [args containsObject:@"installd"];
BOOL force = [args containsObject:@"force"];
BOOL skipUICache = [args containsObject:@"skip-uicache"];
NSString* ipaPath = args.lastObject;
ret = installIpa(ipaPath, force, useInstalldMethod);
ret = installIpa(ipaPath, force, useInstalldMethod, skipUICache);
}
else if([cmd isEqualToString:@"uninstall"])
{