feat(MDC): experimental mdc

This commit is contained in:
junepark678
2023-11-28 19:20:51 +09:00
parent 42ecd38517
commit 0e9deea7a6
17 changed files with 2453 additions and 39 deletions

View File

@@ -240,7 +240,7 @@ final class AuthenticationOperation: ResultOperation<(ALTTeam, ALTCertificate, A
}
let activeAppsMinimumVersion = OperatingSystemVersion(majorVersion: 13, minorVersion: 3, patchVersion: 1)
if team.type == .free, ProcessInfo.processInfo.isOperatingSystemAtLeast(activeAppsMinimumVersion)
if team.type == .free, ProcessInfo.processInfo.isOperatingSystemAtLeast(activeAppsMinimumVersion), !UserDefaults.standard.isMDCEnabled
{
UserDefaults.standard.activeAppsLimit = ALTActiveAppsLimit
}

View File

@@ -12,6 +12,9 @@ import AltStoreCore
import AltSign
import Roxas
import minimuxer
#if MACDIRTYCOW
import MacDirtyCow
#endif
@objc(InstallAppOperation)
final class InstallAppOperation: ResultOperation<InstalledApp>
@@ -200,10 +203,42 @@ final class InstallAppOperation: ResultOperation<InstalledApp>
}
do {
#if MACDIRTYCOW
if UserDefaults.standard.isMDCEnabled {
grant_full_disk_access { error in
if error != nil {
self.finish(.failure(OperationError.mdcExploitFailed))
return
}
if !patch_installd() {
self.finish(.failure(OperationError.mdcExploitFailed))
return
}
do
{
try install_ipa(installedApp.bundleIdentifier)
installing = false
installedApp.refreshedDate = Date()
self.finish(.success(installedApp))
} catch let error {
installing = false
self.finish(.failure(error))
}
}
}
else {
try install_ipa(installedApp.bundleIdentifier)
installing = false
installedApp.refreshedDate = Date()
self.finish(.success(installedApp))
}
#else
try install_ipa(installedApp.bundleIdentifier)
installing = false
installedApp.refreshedDate = Date()
self.finish(.success(installedApp))
#endif
} catch let error {
installing = false
self.finish(.failure(error))

View File

@@ -40,6 +40,8 @@ enum OperationError: LocalizedError
case provisioningError(result: String, message: String?)
case anisetteV3Error(message: String)
case mdcExploitFailed
case cacheClearError(errors: [String])
var failureReason: String? {
@@ -62,6 +64,7 @@ enum OperationError: LocalizedError
case .anisetteV1Error(let message): return String(format: NSLocalizedString("An error occurred when getting anisette data from a V1 server: %@. Try using another anisette server.", comment: ""), message)
case .provisioningError(let result, let message): return String(format: NSLocalizedString("An error occurred when provisioning: %@%@. Please try again. If the issue persists, report it on GitHub Issues!", comment: ""), result, message != nil ? (" (" + message! + ")") : "")
case .anisetteV3Error(let message): return String(format: NSLocalizedString("An error occurred when getting anisette data from a V3 server: %@. Please try again. If the issue persists, report it on GitHub Issues!", comment: ""), message)
case .mdcExploitFailed: return NSLocalizedString("An error occured while running MDC exploit, try disabling it in settings", comment: "")
case .cacheClearError(let errors): return String(format: NSLocalizedString("An error occurred while clearing cache: %@", comment: ""), errors.joined(separator: "\n"))
}
}