Skip to content

Commit d354e8d

Browse files
author
Rednick16
committed
bundleIdentifier fix
1 parent b2ea370 commit d354e8d

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

demo/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LIBRARY_NAME = libSupport
1414
$(LIBRARY_NAME)_FILES = jailed.mm
1515
$(LIBRARY_NAME)_CFLAGS = -fobjc-arc -fvisibility=hidden
1616
$(LIBRARY_NAME)_CCFLAGS = -fobjc-arc -fvisibility=hidden
17-
$(LIBRARY_NAME)_FRAMEWORKS = UIKit
17+
$(LIBRARY_NAME)_FRAMEWORKS = UIKit Security
1818
$(LIBRARY_NAME)_INSTALL_PATH = @executable_path/Frameworks
1919

2020
$(LIBRARY_NAME)_LINKAGE_TYPE = dynamic

demo/jailed.mm

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
#include "UIKit/UIKit.h"
22
#include "support/support.h"
33

4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif //__cplusplus
7+
8+
extern void* SecTaskCreateFromSelf(void *);
9+
extern void* SecTaskCopySigningIdentifier(void *, void *);
10+
extern CFDictionaryRef SecTaskCopyValuesForEntitlements(void *, CFArrayRef, CFErrorRef _Nullable *);
11+
extern CFTypeRef SecTaskCopyValueForEntitlement(void *, CFStringRef, CFErrorRef *);
12+
13+
#ifdef __cplusplus
14+
}
15+
#endif //__cplusplus
16+
417
BOOL (*orig_didFinishLaunchingWithOptions)(id self, SEL selector, UIApplication* application, NSDictionary* launchOptions);
518
BOOL new_didFinishLaunchingWithOptions(id self, SEL selector, UIApplication* application, NSDictionary* launchOptions)
619
{
@@ -24,6 +37,16 @@ void new_applicationDidBecomeActive(id self, SEL selector, id arg0)
2437

2538
SUPPORT_CTOR
2639
{
40+
NSString* teamIdentifier = CFBridgingRelease(SecTaskCopyValueForEntitlement(SecTaskCreateFromSelf(NULL), CFSTR("com.apple.developer.team-identifier"), NULL));
41+
NSString* bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
42+
43+
// original bundleIdentifier after removing teamIdentifier
44+
const char* cBundleIdentifier = [bundleIdentifier hasPrefix:teamIdentifier] ?
45+
[[bundleIdentifier stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@".%@", teamIdentifier]
46+
withString:@""] UTF8String] : [bundleIdentifier UTF8String];
47+
48+
// DLOG(@"libSupport(%s) by Rednick16 Injected.", SupportGeVersion());
49+
2750
/* Create the structure
2851
.teamIdentifier -> (Currently paused)
2952
.bundleIdentifier -> "com.rednick16.myApp"
@@ -37,7 +60,7 @@ void new_applicationDidBecomeActive(id self, SEL selector, id arg0)
3760
*/
3861
SupportEntryInfo entry_info = {
3962
.teamIdentifier = NULL,
40-
.bundleIdentifier = NULL,
63+
.bundleIdentifier = cBundleIdentifier,
4164
.files = {
4265
"CydiaSubstrate",
4366
"libsubstrate",
@@ -60,15 +83,18 @@ void new_applicationDidBecomeActive(id self, SEL selector, id arg0)
6083

6184
SupportHookInstanceMessage("UnityAppController",
6285
"application:didFinishLaunchingWithOptions:",
63-
new_didFinishLaunchingWithOptions,
64-
orig_didFinishLaunchingWithOptions);
86+
&new_didFinishLaunchingWithOptions,
87+
&orig_didFinishLaunchingWithOptions);
6588

6689
SupportHookInstanceMessage("UnityAppController",
6790
"applicationDidBecomeActive:",
68-
new_applicationDidBecomeActive,
69-
orig_applicationDidBecomeActive);
91+
&new_applicationDidBecomeActive,
92+
&orig_applicationDidBecomeActive);
7093

7194
SupportHookSymbolEx("dyld_get_image_name",
7295
(void*)(new_dyld_get_image_name),
7396
(void**)(&orig_dyld_get_image_name));
97+
98+
SupportHookClassMessage("APMAEU", "isFAS", WRAPPER_OBJC_HOOK_TRUE, NULL);
99+
SupportHookClassMessage("GULAppEnvironmentUtil", "isFromAppStore", WRAPPER_OBJC_HOOK_TRUE, NULL);
74100
}

0 commit comments

Comments
 (0)