diff --git a/AppSyncUnified-installd/AppSyncUnified-installd.x b/AppSyncUnified-installd/AppSyncUnified-installd.x index f7960f8..a47ed2b 100644 --- a/AppSyncUnified-installd/AppSyncUnified-installd.x +++ b/AppSyncUnified-installd/AppSyncUnified-installd.x @@ -1,5 +1,5 @@ #import -#import +#import #import #import "cdhash.h" @@ -11,7 +11,7 @@ MSImageRef MSGetImageByName(const char *file); void *MSFindSymbol(MSImageRef image, const char *name); void MSHookFunction(void *symbol, void *replace, void **result); -#define DPKG_PATH ROOT_PATH("/var/lib/dpkg/info/ai.akemi.appsyncunified.list") +#define DPKG_PATH jbroot("/var/lib/dpkg/info/ai.akemi.appsyncunified.list") // Undefine LOG here since my version of cdhash.h defined it earlier #undef LOG diff --git a/appinst/appinst.m b/appinst/appinst.m index be0350e..b5756da 100644 --- a/appinst/appinst.m +++ b/appinst/appinst.m @@ -1,7 +1,7 @@ #import #import #import -#import +#import #import "zip.h" #ifdef DEBUG @@ -14,7 +14,7 @@ #define kAppTypeKey @"ApplicationType" #define kRandomLength 32 -#define DPKG_PATH ROOT_PATH("/var/lib/dpkg/info/ai.akemi.appinst.list") +#define DPKG_PATH jbroot("/var/lib/dpkg/info/ai.akemi.appinst.list") static const NSString *kRandomAlphanumeric = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; diff --git a/asu_inject/asu_inject.c b/asu_inject/asu_inject.c index cb972c2..e936e4f 100644 --- a/asu_inject/asu_inject.c +++ b/asu_inject/asu_inject.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include @@ -11,15 +11,15 @@ #include #include -#define DPKG_PATH ROOT_PATH("/var/lib/dpkg/info/ai.akemi.appsyncunified.list") +#define DPKG_PATH jbroot("/var/lib/dpkg/info/ai.akemi.appsyncunified.list") extern char ***_NSGetEnviron(void); extern int proc_listallpids(void *, int); extern int proc_pidpath(int, void *, uint32_t); -static const char *cynject_path = ROOT_PATH("/usr/bin/cynject"); -static const char *inject_criticald_path = ROOT_PATH("/electra/inject_criticald"); -static const char *dylib_path = ROOT_PATH("/Library/MobileSubstrate/DynamicLibraries/AppSyncUnified-installd.dylib"); +#define cynject_path jbroot("/usr/bin/cynject") +#define inject_criticald_path jbroot("/electra/inject_criticald") +#define dylib_path jbroot("/Library/MobileSubstrate/DynamicLibraries/AppSyncUnified-installd.dylib") static const char *dispatch_queue_name = NULL; static const char *process_name = "installd"; static int process_buffer_size = 4096; diff --git a/entitlements.plist b/entitlements.plist index 9ffccdb..603bb17 100644 --- a/entitlements.plist +++ b/entitlements.plist @@ -4,5 +4,11 @@ platform-application + com.apple.private.security.no-sandbox + + com.apple.private.security.storage.AppBundles + + com.apple.private.security.storage.AppDataContainers + diff --git a/pkg-actions/pkg-actions.m b/pkg-actions/pkg-actions.m index 10a0c55..8f02859 100644 --- a/pkg-actions/pkg-actions.m +++ b/pkg-actions/pkg-actions.m @@ -1,7 +1,7 @@ #import #import #import -#import +#import #include #include @@ -13,16 +13,16 @@ #define LOG(...) #endif -#define DPKG_PATH ROOT_PATH("/var/lib/dpkg/info/ai.akemi.appsyncunified.list") +#define DPKG_PATH jbroot("/var/lib/dpkg/info/ai.akemi.appsyncunified.list") #define L_LAUNCHDAEMON_PATH "/Library/LaunchDaemons" #define SL_LAUNCHDAEMON_PATH "/System" L_LAUNCHDAEMON_PATH -#define INSTALLD_PLIST_PATH_L ROOT_PATH(L_LAUNCHDAEMON_PATH) "/com.apple.mobile.installd.plist" +#define INSTALLD_PLIST_PATH_L jbroot(L_LAUNCHDAEMON_PATH "/com.apple.mobile.installd.plist") #define INSTALLD_PLIST_PATH_SL SL_LAUNCHDAEMON_PATH "/com.apple.mobile.installd.plist" -#define ASU_INJECT_PLIST_PATH ROOT_PATH(L_LAUNCHDAEMON_PATH) "/ai.akemi.asu_inject.plist" -#define ASU_INJECT_PLIST_PATH_OLD ROOT_PATH(L_LAUNCHDAEMON_PATH) "/net.angelxwind.asu_inject.plist" +#define ASU_INJECT_PLIST_PATH jbroot(L_LAUNCHDAEMON_PATH "/ai.akemi.asu_inject.plist") +#define ASU_INJECT_PLIST_PATH_OLD jbroot(L_LAUNCHDAEMON_PATH "/net.angelxwind.asu_inject.plist") typedef struct __CFUserNotification *CFUserNotificationRef; FOUNDATION_EXTERN CFUserNotificationRef CFUserNotificationCreate(CFAllocatorRef allocator, CFTimeInterval timeout, CFOptionFlags flags, SInt32 *error, CFDictionaryRef dictionary); @@ -39,15 +39,15 @@ static int run_posix_spawn(const char *args[]) { static const char *determine_launchctl_path() { // launchctl is shipped as part of the jailbreak bootstrap, not iOS itself. // Some jailbreak bootstraps put launchctl inside /sbin instead of /bin for some reason, which is where it normally resides (at least on macOS). - if (access(ROOT_PATH("/bin/launchctl"), X_OK) == -1) { - return ROOT_PATH("/sbin/launchctl"); + if (access(jbroot("/bin/launchctl"), X_OK) == -1) { + return jbroot("/sbin/launchctl"); } - return ROOT_PATH("/bin/launchctl"); + return jbroot("/bin/launchctl"); } static int run_launchctl(const char *path, const char *cmd, bool is_installd) { LOG("run_launchctl() %s %s\n", cmd, path); - const char *args[] = { determine_launchctl_path(), cmd, path, NULL }; + const char *args[] = { determine_launchctl_path(), cmd, rootfs(path), NULL }; return run_posix_spawn(args); } @@ -104,7 +104,7 @@ int main(int argc, const char **argv) { printf("This device is /probably/ running the Phœnix jailbreak (detected iOS 9.3.x and a 32-bit CPU architecture).\n"); printf("Due to a bug in Phœnix, the asu_inject LaunchDaemon (which launches /usr/bin/asu_inject once upon boot) is required in order to properly inject AppSync Unified into installd.\n"); // This path lookup does not need to be rootless-aware for obvious reasons, but we might as well do this just in case someone decides to release a rootless jailbreak for older iOS versions (… whyever anyone would ever want to do that). - if (access(ROOT_PATH("/usr/bin/cynject"), X_OK) != -1) { + if (access(jbroot("/usr/bin/cynject"), X_OK) != -1) { printf("Found an executable copy of cynject on this device!\n"); chown(ASU_INJECT_PLIST_PATH, 0, 0); chmod(ASU_INJECT_PLIST_PATH, 0644); @@ -130,7 +130,7 @@ int main(int argc, const char **argv) { // ・The user is installing AppSync Unified using an APT frontend that supports the CYDIA environment variable (Cydia, Zebra, Sileo, etc.) // ・The file /ai.akemi.appsyncunified.no-postinst-notification does not exist in the rootFS or the rootless prefix path. // ※ This was originally used for KarenTools automated testing, but you can still use it to permanently silence the notification when using APT frontends. - if (getenv("CYDIA") != NULL && access(ROOT_PATH("/ai.akemi.appsyncunified.no-postinst-notification"), F_OK) == -1) { + if (getenv("CYDIA") != NULL && access(jbroot("/ai.akemi.appsyncunified.no-postinst-notification"), F_OK) == -1) { // TODO: For some reason, this notification doesn't appear on my iOS 10 device. It's a minor bug though, so I'll allow it for now. // … Even if that makes my perfectionist self scream in intense, agonising pain (🍍˃̶͈̀ロ˂̶͈́)੭ꠥ⁾⁾