diff --git a/Application/Dopamine/Jailbreak/DOJailbreaker.m b/Application/Dopamine/Jailbreak/DOJailbreaker.m index db5c8e614..2d12a87b7 100644 --- a/Application/Dopamine/Jailbreak/DOJailbreaker.m +++ b/Application/Dopamine/Jailbreak/DOJailbreaker.m @@ -484,12 +484,15 @@ - (void)runWithError:(NSError **)errOut didRemoveJailbreak:(BOOL*)didRemove show BOOL removeJailbreakEnabled = [[DOPreferenceManager sharedManager] boolPreferenceValueForKey:@"removeJailbreakEnabled" fallback:NO]; BOOL tweaksEnabled = [[DOPreferenceManager sharedManager] boolPreferenceValueForKey:@"tweakInjectionEnabled" fallback:YES]; BOOL idownloadEnabled = [[DOPreferenceManager sharedManager] boolPreferenceValueForKey:@"idownloadEnabled" fallback:NO]; + BOOL appJITEnabled = [[DOPreferenceManager sharedManager] boolPreferenceValueForKey:@"appJITEnabled" fallback:YES]; *errOut = [self gatherSystemInformation]; if (*errOut) return; *errOut = [self doExploitation]; if (*errOut) return; + gSystemInfo.jailbreakSettings.markAppsAsDebugged = appJITEnabled; + [[DOUIManager sharedInstance] sendLog:DOLocalizedString(@"Building Phys R/W Primitive") debug:NO]; *errOut = [self buildPhysRWPrimitive]; if (*errOut) return; diff --git a/Application/Dopamine/UI/Settings/DOSettingsController.m b/Application/Dopamine/UI/Settings/DOSettingsController.m index f316df346..9f0d6d39c 100644 --- a/Application/Dopamine/UI/Settings/DOSettingsController.m +++ b/Application/Dopamine/UI/Settings/DOSettingsController.m @@ -65,24 +65,24 @@ - (NSArray *)availableKernelExploitNames - (NSArray *)availablePACBypassIdentifiers { NSMutableArray *identifiers = [NSMutableArray new]; - for (DOExploit *exploit in _availablePACBypasses) { - [identifiers addObject:exploit.identfier]; - } if (![DOEnvironmentManager sharedManager].isPACBypassRequired) { [identifiers addObject:@"none"]; } + for (DOExploit *exploit in _availablePACBypasses) { + [identifiers addObject:exploit.identfier]; + } return identifiers; } - (NSArray *)availablePACBypassNames { NSMutableArray *names = [NSMutableArray new]; + if (![DOEnvironmentManager sharedManager].isPACBypassRequired) { + [names addObject:DOLocalizedString(@"None")]; + } for (DOExploit *exploit in _availablePACBypasses) { [names addObject:exploit.name]; } - if (![DOEnvironmentManager sharedManager].isPACBypassRequired) { - [names addObject:@"None"]; - } return names; } @@ -124,10 +124,12 @@ - (id)specifiers SEL defGetter = @selector(readPreferenceValue:); SEL defSetter = @selector(setPreferenceValue:specifier:); - _availableKernelExploits = [exploitManager availableExploitsForType:EXPLOIT_TYPE_KERNEL].allObjects; + NSSortDescriptor *prioritySortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"priority" ascending:NO]; + + _availableKernelExploits = [[exploitManager availableExploitsForType:EXPLOIT_TYPE_KERNEL] sortedArrayUsingDescriptors:@[prioritySortDescriptor]]; if (envManager.isArm64e) { - _availablePACBypasses = [exploitManager availableExploitsForType:EXPLOIT_TYPE_PAC].allObjects; - _availablePPLBypasses = [exploitManager availableExploitsForType:EXPLOIT_TYPE_PPL].allObjects; + _availablePACBypasses = [[exploitManager availableExploitsForType:EXPLOIT_TYPE_PAC] sortedArrayUsingDescriptors:@[prioritySortDescriptor]]; + _availablePPLBypasses = [[exploitManager availableExploitsForType:EXPLOIT_TYPE_PPL] sortedArrayUsingDescriptors:@[prioritySortDescriptor]]; } PSSpecifier *headerSpecifier = [PSSpecifier emptyGroupSpecifier]; @@ -201,6 +203,12 @@ - (id)specifiers [idownloadSpecifier setProperty:@NO forKey:@"default"]; [specifiers addObject:idownloadSpecifier]; + PSSpecifier *appJitSpecifier = [PSSpecifier preferenceSpecifierNamed:DOLocalizedString(@"Settings_Apps_JIT") target:self set:@selector(setAppJITEnabled:specifier:) get:@selector(readAppJITEnabled:) detail:nil cell:PSSwitchCell edit:nil]; + [appJitSpecifier setProperty:@YES forKey:@"enabled"]; + [appJitSpecifier setProperty:@"appJITEnabled" forKey:@"key"]; + [appJitSpecifier setProperty:@YES forKey:@"default"]; + [specifiers addObject:appJitSpecifier]; + if (!envManager.isJailbroken && !envManager.isInstalledThroughTrollStore) { PSSpecifier *removeJailbreakSwitchSpecifier = [PSSpecifier preferenceSpecifierNamed:DOLocalizedString(@"Button_Remove_Jailbreak") target:self set:@selector(setRemoveJailbreakEnabled:specifier:) get:defGetter detail:nil cell:PSSwitchCell edit:nil]; [removeJailbreakSwitchSpecifier setProperty:@YES forKey:@"enabled"]; @@ -359,6 +367,25 @@ - (void)setTweakInjectionEnabled:(id)value specifier:(PSSpecifier *)specifier } } +- (id)readAppJITEnabled:(PSSpecifier *)specifier +{ + DOEnvironmentManager *envManager = [DOEnvironmentManager sharedManager]; + if (envManager.isJailbroken) { + bool v = jbclient_platform_jbsettings_get_bool("markAppsAsDebugged"); + return @(v); + } + return [self readPreferenceValue:specifier]; +} + +- (void)setAppJITEnabled:(id)value specifier:(PSSpecifier *)specifier +{ + [self setPreferenceValue:value specifier:specifier]; + DOEnvironmentManager *envManager = [DOEnvironmentManager sharedManager]; + if (envManager.isJailbroken) { + jbclient_platform_jbsettings_set_bool("markAppsAsDebugged", ((NSNumber *)value).boolValue); + } +} + - (void)setRemoveJailbreakEnabled:(id)value specifier:(PSSpecifier *)specifier { [self setPreferenceValue:value specifier:specifier]; diff --git a/Application/Dopamine/UI/Settings/PSLists/DOPSListController.m b/Application/Dopamine/UI/Settings/PSLists/DOPSListController.m index be4514e0d..33bb676f6 100644 --- a/Application/Dopamine/UI/Settings/PSLists/DOPSListController.m +++ b/Application/Dopamine/UI/Settings/PSLists/DOPSListController.m @@ -17,7 +17,6 @@ @implementation DOPSListController - (void)viewDidLoad { [super viewDidLoad]; - [_table setSeparatorColor:[UIColor clearColor]]; [_table setBackgroundColor:[UIColor clearColor]]; [DOPSListController setupViewControllerStyle:self]; diff --git a/Application/Dopamine/ar.lproj/Localizable.strings b/Application/Dopamine/ar.lproj/Localizable.strings index 62123a768..8b9c94c62 100644 --- a/Application/Dopamine/ar.lproj/Localizable.strings +++ b/Application/Dopamine/ar.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "تشغيل الأدوات"; "Settings_iDownload" = "iDownload (محطة المطور)"; "Settings_Verbose_Logs" = "السجلات المطولة"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "إزالة الجيلبريك"; diff --git a/Application/Dopamine/da.lproj/Localizable.strings b/Application/Dopamine/da.lproj/Localizable.strings index f23737fb6..c29be87d5 100644 --- a/Application/Dopamine/da.lproj/Localizable.strings +++ b/Application/Dopamine/da.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweak-injektion"; "Settings_iDownload" = "iDownload (Udviklerterminal)"; "Settings_Verbose_Logs" = "Detaljerede logfiler"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Fjern Jailbreak"; diff --git a/Application/Dopamine/de.lproj/Localizable.strings b/Application/Dopamine/de.lproj/Localizable.strings index f1a480cee..fb8999f9b 100644 --- a/Application/Dopamine/de.lproj/Localizable.strings +++ b/Application/Dopamine/de.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweaks laden"; "Settings_iDownload" = "iDownload (Entwickler-Terminal)"; "Settings_Verbose_Logs" = "Detaillierte Logs"; +"Settings_Apps_JIT" = "Erlaube JIT in Apps"; // Settings Buttons "Button_Remove_Jailbreak" = "Jailbreak entfernen"; diff --git a/Application/Dopamine/el.lproj/Localizable.strings b/Application/Dopamine/el.lproj/Localizable.strings index 6c9027a90..18b1b29b9 100644 --- a/Application/Dopamine/el.lproj/Localizable.strings +++ b/Application/Dopamine/el.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Ενσωμάτωση Tweak"; "Settings_iDownload" = "iDownload (Τερματικό προγραμματιστή)"; "Settings_Verbose_Logs" = "Λεπτομερής καταγραφή"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Αφαίρεση Jailbreak"; diff --git a/Application/Dopamine/en.lproj/Localizable.strings b/Application/Dopamine/en.lproj/Localizable.strings index 94995ec10..fdab0052f 100644 --- a/Application/Dopamine/en.lproj/Localizable.strings +++ b/Application/Dopamine/en.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweak Injection"; "Settings_iDownload" = "iDownload (Developer Shell)"; "Settings_Verbose_Logs" = "Verbose Logs"; +"Settings_Apps_JIT" = "Allow JIT in Apps"; // Settings Buttons "Button_Remove_Jailbreak" = "Remove Jailbreak"; diff --git a/Application/Dopamine/es.lproj/Localizable.strings b/Application/Dopamine/es.lproj/Localizable.strings index e07e32cc2..934e567d9 100644 --- a/Application/Dopamine/es.lproj/Localizable.strings +++ b/Application/Dopamine/es.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Inyección de ajustes"; "Settings_iDownload" = "iDownload (Shell de desarrollador)"; "Settings_Verbose_Logs" = "Registros detallados"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Eliminar Jailbreak"; diff --git a/Application/Dopamine/fil.lproj/Localizable.strings b/Application/Dopamine/fil.lproj/Localizable.strings index 26dfc4b0a..2d1b9ee95 100644 --- a/Application/Dopamine/fil.lproj/Localizable.strings +++ b/Application/Dopamine/fil.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweak Injection"; "Settings_iDownload" = "iDownload (Terminal ng Developer)"; "Settings_Verbose_Logs" = "Mga Verbose Logs"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Tanggalin ang Jailbreak"; diff --git a/Application/Dopamine/fr.lproj/Localizable.strings b/Application/Dopamine/fr.lproj/Localizable.strings index e453ea96b..43e717b22 100644 --- a/Application/Dopamine/fr.lproj/Localizable.strings +++ b/Application/Dopamine/fr.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Injection de tweaks"; "Settings_iDownload" = "iDownload (Outil de dev)"; "Settings_Verbose_Logs" = "Mode verbose"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Supprimer le jailbreak"; diff --git a/Application/Dopamine/it.lproj/Localizable.strings b/Application/Dopamine/it.lproj/Localizable.strings index a09b4bb03..10b09e7c2 100644 --- a/Application/Dopamine/it.lproj/Localizable.strings +++ b/Application/Dopamine/it.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Iniezione Tweak"; "Settings_iDownload" = "iDownload (Terminal per sviluppatori)"; "Settings_Verbose_Logs" = "Log Dettagliati"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Rimuovi il Jailbreak"; diff --git a/Application/Dopamine/ja.lproj/Localizable.strings b/Application/Dopamine/ja.lproj/Localizable.strings index 16ee174a6..43930b671 100644 --- a/Application/Dopamine/ja.lproj/Localizable.strings +++ b/Application/Dopamine/ja.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweak Injection"; "Settings_iDownload" = "iDownload (開発者用シェル)"; "Settings_Verbose_Logs" = "詳細なログ"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Jailbreak環境の削除"; diff --git a/Application/Dopamine/kk.lproj/Localizable.strings b/Application/Dopamine/kk.lproj/Localizable.strings index b5a9acb0f..47046bd06 100644 --- a/Application/Dopamine/kk.lproj/Localizable.strings +++ b/Application/Dopamine/kk.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Твиктерді енгізу"; "Settings_iDownload" = "iDownload (Әзірлеуші ​​​​терминалы)"; "Settings_Verbose_Logs" = "Кеңейтілген журналдар"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Джейлбрейкті жою"; diff --git a/Application/Dopamine/ko.lproj/Localizable.strings b/Application/Dopamine/ko.lproj/Localizable.strings index 3a23f9388..c22a8d92c 100644 --- a/Application/Dopamine/ko.lproj/Localizable.strings +++ b/Application/Dopamine/ko.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "트윅 주입"; "Settings_iDownload" = "iDownload (개발자 터미널)"; "Settings_Verbose_Logs" = "로그"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "탈옥 제거"; diff --git a/Application/Dopamine/main.m b/Application/Dopamine/main.m index c9c9d2d4a..1dea1b224 100644 --- a/Application/Dopamine/main.m +++ b/Application/Dopamine/main.m @@ -36,7 +36,7 @@ int main(int argc, char * argv[]) { // If systemhook isn't loaded and we are already jailbroken, we need to do the checkin ourselves // This can happen when the jailbreak is hidden or when tweak injection into the Dopamine app is disabled via Choicy - jbclient_process_checkin(NULL, NULL, NULL); + jbclient_process_checkin(NULL, NULL, NULL, NULL); if ([DOEnvironmentManager sharedManager].isJailbroken) { setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin:/var/jb/sbin:/var/jb/bin:/var/jb/usr/sbin:/var/jb/usr/bin", 1); diff --git a/Application/Dopamine/nl.lproj/Localizable.strings b/Application/Dopamine/nl.lproj/Localizable.strings index 62e178b08..71f284434 100644 --- a/Application/Dopamine/nl.lproj/Localizable.strings +++ b/Application/Dopamine/nl.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweak Injection"; "Settings_iDownload" = "iDownload (Ontwikkelaar Terminal)"; "Settings_Verbose_Logs" = "Uitgebreide logs"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Jailbreak verwijderen"; diff --git a/Application/Dopamine/pl.lproj/Localizable.strings b/Application/Dopamine/pl.lproj/Localizable.strings index bbace8c4d..380fd7b32 100644 --- a/Application/Dopamine/pl.lproj/Localizable.strings +++ b/Application/Dopamine/pl.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Wstrzykiwanie tweaków"; "Settings_iDownload" = "iDownload (terminal dla deweloperów)"; "Settings_Verbose_Logs" = "Logi verbose"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Usuń jailbreak"; diff --git a/Application/Dopamine/pt-BR.lproj/Localizable.strings b/Application/Dopamine/pt-BR.lproj/Localizable.strings index a75ae191c..a6536aab5 100644 --- a/Application/Dopamine/pt-BR.lproj/Localizable.strings +++ b/Application/Dopamine/pt-BR.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Injeção de Tweaks"; "Settings_iDownload" = "iDownload (Terminal de desenvolvedor)"; "Settings_Verbose_Logs" = "Logs do Verbose"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Remover o Jailbreak"; diff --git a/Application/Dopamine/ru.lproj/Localizable.strings b/Application/Dopamine/ru.lproj/Localizable.strings index 8a855d0fb..6853ccef0 100644 --- a/Application/Dopamine/ru.lproj/Localizable.strings +++ b/Application/Dopamine/ru.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Внедрение твиков"; "Settings_iDownload" = "iDownload (Терминал разработчика)"; "Settings_Verbose_Logs" = "Расширенные логи"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Удалить джейлбрейк"; diff --git a/Application/Dopamine/sv.lproj/Localizable.strings b/Application/Dopamine/sv.lproj/Localizable.strings index 2da6080b5..02cafeff9 100644 --- a/Application/Dopamine/sv.lproj/Localizable.strings +++ b/Application/Dopamine/sv.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweak Injection"; "Settings_iDownload" = "iDownload (Terminal för utvecklare)"; "Settings_Verbose_Logs" = "Omfattande loggar"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Ta Bot Jailbreak"; diff --git a/Application/Dopamine/th.lproj/Localizable.strings b/Application/Dopamine/th.lproj/Localizable.strings index 836734db8..18aa77213 100644 --- a/Application/Dopamine/th.lproj/Localizable.strings +++ b/Application/Dopamine/th.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweak Injection"; "Settings_iDownload" = "iDownload (Developer Shell)"; "Settings_Verbose_Logs" = "Verbose Logs"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "ลบเจลเบรค"; diff --git a/Application/Dopamine/tr.lproj/Localizable.strings b/Application/Dopamine/tr.lproj/Localizable.strings index f0ba55c4c..d9926c667 100644 --- a/Application/Dopamine/tr.lproj/Localizable.strings +++ b/Application/Dopamine/tr.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweak Enjeksiyonu"; "Settings_iDownload" = "iDownload (Geliştirici Terminali)"; "Settings_Verbose_Logs" = "Sözlü Loglar"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Jailbreak'i Sil"; diff --git a/Application/Dopamine/uk.lproj/Localizable.strings b/Application/Dopamine/uk.lproj/Localizable.strings index 1754536a2..97259a803 100644 --- a/Application/Dopamine/uk.lproj/Localizable.strings +++ b/Application/Dopamine/uk.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "ін'єкція твiков"; "Settings_iDownload" = "iDownload (Термінал розробника)"; "Settings_Verbose_Logs" = "Докладні логи"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Видалити джейлбрейк"; diff --git a/Application/Dopamine/ur.lproj/Localizable.strings b/Application/Dopamine/ur.lproj/Localizable.strings index fe4279bba..dede57321 100644 --- a/Application/Dopamine/ur.lproj/Localizable.strings +++ b/Application/Dopamine/ur.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Tweak Injection"; "Settings_iDownload" = "iDownload (ڈویلپر ٹرمینل)"; "Settings_Verbose_Logs" = "Verbose Logs"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = " جیل بریک اتارلو"; diff --git a/Application/Dopamine/vi.lproj/Localizable.strings b/Application/Dopamine/vi.lproj/Localizable.strings index 030750e5b..2eb6857d2 100644 --- a/Application/Dopamine/vi.lproj/Localizable.strings +++ b/Application/Dopamine/vi.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "Cho phép chạy Tweak"; "Settings_iDownload" = "iDownload (nhà phát triển)"; "Settings_Verbose_Logs" = "Hiện Log dạng phức tạp"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "Gỡ Jailbreak"; diff --git a/Application/Dopamine/zh-CN.lproj/Localizable.strings b/Application/Dopamine/zh-CN.lproj/Localizable.strings index 2f1d2e892..80f3dbb9a 100644 --- a/Application/Dopamine/zh-CN.lproj/Localizable.strings +++ b/Application/Dopamine/zh-CN.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "插件注入"; "Settings_iDownload" = "iDownload (开发者终端)"; "Settings_Verbose_Logs" = "详细日志"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "移除越狱"; diff --git a/Application/Dopamine/zh-HK.lproj/Localizable.strings b/Application/Dopamine/zh-HK.lproj/Localizable.strings index b6394fc3b..cd1ea955f 100644 --- a/Application/Dopamine/zh-HK.lproj/Localizable.strings +++ b/Application/Dopamine/zh-HK.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "插件注入"; "Settings_iDownload" = "iDownload (开发商终端)"; "Settings_Verbose_Logs" = "詳細日誌"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "清除越獄"; diff --git a/Application/Dopamine/zh-Hans.lproj/Localizable.strings b/Application/Dopamine/zh-Hans.lproj/Localizable.strings index 2f1d2e892..80f3dbb9a 100644 --- a/Application/Dopamine/zh-Hans.lproj/Localizable.strings +++ b/Application/Dopamine/zh-Hans.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "插件注入"; "Settings_iDownload" = "iDownload (开发者终端)"; "Settings_Verbose_Logs" = "详细日志"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "移除越狱"; diff --git a/Application/Dopamine/zh-TW.lproj/Localizable.strings b/Application/Dopamine/zh-TW.lproj/Localizable.strings index 6d4aafc21..b4e0fe917 100644 --- a/Application/Dopamine/zh-TW.lproj/Localizable.strings +++ b/Application/Dopamine/zh-TW.lproj/Localizable.strings @@ -41,6 +41,7 @@ "Settings_Tweak_Injection" = "載入插體"; "Settings_iDownload" = "iDownload (開發者终端)"; "Settings_Verbose_Logs" = "詳細日誌"; +/*Settings_Apps_JIT*/ // Settings Buttons "Button_Remove_Jailbreak" = "移除越獄"; diff --git a/BaseBin/launchdhook/src/jbserver/jbdomain_platform.c b/BaseBin/launchdhook/src/jbserver/jbdomain_platform.c index d79154662..c13fa5f9b 100644 --- a/BaseBin/launchdhook/src/jbserver/jbdomain_platform.c +++ b/BaseBin/launchdhook/src/jbserver/jbdomain_platform.c @@ -28,6 +28,24 @@ static int platform_stage_jailbreak_update(const char *updateTar) return 1; } +static int platform_jbsettings_get(const char *key, xpc_object_t *valueOut) +{ + if (!strcmp(key, "markAppsAsDebugged")) { + *valueOut = xpc_bool_create(jbsetting(markAppsAsDebugged)); + return 0; + } + return -1; +} + +static int platform_jbsettings_set(const char *key, xpc_object_t value) +{ + if (!strcmp(key, "markAppsAsDebugged") && xpc_get_type(value) == XPC_TYPE_BOOL) { + gSystemInfo.jailbreakSettings.markAppsAsDebugged = xpc_bool_get_value(value); + return 0; + } + return -1; +} + struct jbserver_domain gPlatformDomain = { .permissionHandler = platform_domain_allowed, .actions = { @@ -48,6 +66,22 @@ struct jbserver_domain gPlatformDomain = { { 0 }, }, }, + // JBS_PLATFORM_JBSETTINGS_GET + { + .handler = platform_jbsettings_get, + .args = (jbserver_arg[]){ + { .name = "key", .type = JBS_TYPE_STRING, .out = false }, + { .name = "value", .type = JBS_TYPE_XPC_GENERIC, .out = true }, + }, + }, + // JBS_PLATFORM_JBSETTINGS_SET + { + .handler = platform_jbsettings_set, + .args = (jbserver_arg[]){ + { .name = "key", .type = JBS_TYPE_STRING, .out = false }, + { .name = "value", .type = JBS_TYPE_XPC_GENERIC, .out = false }, + }, + }, { 0 }, }, }; \ No newline at end of file diff --git a/BaseBin/launchdhook/src/jbserver/jbdomain_systemwide.c b/BaseBin/launchdhook/src/jbserver/jbdomain_systemwide.c index 7c4229931..9961f54eb 100644 --- a/BaseBin/launchdhook/src/jbserver/jbdomain_systemwide.c +++ b/BaseBin/launchdhook/src/jbserver/jbdomain_systemwide.c @@ -11,6 +11,7 @@ #include #include +extern bool stringStartsWith(const char *str, const char* prefix); extern bool stringEndsWith(const char* str, const char* suffix); static bool systemwide_domain_allowed(audit_token_t clientToken) @@ -72,7 +73,7 @@ static int systemwide_trust_library(audit_token_t *processToken, const char *lib return trust_file(libraryPath, callerLibraryPath, callerPath); } -static int systemwide_process_checkin(audit_token_t *processToken, char **rootPathOut, char **bootUUIDOut, char **sandboxExtensionsOut) +static int systemwide_process_checkin(audit_token_t *processToken, char **rootPathOut, char **bootUUIDOut, char **sandboxExtensionsOut, bool *fullyDebuggedOut) { // Fetch process info pid_t pid = audit_token_to_pid(*processToken); @@ -99,8 +100,18 @@ static int systemwide_process_checkin(audit_token_t *processToken, char **rootPa if (readExtension) free(readExtension); if (execExtension) free(execExtension); + bool fullyDebugged = false; + if (stringStartsWith(procPath, "/private/var/containers/Bundle/Application")) { + // This is an app + // Enable CS_DEBUGGED based on user preference + if (jbsetting(markAppsAsDebugged)) { + fullyDebugged = true; + } + } + *fullyDebuggedOut = fullyDebugged; + // Allow invalid pages - cs_allow_invalid(proc, false); + cs_allow_invalid(proc, fullyDebugged); // Fix setuid struct stat sb; @@ -290,6 +301,7 @@ struct jbserver_domain gSystemwideDomain = { { .name = "root-path", .type = JBS_TYPE_STRING, .out = true }, { .name = "boot-uuid", .type = JBS_TYPE_STRING, .out = true }, { .name = "sandbox-extensions", .type = JBS_TYPE_STRING, .out = true }, + { .name = "fully-debugged", .type = JBS_TYPE_BOOL, .out = true }, { 0 }, }, }, diff --git a/BaseBin/launchdhook/src/update.m b/BaseBin/launchdhook/src/update.m index bc88424d8..68f1e5bf8 100644 --- a/BaseBin/launchdhook/src/update.m +++ b/BaseBin/launchdhook/src/update.m @@ -190,4 +190,10 @@ void jbupdate_finalize_stage2(const char *prevVersion, const char *newVersion) if (!access(JBRootPath("/basebin/.idownloadd_enabled"), F_OK)) { remove(JBRootPath("/basebin/.idownloadd_enabled")); } + + if (strcmp(prevVersion, "2.1") < 0 && strcmp(newVersion, "2.1") >= 0) { + // Default value for this pref is true + // Set it during jbupdate if prev version is <2.1 and new version is >=2.1 + gSystemInfo.jailbreakSettings.markAppsAsDebugged = true; + } } \ No newline at end of file diff --git a/BaseBin/libjailbreak/src/info.h b/BaseBin/libjailbreak/src/info.h index 57ba28eea..895c3464f 100644 --- a/BaseBin/libjailbreak/src/info.h +++ b/BaseBin/libjailbreak/src/info.h @@ -32,6 +32,10 @@ struct system_info { char *rootPath; } jailbreakInfo; + struct { + bool markAppsAsDebugged; + } jailbreakSettings; + struct { // Functions uint64_t perfmon_dev_open; @@ -231,6 +235,9 @@ extern struct system_info gSystemInfo; iterator(ctx, jailbreakInfo.usesPACBypass); \ iterator(ctx, jailbreakInfo.rootPath); +#define JAILBREAK_SETTINGS_ITERATE(ctx, iterator) \ + iterator(ctx, jailbreakSettings.markAppsAsDebugged); + #define KERNEL_SYMBOLS_ITERATE(ctx, iterator) \ iterator(ctx, kernelSymbol.perfmon_dev_open); \ iterator(ctx, kernelSymbol.vn_kqfilter); \ @@ -369,6 +376,7 @@ extern struct system_info gSystemInfo; #define SYSTEM_INFO_ITERATE(ctx, iterator) \ KERNEL_CONSTANTS_ITERATE(ctx, iterator); \ JAILBREAK_INFO_ITERATE(ctx, iterator); \ + JAILBREAK_SETTINGS_ITERATE(ctx, iterator); \ KERNEL_SYMBOLS_ITERATE(ctx, iterator); \ KERNEL_GADGETS_ITERATE(ctx, iterator); \ KERNEL_STRUCTS_ITERATE(ctx, iterator); @@ -413,6 +421,7 @@ static void _safe_xpc_dictionary_set_string(xpc_object_t xdict, const char *name #define kconstant(name) (gSystemInfo.kernelConstant.name) #define jbinfo(name) (gSystemInfo.jailbreakInfo.name) +#define jbsetting(name) (gSystemInfo.jailbreakSettings.name) #define ksymbol(name) (gSystemInfo.kernelSymbol.name ? (gSystemInfo.kernelConstant.slide + gSystemInfo.kernelSymbol.name) : 0) #define kgadget(name) (gSystemInfo.kernelGadget.name ? (gSystemInfo.kernelConstant.slide + gSystemInfo.kernelGadget.name) : 0) #define koffsetof(structname, member) (gSystemInfo.kernelStruct.structname.member) diff --git a/BaseBin/libjailbreak/src/jbclient_xpc.c b/BaseBin/libjailbreak/src/jbclient_xpc.c index 5e58e958e..01a3c4a09 100644 --- a/BaseBin/libjailbreak/src/jbclient_xpc.c +++ b/BaseBin/libjailbreak/src/jbclient_xpc.c @@ -231,7 +231,7 @@ int jbclient_trust_library(const char *libraryPath, void *addressInCaller) return -1; } -int jbclient_process_checkin(char **rootPathOut, char **bootUUIDOut, char **sandboxExtensionsOut) +int jbclient_process_checkin(char **rootPathOut, char **bootUUIDOut, char **sandboxExtensionsOut, bool *fullyDebuggedOut) { xpc_object_t xreply = jbserver_xpc_send(JBS_DOMAIN_SYSTEMWIDE, JBS_SYSTEMWIDE_PROCESS_CHECKIN, NULL); if (xreply) { @@ -242,6 +242,7 @@ int jbclient_process_checkin(char **rootPathOut, char **bootUUIDOut, char **sand if (rootPathOut) *rootPathOut = rootPath ? strdup(rootPath) : NULL; if (bootUUIDOut) *bootUUIDOut = bootUUID ? strdup(bootUUID) : NULL; if (sandboxExtensionsOut) *sandboxExtensionsOut = sandboxExtensions ? strdup(sandboxExtensions) : NULL; + if (fullyDebuggedOut) *fullyDebuggedOut = xpc_dictionary_get_bool(xreply, "fully-debugged"); xpc_release(xreply); return result; } @@ -305,6 +306,80 @@ int jbclient_platform_stage_jailbreak_update(const char *updateTar) return -1; } + +int jbclient_platform_jbsettings_get(const char *key, xpc_object_t *valueOut) +{ + xpc_object_t xargs = xpc_dictionary_create_empty(); + xpc_dictionary_set_string(xargs, "key", key); + xpc_object_t xreply = jbserver_xpc_send(JBS_DOMAIN_PLATFORM, JBS_PLATFORM_JBSETTINGS_GET, xargs); + xpc_release(xargs); + if (xreply) { + int result = xpc_dictionary_get_int64(xreply, "result"); + xpc_object_t value = xpc_dictionary_get_value(xreply, "value"); + if (value && valueOut) *valueOut = xpc_copy(value); + xpc_release(xreply); + return result; + } + return -1; +} + +bool jbclient_platform_jbsettings_get_bool(const char *key) +{ + xpc_object_t value; + if (jbclient_platform_jbsettings_get(key, &value) == 0) { + if (value) { + bool valueBool = xpc_bool_get_value(value); + xpc_release(value); + return valueBool; + } + } + return false; +} + +uint64_t jbclient_platform_jbsettings_get_uint64(const char *key) +{ + xpc_object_t value; + if (jbclient_platform_jbsettings_get(key, &value) == 0) { + if (value) { + uint64_t valueU64 = xpc_uint64_get_value(value); + xpc_release(value); + return valueU64; + } + } + return 0; +} + +int jbclient_platform_jbsettings_set(const char *key, xpc_object_t value) +{ + xpc_object_t xargs = xpc_dictionary_create_empty(); + xpc_dictionary_set_string(xargs, "key", key); + xpc_dictionary_set_value(xargs, "value", value); + xpc_object_t xreply = jbserver_xpc_send(JBS_DOMAIN_PLATFORM, JBS_PLATFORM_JBSETTINGS_SET, xargs); + xpc_release(xargs); + if (xreply) { + int result = xpc_dictionary_get_int64(xreply, "result"); + xpc_release(xreply); + return result; + } + return -1; +} + +int jbclient_platform_jbsettings_set_bool(const char *key, bool boolValue) +{ + xpc_object_t value = xpc_bool_create(boolValue); + int r = jbclient_platform_jbsettings_set(key, value); + xpc_release(value); + return r; +} + +int jbclient_platform_jbsettings_set_uint64(const char *key, uint64_t uint64Value) +{ + xpc_object_t value = xpc_uint64_create(uint64Value); + int r = jbclient_platform_jbsettings_set(key, value); + xpc_release(value); + return r; +} + int jbclient_watchdog_intercept_userspace_panic(const char *panicMessage) { xpc_object_t xargs = xpc_dictionary_create_empty(); diff --git a/BaseBin/libjailbreak/src/jbclient_xpc.h b/BaseBin/libjailbreak/src/jbclient_xpc.h index 0d543d443..501f905d3 100644 --- a/BaseBin/libjailbreak/src/jbclient_xpc.h +++ b/BaseBin/libjailbreak/src/jbclient_xpc.h @@ -14,11 +14,17 @@ char *jbclient_get_jbroot(void); char *jbclient_get_boot_uuid(void); int jbclient_trust_binary(const char *binaryPath); int jbclient_trust_library(const char *libraryPath, void *addressInCaller); -int jbclient_process_checkin(char **rootPathOut, char **bootUUIDOut, char **sandboxExtensionsOut); +int jbclient_process_checkin(char **rootPathOut, char **bootUUIDOut, char **sandboxExtensionsOut, bool *fullyDebuggedOut); int jbclient_fork_fix(uint64_t childPid); int jbclient_cs_revalidate(void); int jbclient_platform_set_process_debugged(uint64_t pid, bool fullyDebugged); int jbclient_platform_stage_jailbreak_update(const char *updateTar); +int jbclient_platform_jbsettings_get(const char *key, xpc_object_t *valueOut); +bool jbclient_platform_jbsettings_get_bool(const char *key); +uint64_t jbclient_platform_jbsettings_get_uint64(const char *key); +int jbclient_platform_jbsettings_set(const char *key, xpc_object_t value); +int jbclient_platform_jbsettings_set_bool(const char *key, bool boolValue); +int jbclient_platform_jbsettings_set_uint64(const char *key, uint64_t uint64Value); int jbclient_watchdog_intercept_userspace_panic(const char *panicMessage); int jbclient_watchdog_get_last_userspace_panic(char **panicMessage); int jbclient_root_get_physrw(bool singlePTE, uint64_t *singlePTEAsidPtr); diff --git a/BaseBin/libjailbreak/src/jbserver.c b/BaseBin/libjailbreak/src/jbserver.c index b0f6793eb..777e4e8c5 100644 --- a/BaseBin/libjailbreak/src/jbserver.c +++ b/BaseBin/libjailbreak/src/jbserver.c @@ -60,6 +60,9 @@ int jbserver_received_xpc_message(struct jbserver_impl *server, xpc_object_t xms case JBS_TYPE_DICTIONARY: args[i] = (void *)xpc_dictionary_get_dictionary(xmsg, argDesc->name); break; + case JBS_TYPE_XPC_GENERIC: + args[i] = (void *)xpc_dictionary_get_value(xmsg, argDesc->name); + break; case JBS_TYPE_CALLER_TOKEN: args[i] = (void *)&clientToken; break; @@ -100,7 +103,8 @@ int jbserver_received_xpc_message(struct jbserver_impl *server, xpc_object_t xms break; } case JBS_TYPE_ARRAY: - case JBS_TYPE_DICTIONARY: { + case JBS_TYPE_DICTIONARY: + case JBS_TYPE_XPC_GENERIC: { if (argsOut[i]) { xpc_dictionary_set_value(xreply, argDesc->name, (xpc_object_t)argsOut[i]); xpc_release((xpc_object_t)argsOut[i]); diff --git a/BaseBin/libjailbreak/src/jbserver.h b/BaseBin/libjailbreak/src/jbserver.h index 9961b1b7a..75b913b4b 100644 --- a/BaseBin/libjailbreak/src/jbserver.h +++ b/BaseBin/libjailbreak/src/jbserver.h @@ -14,6 +14,7 @@ typedef enum { JBS_TYPE_ARRAY, JBS_TYPE_DICTIONARY, JBS_TYPE_CALLER_TOKEN, + JBS_TYPE_XPC_GENERIC, } jbserver_type; typedef struct s_jbserver_arg @@ -62,7 +63,8 @@ enum { enum { JBS_PLATFORM_SET_PROCESS_DEBUGGED = 1, JBS_PLATFORM_STAGE_JAILBREAK_UPDATE, - JBS_PLATFORM_SET_JAILBREAK_VISIBLE, + JBS_PLATFORM_JBSETTINGS_GET, + JBS_PLATFORM_JBSETTINGS_SET, }; diff --git a/BaseBin/systemhook/src/main.c b/BaseBin/systemhook/src/main.c index bcfd83d7a..5ba65e80e 100644 --- a/BaseBin/systemhook/src/main.c +++ b/BaseBin/systemhook/src/main.c @@ -34,6 +34,7 @@ int necp_session_action(int necp_fd, uint32_t action, uint8_t *in_buffer, size_t extern char **environ; bool gTweaksEnabled = false; +bool gFullyDebugged = false; int ptrace(int request, pid_t pid, caddr_t addr, int data); #define PT_ATTACH 10 /* trace some running process */ @@ -390,6 +391,9 @@ int csops_hook(pid_t pid, unsigned int ops, void *useraddr, size_t usersize) uint32_t* csflag = (uint32_t *)useraddr; *csflag |= CS_VALID; *csflag &= ~CS_DEBUGGED; + if (pid == getpid() && gFullyDebugged) { + *csflag |= CS_DEBUGGED; + } } } return rv; @@ -404,6 +408,9 @@ int csops_audittoken_hook(pid_t pid, unsigned int ops, void *useraddr, size_t us uint32_t* csflag = (uint32_t *)useraddr; *csflag |= CS_VALID; *csflag &= ~CS_DEBUGGED; + if (pid == getpid() && gFullyDebugged) { + *csflag |= CS_DEBUGGED; + } } } return rv; @@ -452,7 +459,7 @@ bool shouldEnableTweaks(void) __attribute__((constructor)) static void initializer(void) { - jbclient_process_checkin(&JB_RootPath, &JB_BootUUID, &JB_SandboxExtensions); + jbclient_process_checkin(&JB_RootPath, &JB_BootUUID, &JB_SandboxExtensions, &gFullyDebugged); // Apply sandbox extensions applySandboxExtensions();