forked from GenericCoding/kfd
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathContentView.swift
105 lines (93 loc) · 4.14 KB
/
ContentView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import SwiftUI
struct ContentView: View {
@State private var kfd: UInt64 = 0
@State private var puafPages = 2048
@State private var puafMethod = 1
@State private var kreadMethod = 1
@State private var kwriteMethod = 1
var puafPagesOptions = [16, 32, 64, 128, 256, 512, 1024, 2048]
var puafMethodOptions = ["physpuppet", "smith"]
var kreadMethodOptions = ["kqueue_workloop_ctl", "sem_open"]
var kwriteMethodOptions = ["dup", "sem_open"]
var body: some View {
NavigationView {
Form {
Section(header: Text("Payload Settings")) {
Picker("puaf pages:", selection: $puafPages) {
ForEach(puafPagesOptions, id: \.self) { pages in
Text(String(pages))
}
}.pickerStyle(SegmentedPickerStyle())
.disabled(kfd != 0)
Picker("puaf method:", selection: $puafMethod) {
ForEach(0..<puafMethodOptions.count, id: \.self) { index in
Text(puafMethodOptions[index])
}
}.pickerStyle(SegmentedPickerStyle())
.disabled(kfd != 0)
}
Section(header: Text("Kernel Settings")) {
Picker("kread method:", selection: $kreadMethod) {
ForEach(0..<kreadMethodOptions.count, id: \.self) { index in
Text(kreadMethodOptions[index])
}
}.pickerStyle(SegmentedPickerStyle())
.disabled(kfd != 0)
Picker("kwrite method:", selection: $kwriteMethod) {
ForEach(0..<kwriteMethodOptions.count, id: \.self) { index in
Text(kwriteMethodOptions[index])
}
}.pickerStyle(SegmentedPickerStyle())
.disabled(kfd != 0)
}
Section {
HStack(spacing: 20) {
Button("Open exploit") {
kfd = do_kopen(UInt64(puafPages), UInt64(puafMethod), UInt64(kreadMethod), UInt64(kwriteMethod))
do_fun(kfd)
}.disabled(kfd != 0)
Button("Close exploit") {
do_kclose(kfd)
kfd = 0
}.disabled(kfd == 0)
Button("Respring") {
kfd = 0
do_respring()
}
.accentColor(.red)
}
.buttonStyle(BorderlessButtonStyle())
}
if kfd != 0 {
Section(header: Text("Status")) {
VStack(alignment: .leading, spacing: 8) {
Text("Success!")
.font(.headline)
.foregroundColor(.green)
Text("View output in Xcode")
.foregroundColor(.gray)
}
}
}
Section(header: Text("Other Actions")) {
Button("Hide Dock") {
do_hidedock(kfd)
}
.buttonStyle(BorderlessButtonStyle())
Button("Mute cam") {
do_cammute(kfd)
}
.buttonStyle(BorderlessButtonStyle())
}
}
.navigationBarTitle("Kernel Exploit", displayMode: .inline)
.accentColor(.green) // Highlight the navigation bar elements in green
}
.foregroundColor(.white) // Set the default text color to black
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}