Skip to content

Commit 27ecd75

Browse files
committed
fix "firda -f" and fix injection for deamons with seatbelt-profiles entitlements
1 parent 8e4a8ad commit 27ecd75

File tree

6 files changed

+83
-26
lines changed

6 files changed

+83
-26
lines changed
-190 KB
Binary file not shown.

Bootstrap/ViewController.m

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,10 @@ BOOL checkServer()
9595
alerted = true;
9696

9797
UIAlertController *alert = [UIAlertController alertControllerWithTitle:Localized(@"Server Not Running") message:Localized(@"for unknown reasons the bootstrap server is not running, the only thing we can do is to restart it now.") preferredStyle:UIAlertControllerStyleAlert];
98-
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"Restart Server") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
98+
99+
if(![NSFileManager.defaultManager fileExistsAtPath:jbroot(@"/basebin/.launchctl_support")])
100+
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"Restart Server") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
99101

100-
if([NSFileManager.defaultManager fileExistsAtPath:jbroot(@"/basebin/.launchctl_support")]) {
101-
return;
102-
}
103-
104102
alerted = false;
105103

106104
NSString* log=nil;
@@ -184,7 +182,7 @@ void initFromSwiftUI()
184182
}];
185183
}
186184

187-
if(!IconCacheRebuilding && isBootstrapInstalled() && !isSystemBootstrapped()) {
185+
if(!IconCacheRebuilding && isSystemBootstrapped() && ![NSFileManager.defaultManager fileExistsAtPath:jbroot(@"/basebin/.launchctl_support")]) {
188186
if([UIApplication.sharedApplication canOpenURL:[NSURL URLWithString:@"filza://"]]
189187
|| [LSPlugInKitProxy pluginKitProxyForIdentifier:@"com.tigisoftware.Filza.Sharing"])
190188
{
@@ -372,14 +370,21 @@ void URLSchemesAction(BOOL enable)
372370
{
373371
if(!isSystemBootstrapped()) return;
374372

375-
if(!enable) {
373+
if(!enable)
374+
{
375+
if([NSFileManager.defaultManager fileExistsAtPath:jbroot(@"/basebin/.launchctl_support")]) {
376+
[NSNotificationCenter.defaultCenter postNotificationName:@"URLSchemesStatusNotification" object:@(YES)];
377+
[AppDelegate showMesage:Localized(@"URL Schemes are now undetectable on your device, you don't need to disable them anymore.") title:@""];
378+
return;
379+
}
380+
376381
URLSchemesToggle(enable);
377382
return;
378383
}
379384

380385
UIAlertController *alert = [UIAlertController alertControllerWithTitle:Localized(@"Warning") message:Localized(@"Enabling URL Schemes may result in jailbreak detection. Are you sure you want to continue?") preferredStyle:UIAlertControllerStyleAlert];
381386
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"NO") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
382-
[NSNotificationCenter.defaultCenter postNotificationName:@"URLSchemesCancelNotification" object:nil];
387+
[NSNotificationCenter.defaultCenter postNotificationName:@"URLSchemesStatusNotification" object:@(NO)];
383388
}]];
384389
[alert addAction:[UIAlertAction actionWithTitle:Localized(@"YES") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
385390
URLSchemesToggle(enable);
@@ -504,6 +509,9 @@ int exploitStart(NSString* execDir)
504509
NSString* entitlementsFilePath = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:entitlementsFileInBundlePath];
505510
if([fm fileExistsAtPath:entitlementsFilePath]) {
506511
ASSERT(spawnRoot(ldidPath, @[@"-M", [NSString stringWithFormat:@"-S%@", entitlementsFilePath], destPath], nil, nil) == 0);
512+
} else {
513+
STRAPLOG("Entitlements File %@ Not Found!!!", entitlementsFileInBundlePath);
514+
return -1;
507515
}
508516

509517
ASSERT(spawnRoot(fastSignPath, @[destPath], nil, nil) == 0);

Bootstrap/Views/OptionsView.swift

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,6 @@ struct OptionsView: View {
6565
tweaEnableAction(newValue)
6666
}
6767

68-
Toggle(isOn: Binding(get: {opensshStatus.state}, set: {
69-
opensshStatus.state = opensshAction($0)
70-
}), label: {
71-
Label(
72-
title: { Text("OpenSSH") },
73-
icon: { Image(systemName: "terminal") }
74-
)
75-
})
76-
.onReceive(NotificationCenter.default.publisher(for: Notification.Name("opensshStatusNotification"))) { obj in
77-
DispatchQueue.main.async {
78-
let newStatus = (obj.object as! NSNumber).boolValue
79-
opensshStatus.state = newStatus
80-
}
81-
}
8268
if isBootstrapInstalled() {
8369
Toggle(isOn: Binding(get: {allowURLSchemes.state}, set: {
8470
allowURLSchemes.state = $0
@@ -90,12 +76,29 @@ struct OptionsView: View {
9076
)
9177
})
9278
.disabled(!isSystemBootstrapped())
93-
.onReceive(NotificationCenter.default.publisher(for: Notification.Name("URLSchemesCancelNotification"))) { obj in
79+
.onReceive(NotificationCenter.default.publisher(for: Notification.Name("URLSchemesStatusNotification"))) { obj in
9480
DispatchQueue.main.async {
95-
allowURLSchemes.state = false
81+
let newStatus = (obj.object as! NSNumber).boolValue
82+
allowURLSchemes.state = newStatus
9683
}
9784
}
9885
}
86+
87+
Toggle(isOn: Binding(get: {opensshStatus.state}, set: {
88+
opensshStatus.state = opensshAction($0)
89+
}), label: {
90+
Label(
91+
title: { Text("OpenSSH") },
92+
icon: { Image(systemName: "terminal") }
93+
)
94+
})
95+
.onReceive(NotificationCenter.default.publisher(for: Notification.Name("opensshStatusNotification"))) { obj in
96+
DispatchQueue.main.async {
97+
let newStatus = (obj.object as! NSNumber).boolValue
98+
opensshStatus.state = newStatus
99+
}
100+
}
101+
99102
HStack {
100103
Label(
101104
title: { Text("Colors") },

Bootstrap/bootstrap.m

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
int getCFMajorVersion()
1515
{
16+
if(@available(iOS 16.0, *)) {
17+
return 1900;
18+
}
19+
1620
return ((int)kCFCoreFoundationVersionNumber / 100) * 100;
1721
}
1822

@@ -80,6 +84,43 @@ int disableRootHideBlacklist()
8084
return 0;
8185
}
8286

87+
int fixPackageSources()
88+
{
89+
NSArray* sileoSources = [NSFileManager.defaultManager directoryContentsAtPath:jbroot(@"/etc/apt/sources.list.d")];
90+
ASSERT(sileoSources != NULL);
91+
for(NSString* item in sileoSources)
92+
{
93+
NSString* source = [jbroot(@"/etc/apt/sources.list.d") stringByAppendingPathComponent:item];
94+
NSString* sileoList = [NSString stringWithContentsOfFile:source encoding:NSUTF8StringEncoding error:nil];
95+
ASSERT(sileoList != NULL);
96+
97+
if([sileoList containsString:@"iphoneos-arm64e/2000"]) {
98+
if([NSFileManager.defaultManager fileExistsAtPath:jbroot(@"/var/lib/apt/lists")])
99+
ASSERT([NSFileManager.defaultManager removeItemAtPath:jbroot(@"/var/lib/apt/lists") error:nil]);
100+
if([NSFileManager.defaultManager fileExistsAtPath:jbroot(@"/var/lib/apt/sileolists")])
101+
ASSERT([NSFileManager.defaultManager removeItemAtPath:jbroot(@"/var/lib/apt/sileolists") error:nil]);
102+
}
103+
104+
sileoList = [sileoList stringByReplacingOccurrencesOfString:@"iphoneos-arm64e/2000" withString:@"iphoneos-arm64e/1900"];
105+
106+
ASSERT([sileoList writeToFile:source atomically:YES encoding:NSUTF8StringEncoding error:nil]);
107+
}
108+
109+
110+
NSString* zebraList = [NSString stringWithContentsOfFile:jbroot(@"/var/mobile/Library/Application Support/xyz.willy.Zebra/sources.list") encoding:NSUTF8StringEncoding error:nil];
111+
ASSERT(zebraList != NULL);
112+
if([zebraList containsString:@"iphoneos-arm64e/2000"]) {
113+
if([NSFileManager.defaultManager fileExistsAtPath:jbroot(@"/var/mobile/Library/Application Support/xyz.willy.Zebra/lists")])
114+
ASSERT([NSFileManager.defaultManager removeItemAtPath:jbroot(@"/var/mobile/Library/Application Support/xyz.willy.Zebra/lists") error:nil]);
115+
if([NSFileManager.defaultManager fileExistsAtPath:jbroot(@"/var/mobile/Library/Application Support/xyz.willy.Zebra/zebra.db")])
116+
ASSERT([NSFileManager.defaultManager removeItemAtPath:jbroot(@"/var/mobile/Library/Application Support/xyz.willy.Zebra/zebra.db") error:nil]);
117+
}
118+
zebraList = [zebraList stringByReplacingOccurrencesOfString:@"iphoneos-arm64e/2000" withString:@"iphoneos-arm64e/1900"];
119+
ASSERT([zebraList writeToFile:jbroot(@"/var/mobile/Library/Application Support/xyz.willy.Zebra/sources.list") atomically:YES encoding:NSUTF8StringEncoding error:nil]);
120+
121+
return 0;
122+
}
123+
83124
int buildPackageSources()
84125
{
85126
NSFileManager* fm = NSFileManager.defaultManager;
@@ -239,6 +280,9 @@ int InstallBootstrap(NSString* jbroot_path)
239280

240281
STRAPLOG("Status: Bootstrap Installed");
241282

283+
if(@available(iOS 16.0, *)) {
284+
ASSERT([[NSString new] writeToFile:jbroot(@"/var/mobile/.allow_url_schemes") atomically:YES encoding:NSUTF8StringEncoding error:nil]);
285+
}
242286

243287
return 0;
244288
}
@@ -319,6 +363,8 @@ int ReRandomizeBootstrap()
319363
ASSERT(fixBootstrapSymlink(@"/usr/bin/sh") == 0);
320364
ASSERT(spawnBootstrap((char*[]){"/bin/sh", "/usr/libexec/updatelinks.sh", NULL}, nil, nil) == 0);
321365

366+
ASSERT(fixPackageSources() == 0);
367+
322368
return 0;
323369
}
324370

Bootstrap/main.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void CommLog(const char* format, ...)
1616

1717
int main(int argc, char * argv[]) {
1818

19-
CommLogFunction = CommLog;
19+
enableCommLog(CommLog, CommLog);
2020

2121
if(argc >= 2)
2222
{

0 commit comments

Comments
 (0)