Skip to content

Commit 28797a2

Browse files
committed
add SpringBoard injection and Launch Daemons support
1 parent 4d5de67 commit 28797a2

16 files changed

Lines changed: 264 additions & 594 deletions

File tree

Bootstrap.xcodeproj/project.pbxproj

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
84438D5D2B264A2800A1E407 /* NSUserDefaults+appDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 84438D5C2B264A2800A1E407 /* NSUserDefaults+appDefaults.m */; };
2222
84438D602B26546E00A1E407 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84438D5F2B26546E00A1E407 /* MobileCoreServices.framework */; };
2323
84438D622B2654EB00A1E407 /* MobileContainerManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84438D612B2654EB00A1E407 /* MobileContainerManager.framework */; };
24-
84438D652B27522400A1E407 /* envbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 84438D642B27522400A1E407 /* envbuf.c */; };
2524
84438D6C2B2CDE0100A1E407 /* AppInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 84438D682B2CDE0100A1E407 /* AppInfo.m */; };
2625
84438D6D2B2CDE0100A1E407 /* AppViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84438D6B2B2CDE0100A1E407 /* AppViewController.m */; };
2726
84438D6F2B2CE5A300A1E407 /* AppEnabler.m in Sources */ = {isa = PBXBuildFile; fileRef = 84438D6E2B2CE5A300A1E407 /* AppEnabler.m */; };
@@ -36,6 +35,10 @@
3635
847099A52B1D9686003FA4ED /* Bootstrap.m in Sources */ = {isa = PBXBuildFile; fileRef = 847099A42B1D9686003FA4ED /* Bootstrap.m */; };
3736
84A551A82DA47BCC0015CE66 /* roothideapp.deb in Frameworks */ = {isa = PBXBuildFile; fileRef = 84A551A72DA47BCC0015CE66 /* roothideapp.deb */; };
3837
84A551A92DA47BD00015CE66 /* roothideapp.deb in Resources */ = {isa = PBXBuildFile; fileRef = 84A551A72DA47BCC0015CE66 /* roothideapp.deb */; };
38+
84C3ECC02EFE72D300D1DC78 /* libcommon.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C3ECBF2EFE72D300D1DC78 /* libcommon.a */; };
39+
84C3ECC22F01A2BA00D1DC78 /* prepare.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C3ECC12F01A2BA00D1DC78 /* prepare.a */; };
40+
84C3ECC42F01A30900D1DC78 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C3ECC32F01A30900D1DC78 /* IOKit.framework */; };
41+
84C3ECC62F01A3A000D1DC78 /* libarchive.2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C3ECC52F01A3A000D1DC78 /* libarchive.2.tbd */; };
3942
D694DE962B8504B80025DC7F /* Haptic++.swift in Sources */ = {isa = PBXBuildFile; fileRef = D694DE952B8504B80025DC7F /* Haptic++.swift */; };
4043
FE0633AC2B41BC3D00B94787 /* CreditsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE0633AB2B41BC3D00B94787 /* CreditsView.swift */; };
4144
FE0633AE2B41BCD900B94787 /* OptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE0633AD2B41BCD900B94787 /* OptionsView.swift */; };
@@ -83,8 +86,6 @@
8386
84438D5C2B264A2800A1E407 /* NSUserDefaults+appDefaults.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSUserDefaults+appDefaults.m"; sourceTree = "<group>"; };
8487
84438D5F2B26546E00A1E407 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
8588
84438D612B2654EB00A1E407 /* MobileContainerManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileContainerManager.framework; path = Bootstrap/Frameworks/MobileContainerManager.framework; sourceTree = "<group>"; };
86-
84438D632B27522400A1E407 /* envbuf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = envbuf.h; sourceTree = "<group>"; };
87-
84438D642B27522400A1E407 /* envbuf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = envbuf.c; sourceTree = "<group>"; };
8889
84438D682B2CDE0100A1E407 /* AppInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppInfo.m; sourceTree = "<group>"; };
8990
84438D692B2CDE0100A1E407 /* AppInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppInfo.h; sourceTree = "<group>"; };
9091
84438D6A2B2CDE0100A1E407 /* AppViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppViewController.h; sourceTree = "<group>"; };
@@ -124,6 +125,10 @@
124125
847099A02B1D868F003FA4ED /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
125126
847099A42B1D9686003FA4ED /* Bootstrap.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Bootstrap.m; sourceTree = "<group>"; };
126127
84A551A72DA47BCC0015CE66 /* roothideapp.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = roothideapp.deb; sourceTree = "<group>"; };
128+
84C3ECBF2EFE72D300D1DC78 /* libcommon.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcommon.a; path = basebin/common/lib/libcommon.a; sourceTree = "<group>"; };
129+
84C3ECC12F01A2BA00D1DC78 /* prepare.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = prepare.a; path = basebin/common/lib/prepare.a; sourceTree = "<group>"; };
130+
84C3ECC32F01A30900D1DC78 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
131+
84C3ECC52F01A3A000D1DC78 /* libarchive.2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libarchive.2.tbd; path = usr/lib/libarchive.2.tbd; sourceTree = SDKROOT; };
127132
8595F05E2B578D9900681FC6 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = vi.lproj/Localizable.strings; sourceTree = "<group>"; };
128133
D694DE952B8504B80025DC7F /* Haptic++.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Haptic++.swift"; sourceTree = "<group>"; };
129134
FE0633AB2B41BC3D00B94787 /* CreditsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreditsView.swift; sourceTree = "<group>"; };
@@ -141,12 +146,16 @@
141146
isa = PBXFrameworksBuildPhase;
142147
buildActionMask = 2147483647;
143148
files = (
149+
84C3ECC62F01A3A000D1DC78 /* libarchive.2.tbd in Frameworks */,
150+
84C3ECC42F01A30900D1DC78 /* IOKit.framework in Frameworks */,
144151
84364F3D2B323FB600E90B58 /* MBProgressHUD.framework in Frameworks */,
145152
FE895FF12B418FDC00A16882 /* FluidGradient in Frameworks */,
146153
84438D622B2654EB00A1E407 /* MobileContainerManager.framework in Frameworks */,
147154
84A551A82DA47BCC0015CE66 /* roothideapp.deb in Frameworks */,
148155
84438D602B26546E00A1E407 /* MobileCoreServices.framework in Frameworks */,
149156
84438D502B260F8200A1E407 /* libzstd in Frameworks */,
157+
84C3ECC02EFE72D300D1DC78 /* libcommon.a in Frameworks */,
158+
84C3ECC22F01A2BA00D1DC78 /* prepare.a in Frameworks */,
150159
);
151160
runOnlyForDeploymentPostprocessing = 0;
152161
};
@@ -156,6 +165,10 @@
156165
84438D5E2B26546E00A1E407 /* Frameworks */ = {
157166
isa = PBXGroup;
158167
children = (
168+
84C3ECC52F01A3A000D1DC78 /* libarchive.2.tbd */,
169+
84C3ECC32F01A30900D1DC78 /* IOKit.framework */,
170+
84C3ECC12F01A2BA00D1DC78 /* prepare.a */,
171+
84C3ECBF2EFE72D300D1DC78 /* libcommon.a */,
159172
84364F3B2B323CE300E90B58 /* MBProgressHUD.framework */,
160173
84438D612B2654EB00A1E407 /* MobileContainerManager.framework */,
161174
84438D5F2B26546E00A1E407 /* MobileCoreServices.framework */,
@@ -219,8 +232,6 @@
219232
84364F412B337BC000E90B58 /* bootstrap.h */,
220233
847099A42B1D9686003FA4ED /* Bootstrap.m */,
221234
84438D6E2B2CE5A300A1E407 /* AppEnabler.m */,
222-
84438D632B27522400A1E407 /* envbuf.h */,
223-
84438D642B27522400A1E407 /* envbuf.c */,
224235
84438D4D2B2609C600A1E407 /* utils.h */,
225236
84438D4B2B2609B200A1E407 /* utils.m */,
226237
84364F382B2E53BA00E90B58 /* seh.h */,
@@ -373,7 +384,6 @@
373384
FE0633AE2B41BCD900B94787 /* OptionsView.swift in Sources */,
374385
FE84597B2B44508300DCB44E /* AppViewControllerWrapper.swift in Sources */,
375386
847099A52B1D9686003FA4ED /* Bootstrap.m in Sources */,
376-
84438D652B27522400A1E407 /* envbuf.c in Sources */,
377387
FE895FEC2B418FC800A16882 /* VisualEffectView.swift in Sources */,
378388
FE895FED2B418FC800A16882 /* Log.swift in Sources */,
379389
84438D4C2B2609B200A1E407 /* utils.m in Sources */,
@@ -557,9 +567,10 @@
557567
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
558568
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
559569
CLANG_ENABLE_MODULES = YES;
560-
CODE_SIGN_STYLE = Automatic;
570+
CODE_SIGNING_ALLOWED = NO;
571+
CODE_SIGN_STYLE = Manual;
561572
CURRENT_PROJECT_VERSION = 1;
562-
DEVELOPMENT_TEAM = 49LJ27SG38;
573+
DEVELOPMENT_TEAM = "";
563574
FRAMEWORK_SEARCH_PATHS = (
564575
"$(inherited)",
565576
"$(PROJECT_DIR)/Bootstrap/Frameworks",
@@ -580,16 +591,19 @@
580591
LIBRARY_SEARCH_PATHS = (
581592
"$(inherited)",
582593
"$(PROJECT_DIR)",
594+
"$(PROJECT_DIR)/basebin/common/lib",
583595
);
584-
MARKETING_VERSION = "1.4";
596+
MARKETING_VERSION = 1.4;
585597
OTHER_LDFLAGS = "";
586598
PRODUCT_BUNDLE_IDENTIFIER = com.roothide.Bootstrap;
587599
PRODUCT_NAME = "$(TARGET_NAME)";
600+
PROVISIONING_PROFILE_SPECIFIER = "";
588601
SWIFT_EMIT_LOC_STRINGS = YES;
589602
SWIFT_OBJC_BRIDGING_HEADER = "Bootstrap/Bootstrap-Bridging-Header.h";
590603
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
591604
SWIFT_VERSION = 5.0;
592605
TARGETED_DEVICE_FAMILY = "1,2";
606+
USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/basebin/common\"";
593607
};
594608
name = Debug;
595609
};
@@ -599,9 +613,10 @@
599613
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
600614
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
601615
CLANG_ENABLE_MODULES = YES;
602-
CODE_SIGN_STYLE = Automatic;
616+
CODE_SIGNING_ALLOWED = NO;
617+
CODE_SIGN_STYLE = Manual;
603618
CURRENT_PROJECT_VERSION = 1;
604-
DEVELOPMENT_TEAM = 49LJ27SG38;
619+
DEVELOPMENT_TEAM = "";
605620
FRAMEWORK_SEARCH_PATHS = (
606621
"$(inherited)",
607622
"$(PROJECT_DIR)/Bootstrap/Frameworks",
@@ -622,15 +637,18 @@
622637
LIBRARY_SEARCH_PATHS = (
623638
"$(inherited)",
624639
"$(PROJECT_DIR)",
640+
"$(PROJECT_DIR)/basebin/common/lib",
625641
);
626-
MARKETING_VERSION = "1.4";
642+
MARKETING_VERSION = 1.4;
627643
OTHER_LDFLAGS = "";
628644
PRODUCT_BUNDLE_IDENTIFIER = com.roothide.Bootstrap;
629645
PRODUCT_NAME = "$(TARGET_NAME)";
646+
PROVISIONING_PROFILE_SPECIFIER = "";
630647
SWIFT_EMIT_LOC_STRINGS = YES;
631648
SWIFT_OBJC_BRIDGING_HEADER = "Bootstrap/Bootstrap-Bridging-Header.h";
632649
SWIFT_VERSION = 5.0;
633650
TARGETED_DEVICE_FAMILY = "1,2";
651+
USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/basebin/common\"";
634652
};
635653
name = Release;
636654
};

Bootstrap/AppEnabler.m

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ int backupApp(NSString* bundlePath)
9191
ASSERT([fm removeItemAtPath:backup error:nil]);
9292
}
9393

94+
NSDictionary* appInfo = [NSDictionary dictionaryWithContentsOfFile:[bundlePath stringByAppendingPathComponent:@"Info.plist"]];
95+
BOOL encryptedApp = [[NSFileManager defaultManager] fileExistsAtPath:[bundlePath stringByAppendingPathComponent:@"SC_Info"]];
96+
9497
NSString *resolvedPath = [[bundlePath stringByResolvingSymlinksInPath] stringByStandardizingPath];
9598
NSDirectoryEnumerator<NSURL *> *directoryEnumerator = [fm enumeratorAtURL:[NSURL fileURLWithPath:resolvedPath isDirectory:YES] includingPropertiesForKeys:@[NSURLIsRegularFileKey] options:0 errorHandler:nil];
9699

@@ -100,13 +103,24 @@ int backupApp(NSString* bundlePath)
100103
ASSERT([enumURL getResourceValue:&isFile forKey:NSURLIsRegularFileKey error:nil] && isFile!=nil);
101104
if (![isFile boolValue]) continue;
102105

103-
FILE *fp = fopen(enumURL.fileSystemRepresentation, "rb");
104-
ASSERT(fp != NULL);
106+
BOOL copy = NO;
105107

106-
bool ismacho=false, islib=false;
107-
machoGetInfo(fp, &ismacho, &islib);
108+
if([appBackupFileNames containsObject:enumURL.path.lastPathComponent]) {
109+
copy = YES;
110+
}
111+
else if(encryptedApp) {
112+
if([appInfo[@"CFBundleExecutable"] isEqualToString:enumURL.path.lastPathComponent]) {
113+
copy = YES;
114+
}
115+
}
116+
else {
117+
bool ismacho=false, islib=false;
118+
ASSERT(machoGetInfo(enumURL.fileSystemRepresentation, &ismacho, &islib));
119+
if(ismacho) {
120+
copy = YES;
121+
}
122+
}
108123

109-
fclose(fp);
110124

111125
//bundlePath should be a real-path
112126
NSString* subPath = relativize(enumURL, [NSURL fileURLWithPath:bundlePath], YES);
@@ -115,7 +129,7 @@ int backupApp(NSString* bundlePath)
115129
if(![fm fileExistsAtPath:backupPath.stringByDeletingLastPathComponent])
116130
ASSERT([fm createDirectoryAtPath:backupPath.stringByDeletingLastPathComponent withIntermediateDirectories:YES attributes:nil error:nil]);
117131

118-
if(ismacho || [appBackupFileNames containsObject:enumURL.path.lastPathComponent])
132+
if(copy)
119133
{
120134
NSError* err=nil;
121135
ASSERT([fm copyItemAtPath:enumURL.path toPath:backupPath error:&err]);
@@ -213,9 +227,7 @@ int enableForApp(NSString* bundlePath)
213227
ABORT();
214228
}
215229
}
216-
else if([appInfo[@"CFBundleIdentifier"] hasPrefix:@"com.apple."]
217-
|| [NSFileManager.defaultManager fileExistsAtPath:[bundlePath stringByAppendingString:@"/../_TrollStore"]]
218-
|| [NSFileManager.defaultManager fileExistsAtPath:[bundlePath stringByAppendingString:@"/../_TrollStoreLite"]])
230+
else if([appInfo[@"CFBundleIdentifier"] hasPrefix:@"com.apple."] || hasTrollstoreMarker(bundlePath.fileSystemRepresentation))
219231
{
220232
ASSERT(backupApp(bundlePath) == 0);
221233

@@ -261,9 +273,7 @@ int disableForApp(NSString* bundlePath)
261273
NSString* sysPath = [@"/Applications/" stringByAppendingString:bundlePath.lastPathComponent];
262274
ASSERT(spawnBootstrap((char*[]){"/usr/bin/uicache","-p", rootfsPrefix(sysPath).UTF8String, NULL}, nil, nil) == 0);
263275
}
264-
else if([appInfo[@"CFBundleIdentifier"] hasPrefix:@"com.apple."]
265-
|| [NSFileManager.defaultManager fileExistsAtPath:[bundlePath stringByAppendingString:@"/../_TrollStore"]]
266-
|| [NSFileManager.defaultManager fileExistsAtPath:[bundlePath stringByAppendingString:@"/../_TrollStoreLite"]])
276+
else if([appInfo[@"CFBundleIdentifier"] hasPrefix:@"com.apple."] || hasTrollstoreMarker(bundlePath.fileSystemRepresentation))
267277
{
268278

269279
struct stat st;

Bootstrap/AppViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ -(BOOL)tweakEnabled:(AppInfo*)app {
121121
return YES;
122122
}
123123

124-
if(!isDefaultInstallationPath(app.bundleURL.path)) {
124+
if(!isDefaultInstallationPath(app.bundleURL.path.fileSystemRepresentation)) {
125125
return NO;
126126
}
127127

@@ -147,7 +147,7 @@ - (void)updateData:(BOOL)sort {
147147

148148
// if(app.isHiddenApp) continue;
149149

150-
if(![app.bundleURL.path hasPrefix:@"/Applications/"] && !isDefaultInstallationPath(app.bundleURL.path)) {
150+
if(![app.bundleURL.path hasPrefix:@"/Applications/"] && !isDefaultInstallationPath(app.bundleURL.path.fileSystemRepresentation)) {
151151
//sysapp installed as jailbreak apps
152152
NSString* sysPath = [@"/Applications/" stringByAppendingPathComponent:app.bundleURL.path.lastPathComponent];
153153
if(![NSFileManager.defaultManager fileExistsAtPath:sysPath])

0 commit comments

Comments
 (0)