mirror of https://github.com/opa334/TrollStore.git
1.0.5
This commit is contained in:
parent
5bb621c4fe
commit
06e4075a26
|
@ -1,6 +1,6 @@
|
||||||
Package: com.opa334.trollstoreroothelper
|
Package: com.opa334.trollstoreroothelper
|
||||||
Name: trollstoreroothelper
|
Name: trollstoreroothelper
|
||||||
Version: 1.0.4
|
Version: 1.0.5
|
||||||
Architecture: iphoneos-arm
|
Architecture: iphoneos-arm
|
||||||
Description: An awesome tool of some sort!!
|
Description: An awesome tool of some sort!!
|
||||||
Maintainer: opa334
|
Maintainer: opa334
|
||||||
|
|
|
@ -378,6 +378,19 @@ BOOL signApp(NSString* appPath, NSError** error)
|
||||||
return ldidRet == 0;
|
return ldidRet == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void applyPatchesToInfoDictionary(NSString* appPath)
|
||||||
|
{
|
||||||
|
NSURL* appURL = [NSURL fileURLWithPath:appPath];
|
||||||
|
NSURL* infoPlistURL = [appURL URLByAppendingPathComponent:@"Info.plist"];
|
||||||
|
NSMutableDictionary* infoDictM = [[NSDictionary dictionaryWithContentsOfURL:infoPlistURL error:nil] mutableCopy];
|
||||||
|
if(!infoDictM) return;
|
||||||
|
|
||||||
|
// enable notifications
|
||||||
|
infoDictM[@"SBAppUsesLocalNotifications"] = @1;
|
||||||
|
|
||||||
|
[infoDictM writeToURL:infoPlistURL error:nil];
|
||||||
|
}
|
||||||
|
|
||||||
// 170: failed to create container for app bundle
|
// 170: failed to create container for app bundle
|
||||||
// 171: a non trollstore app with the same identifier is already installled
|
// 171: a non trollstore app with the same identifier is already installled
|
||||||
// 172: no info.plist found in app
|
// 172: no info.plist found in app
|
||||||
|
@ -388,6 +401,8 @@ int installApp(NSString* appPath, BOOL sign, BOOL force, NSError** error)
|
||||||
NSString* appId = appIdForAppPath(appPath);
|
NSString* appId = appIdForAppPath(appPath);
|
||||||
if(!appId) return 172;
|
if(!appId) return 172;
|
||||||
|
|
||||||
|
applyPatchesToInfoDictionary(appPath);
|
||||||
|
|
||||||
if(sign)
|
if(sign)
|
||||||
{
|
{
|
||||||
// if it fails to sign, we don't care
|
// if it fails to sign, we don't care
|
||||||
|
@ -427,13 +442,25 @@ int installApp(NSString* appPath, BOOL sign, BOOL force, NSError** error)
|
||||||
// Mark app as TrollStore app
|
// Mark app as TrollStore app
|
||||||
[[NSFileManager defaultManager] createFileAtPath:trollStoreMarkURL.path contents:[NSData data] attributes:nil];
|
[[NSFileManager defaultManager] createFileAtPath:trollStoreMarkURL.path contents:[NSData data] attributes:nil];
|
||||||
|
|
||||||
// Apply correct permissions
|
// Apply correct permissions (First run, set everything to 644, owner 33)
|
||||||
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:[NSURL fileURLWithPath:appPath] includingPropertiesForKeys:nil options:0 errorHandler:nil];
|
|
||||||
NSURL* fileURL;
|
NSURL* fileURL;
|
||||||
|
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:[NSURL fileURLWithPath:appPath] includingPropertiesForKeys:nil options:0 errorHandler:nil];
|
||||||
while(fileURL = [enumerator nextObject])
|
while(fileURL = [enumerator nextObject])
|
||||||
{
|
{
|
||||||
NSString* filePath = fileURL.path;
|
NSString* filePath = fileURL.path;
|
||||||
chown(filePath.UTF8String, 33, 33);
|
chown(filePath.UTF8String, 33, 33);
|
||||||
|
chmod(filePath.UTF8String, 0644);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply correct permissions (Second run, set executables and directories to 0755)
|
||||||
|
enumerator = [[NSFileManager defaultManager] enumeratorAtURL:[NSURL fileURLWithPath:appPath] includingPropertiesForKeys:nil options:0 errorHandler:nil];
|
||||||
|
while(fileURL = [enumerator nextObject])
|
||||||
|
{
|
||||||
|
NSString* filePath = fileURL.path;
|
||||||
|
|
||||||
|
BOOL isDir;
|
||||||
|
[[NSFileManager defaultManager] fileExistsAtPath:fileURL.path isDirectory:&isDir];
|
||||||
|
|
||||||
if([filePath.lastPathComponent isEqualToString:@"Info.plist"])
|
if([filePath.lastPathComponent isEqualToString:@"Info.plist"])
|
||||||
{
|
{
|
||||||
NSDictionary* infoDictionary = [NSDictionary dictionaryWithContentsOfFile:filePath];
|
NSDictionary* infoDictionary = [NSDictionary dictionaryWithContentsOfFile:filePath];
|
||||||
|
@ -444,10 +471,15 @@ int installApp(NSString* appPath, BOOL sign, BOOL force, NSError** error)
|
||||||
chmod(executablePath.UTF8String, 0755);
|
chmod(executablePath.UTF8String, 0755);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if([filePath.pathExtension isEqualToString:@"dylib"])
|
else if(!isDir && [filePath.pathExtension isEqualToString:@"dylib"])
|
||||||
{
|
{
|
||||||
chmod(filePath.UTF8String, 0755);
|
chmod(filePath.UTF8String, 0755);
|
||||||
}
|
}
|
||||||
|
else if(isDir)
|
||||||
|
{
|
||||||
|
// apparently all dirs are writable by default
|
||||||
|
chmod(filePath.UTF8String, 0755);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// chown 0 all root binaries
|
// chown 0 all root binaries
|
||||||
|
@ -509,17 +541,10 @@ int installApp(NSString* appPath, BOOL sign, BOOL force, NSError** error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int uninstallApp(NSString* appId, NSError** error)
|
int uninstallApp(NSString* appPath, NSString* appId, NSError** error)
|
||||||
{
|
{
|
||||||
NSString* appPath = appPathForAppId(appId, error);
|
|
||||||
if(!appPath) return 1;
|
|
||||||
|
|
||||||
LSApplicationProxy* appProxy = [LSApplicationProxy applicationProxyForIdentifier:appId];
|
LSApplicationProxy* appProxy = [LSApplicationProxy applicationProxyForIdentifier:appId];
|
||||||
NSLog(@"appProxy: %@", appProxy);
|
|
||||||
|
|
||||||
|
|
||||||
MCMContainer *appContainer = [objc_getClass("MCMAppDataContainer") containerWithIdentifier:appId createIfNecessary:NO existed:nil error:nil];
|
MCMContainer *appContainer = [objc_getClass("MCMAppDataContainer") containerWithIdentifier:appId createIfNecessary:NO existed:nil error:nil];
|
||||||
NSLog(@"1");
|
|
||||||
NSString *containerPath = [appContainer url].path;
|
NSString *containerPath = [appContainer url].path;
|
||||||
if(containerPath)
|
if(containerPath)
|
||||||
{
|
{
|
||||||
|
@ -531,8 +556,8 @@ int uninstallApp(NSString* appId, NSError** error)
|
||||||
// delete group container paths
|
// delete group container paths
|
||||||
[[appProxy groupContainerURLs] enumerateKeysAndObjectsUsingBlock:^(NSString* groupID, NSURL* groupURL, BOOL* stop)
|
[[appProxy groupContainerURLs] enumerateKeysAndObjectsUsingBlock:^(NSString* groupID, NSURL* groupURL, BOOL* stop)
|
||||||
{
|
{
|
||||||
[[NSFileManager defaultManager] removeItemAtURL:groupURL error:nil];
|
|
||||||
NSLog(@"deleting %@", groupURL);
|
NSLog(@"deleting %@", groupURL);
|
||||||
|
[[NSFileManager defaultManager] removeItemAtURL:groupURL error:nil];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// delete app plugin paths
|
// delete app plugin paths
|
||||||
|
@ -541,15 +566,15 @@ int uninstallApp(NSString* appId, NSError** error)
|
||||||
NSURL* pluginURL = pluginProxy.dataContainerURL;
|
NSURL* pluginURL = pluginProxy.dataContainerURL;
|
||||||
if(pluginURL)
|
if(pluginURL)
|
||||||
{
|
{
|
||||||
[[NSFileManager defaultManager] removeItemAtPath:pluginURL.path error:error];
|
NSLog(@"deleting %@", pluginURL);
|
||||||
NSLog(@"deleting %@", pluginURL.path);
|
[[NSFileManager defaultManager] removeItemAtURL:pluginURL error:error];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// unregister app
|
// unregister app
|
||||||
registerPath((char*)appPath.UTF8String, 1);
|
registerPath((char*)appPath.UTF8String, 1);
|
||||||
NSLog(@"deleting %@", [appPath stringByDeletingLastPathComponent]);
|
|
||||||
|
|
||||||
|
NSLog(@"deleting %@", [appPath stringByDeletingLastPathComponent]);
|
||||||
// delete app
|
// delete app
|
||||||
BOOL deleteSuc = [[NSFileManager defaultManager] removeItemAtPath:[appPath stringByDeletingLastPathComponent] error:error];
|
BOOL deleteSuc = [[NSFileManager defaultManager] removeItemAtPath:[appPath stringByDeletingLastPathComponent] error:error];
|
||||||
if(deleteSuc)
|
if(deleteSuc)
|
||||||
|
@ -562,6 +587,22 @@ int uninstallApp(NSString* appId, NSError** error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uninstallAppByPath(NSString* appPath, NSError** error)
|
||||||
|
{
|
||||||
|
if(!appPath) return 1;
|
||||||
|
NSString* appId = appIdForAppPath(appPath);
|
||||||
|
if(!appId) return 1;
|
||||||
|
return uninstallApp(appPath, appId, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
int uninstallAppById(NSString* appId, NSError** error)
|
||||||
|
{
|
||||||
|
if(!appId) return 1;
|
||||||
|
NSString* appPath = appPathForAppId(appId, error);
|
||||||
|
if(!appPath) return 1;
|
||||||
|
return uninstallApp(appPath, appId, error);
|
||||||
|
}
|
||||||
|
|
||||||
// 166: IPA does not exist or is not accessible
|
// 166: IPA does not exist or is not accessible
|
||||||
// 167: IPA does not appear to contain an app
|
// 167: IPA does not appear to contain an app
|
||||||
|
|
||||||
|
@ -604,7 +645,7 @@ void uninstallAllApps(void)
|
||||||
{
|
{
|
||||||
for(NSString* appPath in trollStoreInstalledAppBundlePaths())
|
for(NSString* appPath in trollStoreInstalledAppBundlePaths())
|
||||||
{
|
{
|
||||||
uninstallApp(appIdForAppPath(appPath), nil);
|
uninstallAppById(appIdForAppPath(appPath), nil);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,8 +859,13 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||||
{
|
{
|
||||||
if(argc <= 2) return -3;
|
if(argc <= 2) return -3;
|
||||||
NSString* appId = [NSString stringWithUTF8String:argv[2]];
|
NSString* appId = [NSString stringWithUTF8String:argv[2]];
|
||||||
ret = uninstallApp(appId, &error);
|
ret = uninstallAppById(appId, &error);
|
||||||
} else if([cmd isEqualToString:@"install-trollstore"])
|
} else if([cmd isEqualToString:@"uninstall-path"])
|
||||||
|
{
|
||||||
|
if(argc <= 2) return -3;
|
||||||
|
NSString* appPath = [NSString stringWithUTF8String:argv[2]];
|
||||||
|
ret = uninstallAppByPath(appPath, &error);
|
||||||
|
}else if([cmd isEqualToString:@"install-trollstore"])
|
||||||
{
|
{
|
||||||
if(argc <= 2) return -3;
|
if(argc <= 2) return -3;
|
||||||
NSString* tsTar = [NSString stringWithUTF8String:argv[2]];
|
NSString* tsTar = [NSString stringWithUTF8String:argv[2]];
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
#import <sys/sysctl.h>
|
||||||
|
|
||||||
extern void badLog(const char*, ...);
|
extern void badLog(const char*, ...);
|
||||||
|
|
||||||
|
@ -55,16 +56,28 @@ uint64_t kernel_base_from_holder(mach_port_t holder, uint64_t holder_addr)
|
||||||
uint64_t off_task_bsd_info;
|
uint64_t off_task_bsd_info;
|
||||||
|
|
||||||
#if __arm64e__
|
#if __arm64e__
|
||||||
if (strstr(u.machine, "iPhone14,"))
|
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
|
off_task_bsd_info = 0x3c8; // ios15.1 a15 // proc_t::task_bsd_info
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
off_task_bsd_info = 0x3b8; //; iOS15.1 a12 // proc_t::task_bsd_info
|
off_task_bsd_info = 0x3b8; //; iOS15.1 a12-a14 // proc_t::task_bsd_info
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
off_task_bsd_info = 0x3A0;
|
off_task_bsd_info = 0x3A0; // a9-a11
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_self_proc = xpaci(kread64(self_task + off_task_bsd_info));
|
g_self_proc = xpaci(kread64(self_task + off_task_bsd_info));
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<string>iPhoneOS</string>
|
<string>iPhoneOS</string>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0.4</string>
|
<string>1.0.5</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UIDeviceFamily</key>
|
<key>UIDeviceFamily</key>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Package: com.opa334.trollstorehelper
|
Package: com.opa334.trollstorehelper
|
||||||
Name: TrollStore Helper
|
Name: TrollStore Helper
|
||||||
Version: 1.0.4
|
Version: 1.0.5
|
||||||
Architecture: iphoneos-arm
|
Architecture: iphoneos-arm
|
||||||
Description: Helper app to install and manage TrollStore!
|
Description: Helper app to install and manage TrollStore!
|
||||||
Maintainer: opa334
|
Maintainer: opa334
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<string>iPhoneOS</string>
|
<string>iPhoneOS</string>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0.4</string>
|
<string>1.0.5</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UIDeviceFamily</key>
|
<key>UIDeviceFamily</key>
|
||||||
|
|
|
@ -55,7 +55,15 @@
|
||||||
{
|
{
|
||||||
NSString* appPath = [[TSApplicationsManager sharedInstance] installedAppPaths][indexPath.row];
|
NSString* appPath = [[TSApplicationsManager sharedInstance] installedAppPaths][indexPath.row];
|
||||||
NSString* appId = [[TSApplicationsManager sharedInstance] appIdForAppPath:appPath];
|
NSString* appId = [[TSApplicationsManager sharedInstance] appIdForAppPath:appPath];
|
||||||
[[TSApplicationsManager sharedInstance] uninstallApp:appId];
|
|
||||||
|
if(appId)
|
||||||
|
{
|
||||||
|
[[TSApplicationsManager sharedInstance] uninstallApp:appId];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[[TSApplicationsManager sharedInstance] uninstallAppByPath:appPath];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,6 @@
|
||||||
- (int)installIpa:(NSString*)pathToIpa force:(BOOL)force;
|
- (int)installIpa:(NSString*)pathToIpa force:(BOOL)force;
|
||||||
- (int)installIpa:(NSString*)pathToIpa;
|
- (int)installIpa:(NSString*)pathToIpa;
|
||||||
- (int)uninstallApp:(NSString*)appId;
|
- (int)uninstallApp:(NSString*)appId;
|
||||||
|
- (int)uninstallAppByPath:(NSString*)path;
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -100,9 +100,18 @@
|
||||||
|
|
||||||
- (int)uninstallApp:(NSString*)appId
|
- (int)uninstallApp:(NSString*)appId
|
||||||
{
|
{
|
||||||
|
if(!appId) return -200;
|
||||||
int ret = spawnRoot(helperPath(), @[@"uninstall", appId]);
|
int ret = spawnRoot(helperPath(), @[@"uninstall", appId]);
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"ApplicationsChanged" object:nil];
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"ApplicationsChanged" object:nil];
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (int)uninstallAppByPath:(NSString*)path
|
||||||
|
{
|
||||||
|
if(!path) return -200;
|
||||||
|
int ret = spawnRoot(helperPath(), @[@"uninstall-path", path]);
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"ApplicationsChanged" object:nil];
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -77,13 +77,8 @@
|
||||||
NSURL* url = context.URL;
|
NSURL* url = context.URL;
|
||||||
if (url != nil && [url isFileURL]) {
|
if (url != nil && [url isFileURL]) {
|
||||||
[url startAccessingSecurityScopedResource];
|
[url startAccessingSecurityScopedResource];
|
||||||
NSURL* tmpCopyURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:url.lastPathComponent]];
|
|
||||||
|
|
||||||
[[NSFileManager defaultManager] copyItemAtURL:url toURL:tmpCopyURL error:nil];
|
|
||||||
|
|
||||||
void (^doneBlock)(BOOL) = ^(BOOL shouldExit)
|
void (^doneBlock)(BOOL) = ^(BOOL shouldExit)
|
||||||
{
|
{
|
||||||
[[NSFileManager defaultManager] removeItemAtURL:tmpCopyURL error:nil];
|
|
||||||
[url stopAccessingSecurityScopedResource];
|
[url stopAccessingSecurityScopedResource];
|
||||||
[[NSFileManager defaultManager] removeItemAtURL:url error:nil];
|
[[NSFileManager defaultManager] removeItemAtURL:url error:nil];
|
||||||
|
|
||||||
|
@ -105,7 +100,7 @@
|
||||||
{
|
{
|
||||||
// Update TrollStore itself
|
// Update TrollStore itself
|
||||||
NSLog(@"Updating TrollStore...");
|
NSLog(@"Updating TrollStore...");
|
||||||
int ret = spawnRoot(helperPath(), @[@"install-trollstore", tmpCopyURL.path]);
|
int ret = spawnRoot(helperPath(), @[@"install-trollstore", url.path]);
|
||||||
doneBlock(ret == 0);
|
doneBlock(ret == 0);
|
||||||
NSLog(@"Updated TrollStore!");
|
NSLog(@"Updated TrollStore!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Package: com.opa334.trollstore
|
Package: com.opa334.trollstore
|
||||||
Name: TrollStore
|
Name: TrollStore
|
||||||
Version: 1.0.4
|
Version: 1.0.5
|
||||||
Architecture: iphoneos-arm
|
Architecture: iphoneos-arm
|
||||||
Description: An awesome application!
|
Description: An awesome application!
|
||||||
Maintainer: opa334
|
Maintainer: opa334
|
||||||
|
|
|
@ -30,5 +30,7 @@
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.private.uninstall.deletion</key>
|
<key>com.apple.private.uninstall.deletion</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.private.security.storage.MobileDocuments</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
Loading…
Reference in New Issue