Skip to content

Commit d034d68

Browse files
committed
Add restart frontboard functionality and related UI elements
1 parent ada62b3 commit d034d68

7 files changed

Lines changed: 107 additions & 11 deletions

File tree

lara.xcodeproj/project.pbxproj

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
/* End PBXFileReference section */
4040

4141
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
42-
CC70C4A12F78D4C10052726B /* Exceptions for "lara" folder in "lara" target */ = {
42+
CC70C4A12F78D4C10052726B = {
4343
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
4444
membershipExceptions = (
4545
Info.plist,
@@ -49,14 +49,7 @@
4949
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
5050

5151
/* Begin PBXFileSystemSynchronizedRootGroup section */
52-
CC1C8B3B2F71DF9C00206982 /* lara */ = {
53-
isa = PBXFileSystemSynchronizedRootGroup;
54-
exceptions = (
55-
CC70C4A12F78D4C10052726B /* Exceptions for "lara" folder in "lara" target */,
56-
);
57-
path = lara;
58-
sourceTree = "<group>";
59-
};
52+
CC1C8B3B2F71DF9C00206982 /* lara */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (CC70C4A12F78D4C10052726B, ); path = lara; sourceTree = "<group>"; };
6053
/* End PBXFileSystemSynchronizedRootGroup section */
6154

6255
/* Begin PBXFrameworksBuildPhase section */

lara/classes/laramgr.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,24 @@ final class laramgr: ObservableObject {
129129
func respring() {
130130
notify_post("com.apple.springboard.toggleLockScreen")
131131
}
132+
133+
func restartFrontboard() {
134+
guard dsready else {
135+
logmsg("restart frontboard: exploit not ready")
136+
return
137+
}
138+
139+
DispatchQueue.global(qos: .userInitiated).async {
140+
let r = restart_frontboard_kill()
141+
DispatchQueue.main.async {
142+
if r == 0 {
143+
self.logmsg("restart frontboard: requested (SIGTERM)")
144+
} else {
145+
self.logmsg("restart frontboard: failed")
146+
}
147+
}
148+
}
149+
}
132150

133151
func vfsinit(completion: ((Bool) -> Void)? = nil) {
134152
vfs_setlogcallback(laramgr.vfslogcallback)

lara/kexploit/restart_frontboard.c

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#include "restart_frontboard.h"
2+
3+
#include <stdlib.h>
4+
#include <string.h>
5+
#include <unistd.h>
6+
#include <signal.h>
7+
#include <libproc.h>
8+
#include <stdio.h>
9+
10+
static pid_t find_pid_by_name(const char *name) {
11+
pid_t found = -1;
12+
int bufbytes = 4096;
13+
pid_t *pids = malloc(bufbytes);
14+
if (!pids) return -1;
15+
16+
int n = proc_listpids(PROC_ALL_PIDS, 0, pids, bufbytes);
17+
if (n <= 0) {
18+
free(pids);
19+
return -1;
20+
}
21+
22+
int count = n / (int)sizeof(pid_t);
23+
for (int i = 0; i < count; i++) {
24+
pid_t pid = pids[i];
25+
if (pid == 0) continue;
26+
char pname[PROC_PIDPATHINFO_MAXSIZE];
27+
memset(pname, 0, sizeof(pname));
28+
int r = proc_name(pid, pname, sizeof(pname));
29+
if (r > 0) {
30+
if (strcmp(pname, name) == 0) {
31+
found = pid;
32+
break;
33+
}
34+
}
35+
}
36+
37+
free(pids);
38+
return found;
39+
}
40+
41+
int restart_frontboard_kill(void) {
42+
const char *target = "frontboardd";
43+
pid_t pid = find_pid_by_name(target);
44+
if (pid <= 0) {
45+
// fallback: try killall via system call (best-effort)
46+
int sysr = system("killall frontboardd 2>/dev/null");
47+
return (sysr == 0) ? 0 : -1;
48+
}
49+
50+
if (kill(pid, SIGTERM) == 0) {
51+
return 0;
52+
}
53+
54+
// try SIGKILL if SIGTERM didn't work
55+
if (kill(pid, SIGKILL) == 0) {
56+
return 0;
57+
}
58+
59+
return -1;
60+
}

lara/kexploit/restart_frontboard.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef RESTART_FRONTBOARD_H
2+
#define RESTART_FRONTBOARD_H
3+
4+
#include <sys/types.h>
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
int restart_frontboard_kill(void);
11+
12+
#ifdef __cplusplus
13+
}
14+
#endif
15+
16+
#endif // RESTART_FRONTBOARD_H

lara/lara-Bridging-Header.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ uint64_t getprocsize(void);
1818
bool haskernproc(void);
1919
NSString *getkerncache(void);
2020
void clearkerncachedata(void);
21+
// restart frontboard helper
22+
int restart_frontboard_kill(void);

lara/views/ContentView.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct ContentView: View {
141141
ZeroView(mgr: mgr)
142142
}
143143

144-
if 1 == 2 {
144+
if betaFeatures {
145145
NavigationLink("3 App Bypass") {
146146
AppsView(mgr: mgr)
147147
}
@@ -154,7 +154,7 @@ struct ContentView: View {
154154
WhitelistView()
155155
}
156156

157-
NavigationLink("MobileGestalt") {
157+
NavigationLink("File Manager") {
158158
EditorView()
159159
}
160160
}
@@ -206,6 +206,11 @@ struct ContentView: View {
206206
mgr.panic()
207207
}
208208
.disabled(!mgr.dsready)
209+
210+
Button("Restart FrontBoard") {
211+
mgr.restartFrontboard()
212+
}
213+
.disabled(!mgr.dsready)
209214
} header: {
210215
Text("Other")
211216
}

lara/views/SettingsView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct SettingsView: View {
1414
@State private var downloadingkernelcache = false
1515
@AppStorage("loggernobullshit") private var loggernobullshit: Bool = false
1616
@AppStorage("keepalive") private var iskeepalive: Bool = true
17+
@AppStorage("betaFeatures") private var betaFeatures: Bool = false
1718

1819
var appName: String {
1920
Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String
@@ -72,6 +73,7 @@ struct SettingsView: View {
7273
if kaenabled { toggleka() }
7374
}
7475
}
76+
Toggle("Enable Beta Features", isOn: $betaFeatures)
7577
} header: {
7678
Text("Lara Settings")
7779
} footer: {

0 commit comments

Comments
 (0)