Skip to content

Commit 5200552

Browse files
authored
Merge branch 'rooootdev:main' into main
2 parents 085895f + 25bebfe commit 5200552

10 files changed

Lines changed: 247 additions & 32 deletions

File tree

lara/classes/laramgr.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ final class laramgr: ObservableObject {
166166
}
167167

168168
func vfsinit(completion: ((Bool) -> Void)? = nil) {
169+
guard dsready, hasOffsets, !vfsrunning else { return }
169170
vfs_setlogcallback(laramgr.vfslogcallback)
170171
vfs_setprogresscallback { progress in
171172
DispatchQueue.main.async {
@@ -197,7 +198,7 @@ final class laramgr: ObservableObject {
197198
}
198199

199200
func sbxescape(completion: ((Bool) -> Void)? = nil) {
200-
guard dsready, !sbxrunning else { return }
201+
guard dsready, hasOffsets, !sbxrunning else { return }
201202
sbxattempted = true
202203
sbxfailed = false
203204
sbxrunning = true
@@ -752,6 +753,4 @@ final class laramgr: ObservableObject {
752753
}
753754
}
754755
#endif
755-
756-
757756
}

lara/funcs/fetchkcache.swift

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ func larakcpath() -> String? {
1818
}
1919

2020
func fetchkcache() -> Bool {
21+
guard ds_is_ready(),
22+
off_proc_p_fd != 0,
23+
off_filedesc_fd_ofiles != 0,
24+
off_fileproc_fp_glob != 0,
25+
off_fileglob_fg_data != 0,
26+
off_vnode_v_data != 0,
27+
off_namecache_nc_vp != 0,
28+
off_namecache_nc_child_tqe_next != 0 else {
29+
globallogger.log("(fetchkcache) exploit or offsets not ready")
30+
return false
31+
}
32+
2133
guard let kcpath = syskcpath() else {
2234
globallogger.log("(fetchkcache) failed to get kernelcache path")
2335
return false
@@ -63,23 +75,59 @@ func fetchkcache() -> Bool {
6375
}
6476

6577
var buffer = [UInt8](repeating: 0, count: 0x4000)
78+
let bufferSize = buffer.count
79+
var totalBytes = 0
6680

6781
while true {
68-
let n = read(src, &buffer, buffer.count)
82+
let n = buffer.withUnsafeMutableBytes { rawBuffer in
83+
read(src, rawBuffer.baseAddress!, bufferSize)
84+
}
6985

70-
if n <= 0 {
86+
if n < 0 {
87+
globallogger.log("(fetchkcache) failed to read kernelcache")
88+
return false
89+
}
90+
91+
if n == 0 {
7192
break
7293
}
7394

74-
_ = write(dst, buffer, n)
95+
var written = 0
96+
while written < n {
97+
let w = buffer.withUnsafeBytes { rawBuffer in
98+
write(dst, rawBuffer.baseAddress!.advanced(by: written), n - written)
99+
}
100+
101+
if w <= 0 {
102+
globallogger.log("(fetchkcache) failed to write kernelcache")
103+
return false
104+
}
105+
106+
written += w
107+
}
108+
109+
totalBytes += n
110+
}
111+
112+
if !FileManager.default.fileExists(atPath: outpath) || totalBytes == 0 {
113+
globallogger.log("(fetchkcache) kernelcache output missing")
114+
return false
75115
}
76116

77-
if !FileManager.default.fileExists(atPath: outpath) {
117+
guard let handle = FileHandle(forReadingAtPath: outpath) else {
78118
globallogger.log("(fetchkcache) kernelcache output missing")
79119
return false
80-
} else {
81-
globallogger.log("(fetchkcache) kernelcache fetch success!")
82120
}
83121

122+
let magic = handle.readData(ofLength: 2)
123+
handle.closeFile()
124+
125+
guard magic.count == 2, magic[magic.startIndex] == 0x30, magic[magic.index(after: magic.startIndex)] == 0x84 else {
126+
unlink(outpath)
127+
globallogger.log("(fetchkcache) invalid kernelcache output")
128+
return false
129+
}
130+
131+
globallogger.log("(fetchkcache) kernelcache fetch success!")
84132
return true
85133
}

lara/kexploit/offsets.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,18 @@ static bool is_ipad_device(void) {
530530
return strncmp(machine, "iPad", 4) == 0;
531531
}
532532

533+
static bool is_known_a_series_ipad_identifier(void) {
534+
char machine[64] = {0};
535+
size_t sz = sizeof(machine);
536+
if (sysctlbyname("hw.machine", machine, &sz, NULL, 0) != 0) return false;
537+
return strcmp(machine, "iPad13,1") == 0 ||
538+
strcmp(machine, "iPad13,2") == 0 ||
539+
strcmp(machine, "iPad13,18") == 0 ||
540+
strcmp(machine, "iPad13,19") == 0 ||
541+
strcmp(machine, "iPad14,1") == 0 ||
542+
strcmp(machine, "iPad14,2") == 0;
543+
}
544+
533545
void offsets_init(void) {
534546
if (!(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"17.0") && SYSTEM_VERSION_LESS_THAN(@"26.1"))) {
535547
printf("(offs) only supported offset for iOS 17.0 - 26.0.x\n");
@@ -575,7 +587,7 @@ void offsets_init(void) {
575587
cpuFamily == CPUFAMILY_ARM_TAHITI ||
576588
cpuFamily == CPUFAMILY_ARM_DONAN);
577589

578-
bool isMSeriesIpad = is_ipad_device() && (
590+
bool isMSeriesIpad = is_ipad_device() && !is_known_a_series_ipad_identifier() && (
579591
cpuFamily == CPUFAMILY_ARM_FIRESTORM_ICESTORM ||
580592
cpuFamily == CPUFAMILY_ARM_BLIZZARD_AVALANCHE ||
581593
cpuFamily == CPUFAMILY_ARM_IBIZA ||
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "sketchy.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "sketchy 1.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "sketchy 2.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
199 KB
Loading
199 KB
Loading
199 KB
Loading

lara/views/app/ContentView.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,16 @@ struct ContentView: View {
9191
let fetched = fetchkcache()
9292

9393
if fetched {
94+
let dlkc = dlkcache()
9495
DispatchQueue.main.async {
95-
mgr.hasOffsets = true
96+
mgr.hasOffsets = dlkc
9697
dlingkcache = false
9798
}
9899
return
99100
}
100101

101-
let dlkc = dlkcache()
102-
103102
DispatchQueue.main.async {
104-
mgr.hasOffsets = dlkc
103+
mgr.hasOffsets = false
105104
dlingkcache = false
106105
}
107106
}

lara/views/app/settings/SettingsView.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,16 @@ struct SettingsView: View {
7979
let fetched = fetchkcache()
8080

8181
if fetched {
82+
let dlkc = dlkcache()
8283
DispatchQueue.main.async {
83-
mgr.hasOffsets = true
84+
mgr.hasOffsets = dlkc
8485
dlingkcache = false
8586
}
8687
return
8788
}
8889

89-
let dlkc = dlkcache()
90-
9190
DispatchQueue.main.async {
92-
mgr.hasOffsets = dlkc
91+
mgr.hasOffsets = false
9392
dlingkcache = false
9493
}
9594
}

0 commit comments

Comments
 (0)