Skip to content

Commit

Permalink
wait when did i code this
Browse files Browse the repository at this point in the history
  • Loading branch information
f1shy-dev committed Nov 2, 2023
1 parent f5e9f62 commit adec1cd
Show file tree
Hide file tree
Showing 27 changed files with 20,477 additions and 1,105 deletions.
24 changes: 12 additions & 12 deletions ControlConfig.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
7D1273FD2A829FD900FDEBE0 /* NotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D1273FC2A829FD900FDEBE0 /* NotificationManager.swift */; };
7D201BE7299C19A20023D649 /* Module.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D201BE6299C19A20023D649 /* Module.swift */; };
7D201BE9299C1A2B0023D649 /* Customisation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D201BE8299C1A2B0023D649 /* Customisation.swift */; };
7D201BEB299C1AB60023D649 /* CustomisationsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D201BEA299C1AB60023D649 /* CustomisationsList.swift */; };
7D201BEB299C1AB60023D649 /* CustomisationSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D201BEA299C1AB60023D649 /* CustomisationSet.swift */; };
7D201BEE299C1D1C0023D649 /* TypeExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D201BED299C1D1C0023D649 /* TypeExtensions.swift */; };
7D201BF0299C1D470023D649 /* MDCSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D201BEF299C1D470023D649 /* MDCSwift.swift */; };
7D201BF2299C1DE30023D649 /* MDCWrappers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D201BF1299C1DE30023D649 /* MDCWrappers.swift */; };
Expand Down Expand Up @@ -43,7 +43,7 @@
7D6CFADD2A7E6A0D0038E142 /* iOS16_CCBackup.zip in Resources */ = {isa = PBXBuildFile; fileRef = 7D6CFADC2A7E6A0D0038E142 /* iOS16_CCBackup.zip */; };
7D7956AF29BFCD9B00D7CFCD /* WelcomeSheet in Frameworks */ = {isa = PBXBuildFile; productRef = 7D7956AE29BFCD9B00D7CFCD /* WelcomeSheet */; };
7D7956B129BFCE5300D7CFCD /* FirstLaunchSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D7956B029BFCE5300D7CFCD /* FirstLaunchSheetView.swift */; };
7D8F69AD2A82E141000D8BDF /* CustomisationSetCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D8F69AC2A82E141000D8BDF /* CustomisationSetCodable.swift */; };
7D8F69AF2A8563EC000D8BDF /* ApplyAndReorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D8F69AE2A8563EC000D8BDF /* ApplyAndReorder.swift */; };
7DBE8ED629B919C700A36AA6 /* BackupManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DBE8ED529B919C700A36AA6 /* BackupManager.swift */; };
7DDD2FA329AEB2F90064A7FC /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DDD2FA229AEB2F90064A7FC /* SettingsView.swift */; };
7DDD2FA529AEB35E0064A7FC /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DDD2FA429AEB35E0064A7FC /* AppState.swift */; };
Expand Down Expand Up @@ -105,7 +105,7 @@
7D1273FC2A829FD900FDEBE0 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; };
7D201BE6299C19A20023D649 /* Module.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Module.swift; sourceTree = "<group>"; };
7D201BE8299C1A2B0023D649 /* Customisation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Customisation.swift; sourceTree = "<group>"; };
7D201BEA299C1AB60023D649 /* CustomisationsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomisationsList.swift; sourceTree = "<group>"; };
7D201BEA299C1AB60023D649 /* CustomisationSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomisationSet.swift; sourceTree = "<group>"; };
7D201BED299C1D1C0023D649 /* TypeExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeExtensions.swift; sourceTree = "<group>"; };
7D201BEF299C1D470023D649 /* MDCSwift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MDCSwift.swift; sourceTree = "<group>"; };
7D201BF1299C1DE30023D649 /* MDCWrappers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MDCWrappers.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -168,7 +168,7 @@
7D63C1262A64752D0066AB5A /* CAPropertyInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CAPropertyInfo.h; sourceTree = "<group>"; };
7D6CFADC2A7E6A0D0038E142 /* iOS16_CCBackup.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = iOS16_CCBackup.zip; sourceTree = "<group>"; };
7D7956B029BFCE5300D7CFCD /* FirstLaunchSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstLaunchSheetView.swift; sourceTree = "<group>"; };
7D8F69AC2A82E141000D8BDF /* CustomisationSetCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomisationSetCodable.swift; sourceTree = "<group>"; };
7D8F69AE2A8563EC000D8BDF /* ApplyAndReorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplyAndReorder.swift; sourceTree = "<group>"; };
7DBE8ED429B7EC0E00A36AA6 /* ControlConfig.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ControlConfig.entitlements; sourceTree = "<group>"; };
7DBE8ED529B919C700A36AA6 /* BackupManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupManager.swift; sourceTree = "<group>"; };
7DDD2FA229AEB2F90064A7FC /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -299,11 +299,10 @@
children = (
7D201BE6299C19A20023D649 /* Module.swift */,
7D201BE8299C1A2B0023D649 /* Customisation.swift */,
7D201BEA299C1AB60023D649 /* CustomisationsList.swift */,
7D201BEA299C1AB60023D649 /* CustomisationSet.swift */,
7DDD2FA429AEB35E0064A7FC /* AppState.swift */,
7DBE8ED529B919C700A36AA6 /* BackupManager.swift */,
7D63C11B2A643BFD0066AB5A /* IconPack.swift */,
7D8F69AC2A82E141000D8BDF /* CustomisationSetCodable.swift */,
);
path = Models;
sourceTree = "<group>";
Expand All @@ -329,6 +328,7 @@
children = (
7D09760C2995714D004E6087 /* ModuleOperations.swift */,
7D201BF6299C1FAC0023D649 /* StaticCCMappings.swift */,
7D8F69AE2A8563EC000D8BDF /* ApplyAndReorder.swift */,
);
path = "Control Center";
sourceTree = "<group>";
Expand Down Expand Up @@ -758,7 +758,7 @@
7DF5FE2329E81FEC00809050 /* RenditionEditorView.swift in Sources */,
7D7956B129BFCE5300D7CFCD /* FirstLaunchSheetView.swift in Sources */,
7D63C1182A63538D0066AB5A /* ExploreView.swift in Sources */,
7D201BEB299C1AB60023D649 /* CustomisationsList.swift in Sources */,
7D201BEB299C1AB60023D649 /* CustomisationSet.swift in Sources */,
7DBE8ED629B919C700A36AA6 /* BackupManager.swift in Sources */,
7D1273F52A8250E700FDEBE0 /* TutorialSheetView.swift in Sources */,
D625E86A2991CD3000D5A5B0 /* ControlConfigApp.swift in Sources */,
Expand All @@ -770,6 +770,7 @@
7D3BAB7929B4BE2E0024C9C9 /* UIViewBlurEffect.swift in Sources */,
7D201BF0299C1D470023D649 /* MDCSwift.swift in Sources */,
7D201C00299C238D0023D649 /* EditModuleView.swift in Sources */,
7D8F69AF2A8563EC000D8BDF /* ApplyAndReorder.swift in Sources */,
7D201BF7299C1FAC0023D649 /* StaticCCMappings.swift in Sources */,
7D201C02299C25190023D649 /* CustomisationCard.swift in Sources */,
7DF5FE2129E767C300809050 /* ImagePicker.swift in Sources */,
Expand All @@ -786,7 +787,6 @@
7D2919FF2A7F9E9300ACC16E /* offsets.m in Sources */,
7D3BAB7B29B4BE760024C9C9 /* EditCCColorsView.swift in Sources */,
7D201BF4299C1E280023D649 /* PlistHelpers.swift in Sources */,
7D8F69AD2A82E141000D8BDF /* CustomisationSetCodable.swift in Sources */,
7DDD2FA529AEB35E0064A7FC /* AppState.swift in Sources */,
D6E552D129B3E3300083E6A5 /* ApplicationManager.swift in Sources */,
7D201BFB299C23100023D649 /* MainModuleView.swift in Sources */,
Expand Down Expand Up @@ -967,7 +967,7 @@
CODE_SIGN_ENTITLEMENTS = ControlConfig/ControlConfig.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "KfdExploit-Testing-10";
CURRENT_PROJECT_VERSION = "KfdPublic-P11-1";
DEVELOPMENT_ASSET_PATHS = "\"ControlConfig/Preview Content\"";
DEVELOPMENT_TEAM = ZV2PLXMRSB;
ENABLE_PREVIEWS = YES;
Expand All @@ -987,7 +987,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.0.1;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.f1shy-dev.ControlConfigXEX";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1012,7 +1012,7 @@
CODE_SIGN_ENTITLEMENTS = ControlConfig/ControlConfig.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "KfdExploit-Testing-10";
CURRENT_PROJECT_VERSION = "KfdPublic-P11-1";
DEVELOPMENT_ASSET_PATHS = "\"ControlConfig/Preview Content\"";
DEVELOPMENT_TEAM = ZV2PLXMRSB;
ENABLE_PREVIEWS = YES;
Expand All @@ -1032,7 +1032,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.0.1;
OTHER_LDFLAGS = "$(inherited)";
"OTHER_LDFLAGS[arch=*]" = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.f1shy-dev.ControlConfig";
Expand Down
33 changes: 33 additions & 0 deletions ControlConfig/Control Center/ApplyAndReorder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
//
// ApplyAndReorder.swift
// ControlConfig
//
// Created by f1shy-dev on 10/08/2023
//


import Foundation
import UIKit

func applyAndOpenReorder() {
DispatchQueue.global(qos: .userInitiated).async {
let success = applyChanges()
DispatchQueue.main.async {
if success.0 {
Haptic.shared.notify(.success)
xpc_crash("com.apple.Preferences")
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
if let url = URL(string: "App-prefs:ControlCenter") {
UIApplication.shared.open(url)
}
}
sendNotification(identifier:"dont-see-modules", title: "Don't see your modules?", subtitle: "Tap to apply and try again.", secondsLater: 2, isRepeating: false)
} else {
Haptic.shared.notify(.error)
let failed = success.1.filter { $0.value == false }.map { $0.key }.joined(separator: "\n")
UIApplication.shared.alert(title: "⛔️ Error", body: "An error occured while applying your modules and customisiations. The write operations that failed are: \n\n\(failed)\n\nPlease adjust any relevant settings and try again, and if it still does not work then try rebooting your device. If it still does not work, please report this to the developer and provide any logs/details of what you tried.")
}
}
}
}
17 changes: 9 additions & 8 deletions ControlConfig/Control Center/ModuleOperations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ func fetchModules() -> [Module] {



func applyChanges(customisations: CustomisationList) -> (Bool, [String:Bool]) {
func applyChanges() -> (Bool, [String:Bool]) {
let currentSet = AppState.shared.currentSet
print() // emoji seperation
var emptyDMS: [String: Any] = [:]
var successMap: [String: Bool] = [:]
let backupDMS = BackupManager.shared.latestBackup?.defaultModuleSettings

var compressedAllowList: [String] = []
for customisation in customisations.list {
for customisation in currentSet.list {
let infoPath = "\(CCMappings.bundlesPath)\(customisation.module.fileName)/Info.plist"
let infoPlist = NSMutableDictionary()
// let originalPlist = PlistHelpers.plistToDict(path: infoPath)
Expand Down Expand Up @@ -355,7 +356,7 @@ func applyChanges(customisations: CustomisationList) -> (Bool, [String:Bool]) {


if activeExploit == .KFD, let keys = CCMappings.fileNameBasedSmallIDs.allKeys as? [String] {
let custom_modules = customisations.list.map { $0.module.fileName }
let custom_modules = currentSet.list.map { $0.module.fileName }
for fileName in keys.filter({ key in
let fn = CCMappings.fileNameBasedSmallIDs[key] as? String
let mapped = ["ios15", "ptrace", "mute"].map{fn?.contains($0)}
Expand Down Expand Up @@ -406,7 +407,7 @@ func applyChanges(customisations: CustomisationList) -> (Bool, [String:Bool]) {
// revert modules

let notAddedModules = fetchModules().filter { mod in
!customisations.list.contains(where: {$0.module.fileName == mod.fileName})
!currentSet.list.contains(where: {$0.module.fileName == mod.fileName})
}.filter{mod in
CCMappings().hiddenModulesToPatch.contains(mod.fileName)
}
Expand Down Expand Up @@ -460,13 +461,13 @@ func applyChanges(customisations: CustomisationList) -> (Bool, [String:Bool]) {



if customisations.otherCustomisations.enableCustomColors == true {
if currentSet.enableCustomColors == true {
print("⚙️ Writing colour recipes")
if let c = customisations.otherCustomisations.moduleColor, let b = customisations.otherCustomisations.moduleBlur {
if let c = currentSet.moduleColor, let b = currentSet.moduleBlur {
successMap["Colours - Module"] = (ColorTools.applyMaterialRecipe(filePath: CCMappings.moduleMaterialRecipePath, color: c, blur: b, includeSpecificsForCCModules: true))
}

if let cB = customisations.otherCustomisations.moduleBGColor, let bB = customisations.otherCustomisations.moduleBGBlur {
if let cB = currentSet.moduleBGColor, let bB = currentSet.moduleBGBlur {
successMap["Colours - Module Background"] = (ColorTools.applyMaterialRecipe(filePath: CCMappings.moduleBackgroundMaterialRecipePath, color: cB, blur: bB, includeSpecificsForCCModules: false))
}
}
Expand All @@ -476,7 +477,7 @@ func applyChanges(customisations: CustomisationList) -> (Bool, [String:Bool]) {
let moduleConf = NSMutableDictionary()
moduleConf["disabled-module-identifiers"] = []
moduleConf["userenabled-fixed-module-identifiers"] = []
moduleConf["module-identifiers"] = customisations.list.filter {!$0.module.fileName.contains("ConferenceControlCenterModule")}.map {
moduleConf["module-identifiers"] = currentSet.list.filter {!$0.module.fileName.contains("ConferenceControlCenterModule")}.map {
CCMappings.fileNameBasedSmallIDs[$0.module.fileName] as? String ?? $0.module.bundleID } as [String]
moduleConf["version"] = 1

Expand Down
21 changes: 17 additions & 4 deletions ControlConfig/ControlConfigApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ import LocalConsole
import SwiftUI
import WelcomeSheet

let appVersion = ((Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown") + " (" + (Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "Unknown") + ")")
let consoleManager = LCManager.shared
let isiOSSixteen = ProcessInfo().operatingSystemVersion.majorVersion == 16
var kfd: UInt64 = 0
var _debug_savedAppState_counter = 0
enum ActiveExploit { case MDC, KFD }
var activeExploit: ActiveExploit = .MDC
enum PatchStage {
case Detecting, NotSupported, UnableToEscape(err: String), TooOld, Escaped, LoadingBackups
}
let appVersion = ((Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown") + " (" + (Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "Unknown") + ")")
let isiOSSixteen = ProcessInfo().operatingSystemVersion.majorVersion == 16

struct BareLoading: View {
var icon: String
Expand Down Expand Up @@ -55,12 +56,13 @@ struct BareLoading: View {

@main
struct ControlConfigApp: App {
@UIApplicationDelegateAdaptor private var appDelegate: NotificationHandlerAppDelegate
@State var showingBackupSheet = false
@State var showingFirstLaunchSheet = false
@State var backupStage: BackupStage = .YetToRespring
@State var localPatchState: PatchStage = .Detecting
@State private var rotationAngle: Double = 0
@ObservedObject var appState = AppState.shared
@StateObject var appState = AppState.shared

var body: some Scene {
WindowGroup {
Expand Down Expand Up @@ -149,8 +151,16 @@ struct ControlConfigApp: App {
localPatchState = .LoadingBackups
activeExploit = .KFD
#else


if #available(iOS 16.0, *), appState.force_kfd_exploit {
print("⚠️ iOS \(UIDevice.current.systemVersion) - KFD FORCED")
activeExploit = .KFD
localPatchState = .LoadingBackups
return
}
// should be 16.3
if #available(iOS 16.0, *) {
if #available(iOS 16.3, *) {
if #available(iOS 16.5.1, *) {
if UIDevice.current.systemVersion == "16.6", splitted.count >= 4, splitted[4] == "20G5026e" {
print("✅ iOS 16.6b1 - KFD supported")
Expand Down Expand Up @@ -245,6 +255,9 @@ struct ControlConfigApp: App {
}
}
}
}.environmentObject(appState)
.onReceive(appState.objectWillChange) { val in
appState.saveToDisk()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ControlConfig/Exploit/MDCSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum MDC {
let buffer = UnsafeMutablePointer<Int>.allocate(capacity: 0x4000)
let n = read(fd, buffer, 0x4000)
var byteArray = [UInt8](Data(bytes: buffer, count: n))

let treeBytes: [UInt8] = [0, 0, 0, 0, 0x74, 0x72, 0x65, 0x65, 0, 0, 0]
let corruptBytes: [UInt8] = [67, 111, 114, 114, 117, 112, 116, 84, 104, 105, 76]

Expand Down
Loading

0 comments on commit adec1cd

Please sign in to comment.