Restructure.. again and add region spoof for appstorecomponentsd

This commit is contained in:
khanhduytran0
2025-12-27 20:09:06 +07:00
parent ddb5c87fce
commit bfb1c0a946
10 changed files with 82 additions and 62 deletions
+60
View File
@@ -0,0 +1,60 @@
@import Foundation;
%group Hook_managedappdistributiond
// "Not bypassing eligibility for com.apple.mobilesafari:personal (isProfileValidated: false isUPPValidated:false isBeta:false"
// Used in managedappdistributiond. Pseudocode of a validate function in OSEligbility.framework:
#if 0
LSBundleRecord *bundleRecord = ...;
BOOL isProfileValidated = bundleRecord.isProfileValidated;
BOOL isUPPValidated = bundleRecord.isUPPValidated;
BOOL isBeta = bundleRecord.isBeta;
if ( (isProfileValidated == NO) || (isUPPValidated == YES) || (isBeta == YES) ) {
log("Not bypassing eligibility for %s:%s (isProfileValidated: %{bool}d isUPPValidated:%{bool}d isBeta:%{bool}d", bundleRecord.bundleIdentifier.UTF8String, somethingThatSaysPersonal, isProfileValidated, isUPPValidated, isBeta);
return 0;
}
#endif
// So we just hook these to return values that will bypass eligibility
// for managedappdistributiond
%hook LSBundleRecord
- (BOOL)isProfileValidated {
return YES;
}
- (BOOL)isUPPValidated {
return NO;
}
- (BOOL)isBeta {
return NO;
}
%end
%end
// for appstorecomponentsd, we hook URL method to replace region code
%group Hook_appstorecomponentsd
%hook NSURLRequest
- (instancetype)initWithURL:(NSURL *)url {
NSString *prefix = @"https://amp-api.apps-marketplace.apple.com/v1/catalog/";
NSString *urlString = url.absoluteString;
if ([url.absoluteString hasPrefix:prefix]) {
// replace region code
NSArray<NSString *> *components = [urlString componentsSeparatedByString:@"/"];
if (components.count > 6) {
NSMutableArray<NSString *> *newComponents = [components mutableCopy];
newComponents[5] = @"fr"; // spoof to France region
NSURL *newURL = [NSURL URLWithString:[newComponents componentsJoinedByString:@"/"]];
return %orig(newURL);
}
}
return %orig;
}
%end
%end
%ctor {
NSString *processName = NSProcessInfo.processInfo.processName;
if ([processName isEqualToString:@"managedappdistributiond"]) {
%init(Hook_managedappdistributiond);
} else if ([processName isEqualToString:@"appstorecomponentsd"]) {
%init(Hook_appstorecomponentsd);
}
}
-12
View File
@@ -1,12 +0,0 @@
TARGET := iphone:clang:latest:15.0
INSTALL_TARGET_PROCESSES = managedappdistributiond
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = BypassMarketplace
BypassMarketplace_FILES = Tweak.x
BypassMarketplace_CFLAGS = -fobjc-arc
BypassMarketplace_CODESIGN_FLAGS = -Cadhoc -S
include $(THEOS_MAKE_PATH)/tweak.mk
-24
View File
@@ -1,24 +0,0 @@
// "Not bypassing eligibility for com.apple.mobilesafari:personal (isProfileValidated: false isUPPValidated:false isBeta:false"
// Used in managedappdistributiond. Pseudocode of a validate function in OSEligbility.framework:
#if 0
LSBundleRecord *bundleRecord = ...;
BOOL isProfileValidated = bundleRecord.isProfileValidated;
BOOL isUPPValidated = bundleRecord.isUPPValidated;
BOOL isBeta = bundleRecord.isBeta;
if ( (isProfileValidated == NO) || (isUPPValidated == YES) || (isBeta == YES) ) {
log("Not bypassing eligibility for %s:%s (isProfileValidated: %{bool}d isUPPValidated:%{bool}d isBeta:%{bool}d", bundleRecord.bundleIdentifier.UTF8String, somethingThatSaysPersonal, isProfileValidated, isUPPValidated, isBeta);
}
#endif
// So we just force the three functions to return values that will bypass eligibility
%hook LSBundleRecord
- (BOOL)isProfileValidated {
return YES;
}
- (BOOL)isUPPValidated {
return NO;
}
- (BOOL)isBeta {
return NO;
}
%end
+9
View File
@@ -24,6 +24,7 @@ const char *container_system_group_path_for_identifier(int, const char *group, v
errno_t img4_nonce_domain_copy_nonce(const img4_nonce_domain_t *nd, img4_nonce_t *n);
int img4_firmware_execute(void* fw, const void *chip, const void *nonce);
%group Hook_MobileStorageMounter
%hookf(errno_t, img4_nonce_domain_copy_nonce, const img4_nonce_domain_t *nd, img4_nonce_t *n) {
if (nd != IMG4_NONCE_DOMAIN_DDI) {
return %orig(nd, n);
@@ -66,3 +67,11 @@ BOOL gCalledImg4Execute = NO;
}
return ret;
}
%end
%ctor {
NSString *processName = NSProcessInfo.processInfo.processName;
if ([processName isEqualToString:@"MobileStorageMounter"]) {
%init(Hook_MobileStorageMounter);
}
}
-7
View File
@@ -1,7 +0,0 @@
{
Filter = {
Executables = (
MobileStorageMounter,
);
};
}
-14
View File
@@ -1,14 +0,0 @@
TARGET := iphone:clang:latest:15.0
INSTALL_TARGET_PROCESSES = MobileStorageMounter
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = FixDDI
FixDDI_FILES = Tweak.x
FixDDI_CFLAGS = -fobjc-arc
FixDDI_FRAMEWORKS = IOKit
FixDDI_LIBRARIES = image4
FixDDI_CODESIGN_FLAGS = -Cadhoc -S
include $(THEOS_MAKE_PATH)/tweak.mk
+9 -3
View File
@@ -1,9 +1,15 @@
TARGET := iphone:clang:latest:15.0
INSTALL_TARGET_PROCESSES = appstorecomponentsd managedappdistributiond MobileStorageMounter
THEOS_PACKAGE_SCHEME := rootless
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = aintuitweaks
aintuitweaks_FILES = BypassMarketplace.x FixDDI.x
aintuitweaks_CFLAGS = -fobjc-arc
aintuitweaks_FRAMEWORKS = IOKit
aintuitweaks_LIBRARIES = image4
aintuitweaks_CODESIGN_FLAGS = -Cadhoc -S
include $(THEOS_MAKE_PATH)/tweak.mk
SUBPROJECTS += BypassMarketplace
SUBPROJECTS += FixDDI
include $(THEOS_MAKE_PATH)/aggregate.mk
@@ -1,7 +1,9 @@
{
Filter = {
Executables = (
appstorecomponentsd,
"managedappdistributiond",
MobileStorageMounter,
);
};
}
+1 -1
View File
@@ -1,3 +1,3 @@
#!/bin/sh
# managedappdistributiond does not honor SIGTERM
killall -KILL managedappdistributiond
killall -KILL managedappdistributiond || true
+1 -1
View File
@@ -1,3 +1,3 @@
#!/bin/sh
# managedappdistributiond does not honor SIGTERM
killall -KILL managedappdistributiond
killall -KILL managedappdistributiond || true