diff --git a/Makefile b/Makefile index a10a453..45407bf 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ export CONFIG_COMMIT = $(shell git log --oneline | sed '2,10000000d' | cut -b 1- # Build the app APPLICATION_NAME = LiveContainer -$(APPLICATION_NAME)_FILES = dyld_bypass_validation.m main.m utils.m LCSharedUtils.m NSUserDefaults.m +$(APPLICATION_NAME)_FILES = dyld_bypass_validation.m main.m utils.m LCSharedUtils.m NSUserDefaults.m fishhook/fishhook.c $(APPLICATION_NAME)_CODESIGN_FLAGS = -Sentitlements.xml $(APPLICATION_NAME)_CFLAGS = -fobjc-arc $(APPLICATION_NAME)_LDFLAGS = -e _LiveContainerMain -rpath @loader_path/Frameworks diff --git a/Resources/Info.plist b/Resources/Info.plist index 29c104d..7d63d18 100644 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -42,7 +42,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.1.53 + 3.1.54 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -61,7 +61,7 @@ CFBundleVersion - 3.1.53 + 3.1.54 LSApplicationCategoryType public.app-category.games LSApplicationQueriesSchemes diff --git a/control b/control index 39dea81..c18e386 100644 --- a/control +++ b/control @@ -1,6 +1,6 @@ Package: com.kdt.livecontainer Name: livecontainer -Version: 3.1.53 +Version: 3.1.54 Architecture: iphoneos-arm Description: Run iOS app without actually installing it! Maintainer: khanhduytran0 diff --git a/main.m b/main.m index 5930447..d79457a 100644 --- a/main.m +++ b/main.m @@ -14,6 +14,8 @@ #include #include #include "TPRO.h" +#include "fishhook/fishhook.h" +#include static int (*appMain)(int, char**); static const char *dyldImageName; @@ -193,6 +195,18 @@ static void overwriteExecPath(NSString *bundlePath) { return (void *)header + entryoff; } +uint32_t appMainImageIndex = 0; +void* (*orig_dlsym)(void * __handle, const char * __symbol); +void* new_dlsym(void * __handle, const char * __symbol) { + if(__handle == (void*)RTLD_MAIN_ONLY) { + if(strcmp(__symbol, MH_EXECUTE_SYM) == 0) { + return (void*)_dyld_get_image_header(appMainImageIndex); + } + return orig_dlsym(RTLD_DEFAULT, __symbol); + } + return orig_dlsym(__handle, __symbol); +} + static NSString* invokeAppMain(NSString *selectedApp, NSString *selectedContainer, int argc, char *argv[]) { NSString *appError = nil; if (!LCSharedUtils.certificatePassword) { @@ -378,6 +392,7 @@ static void overwriteExecPath(NSString *bundlePath) { // Preload executable to bypass RT_NOLOAD uint32_t appIndex = _dyld_image_count(); + appMainImageIndex = appIndex; void *appHandle = dlopen(*path, RTLD_LAZY|RTLD_GLOBAL|RTLD_FIRST); const char *dlerr = dlerror(); if (!appHandle || (uint64_t)appHandle > 0xf00000000000 || dlerr) { @@ -390,6 +405,9 @@ static void overwriteExecPath(NSString *bundlePath) { *path = oldPath; return appError; } + // hook dlsym to solve RTLD_MAIN_ONLY + rebind_symbols((struct rebinding[1]){{"dlsym", (void *)new_dlsym, (void **)&orig_dlsym}},1); + // Fix dynamic properties of some apps [NSUserDefaults performSelector:@selector(initialize)];