rework exploit code to support last 4% of tendies

This commit is contained in:
leminlimez committed 2025-06-03 11:58:10 -04:00
1 parent 7e60c71c0d
commit 0d0d718459
2 files changed
+54 -18

No files matched your search

@@ -59,13 +59,28 @@ class PosterBoardManager {
UIApplication.shared.open(url, options: [:], completionHandler: nil) UIApplication.shared.open(url, options: [:], completionHandler: nil)
} }
static func getDescriptorsFromTendie(_ url: URL) throws -> URL? { static func getDescriptorsFromTendie(_ url: URL) throws -> [String: [URL]]? {
for dir in try FileManager.default.contentsOfDirectory(at: url, includingPropertiesForKeys: nil, options: .skipsHiddenFiles) { for dir in try FileManager.default.contentsOfDirectory(at: url, includingPropertiesForKeys: nil, options: .skipsHiddenFiles) {
let fileName = dir.lastPathComponent let fileName = dir.lastPathComponent
if fileName.lowercased() == "descriptor" || fileName.lowercased() == "descriptors" { if fileName.lowercased() == "container" {
return dir // container support, find the extensions
let extDir = dir.appending(path: "Library/Application Support/PRBPosterExtensionDataStore/61/Extensions")
print(extDir.absoluteString)
var retList: [String: [URL]] = [:]
for ext in try FileManager.default.contentsOfDirectory(at: extDir, includingPropertiesForKeys: nil, options: .skipsHiddenFiles) {
let descrDir = ext.appendingPathComponent("descriptors")
retList[ext.lastPathComponent] = [descrDir]
}
return retList
}
else if fileName.lowercased() == "descriptor" || fileName.lowercased() == "descriptors" || fileName.lowercased() == "ordered-descriptor" || fileName.lowercased() == "ordered-descriptors" { // TODO: Add ordered descriptors
return ["com.apple.WallpaperKit.CollectionsPoster": [dir]]
}
else if fileName.lowercased() == "video-descriptor" || fileName.lowercased() == "video-descriptors" {
return ["com.apple.PhotosUIPrivate.PhotosPosterProvider": [dir]]
} }
} }
// TODO: Add error handling here
return nil return nil
} }
@@ -128,27 +143,47 @@ class PosterBoardManager {
} }
static func applyTendies(_ urls: [URL], appHash: String) throws { static func applyTendies(_ urls: [URL], appHash: String) throws {
let _ = try SymHandler.createDescriptorsSymlink(appHash: appHash) // organize the descriptors into their respective extensions
defer { var extList: [String: [URL]] = [:]
SymHandler.cleanup() var unzippedDirs: [URL: URL] = [:]
}
for url in urls { for url in urls {
let unzippedDir = try unzipFile(at: url) let unzippedDir = try unzipFile(at: url)
unzippedDirs[url] = unzippedDir
guard let descriptors = try getDescriptorsFromTendie(unzippedDir) else { continue } // TODO: Add error handling guard let descriptors = try getDescriptorsFromTendie(unzippedDir) else { continue } // TODO: Add error handling
// create the folder extList.merge(descriptors) { (first, second) in first + second }
for descr in try FileManager.default.contentsOfDirectory(at: descriptors, includingPropertiesForKeys: nil, options: .skipsHiddenFiles) { }
if descr.lastPathComponent != "__MACOSX" {
try randomizeWallpaperId(url: descr)
let newURL = SymHandler.getDocumentsDirectory().appendingPathComponent(UUID().uuidString, conformingTo: .directory)
try FileManager.default.moveItem(at: descr, to: newURL)
try FileManager.default.trashItem(at: newURL, resultingItemURL: nil) defer {
SymHandler.cleanup()
for url in urls {
// clean up all possible files
if let unzippedDir = unzippedDirs[url] {
try? FileManager.default.removeItem(at: unzippedDir)
} }
} }
}
// clean up the files for (ext, descriptorsList) in extList {
try? FileManager.default.removeItem(at: unzippedDir) let _ = try SymHandler.createDescriptorsSymlink(appHash: appHash, ext: ext)
for descriptors in descriptorsList {
// create the folder
for descr in try FileManager.default.contentsOfDirectory(at: descriptors, includingPropertiesForKeys: nil, options: .skipsHiddenFiles) {
if descr.lastPathComponent != "__MACOSX" {
try randomizeWallpaperId(url: descr)
let newURL = SymHandler.getDocumentsDirectory().appendingPathComponent(UUID().uuidString, conformingTo: .directory)
try FileManager.default.moveItem(at: descr, to: newURL)
try FileManager.default.trashItem(at: newURL, resultingItemURL: nil)
}
}
}
SymHandler.cleanup()
}
// clean up
for url in urls {
try? FileManager.default.removeItem(at: SymHandler.getDocumentsDirectory().appendingPathComponent(url.lastPathComponent)) try? FileManager.default.removeItem(at: SymHandler.getDocumentsDirectory().appendingPathComponent(url.lastPathComponent))
try? FileManager.default.removeItem(at: SymHandler.getDocumentsDirectory().appendingPathComponent(url.deletingPathExtension().lastPathComponent))
} }
} }
+3 -2
View File
@@ -35,9 +35,10 @@ class SymHandler {
return try createSymlink(to: "/var/mobile/Containers/Data/Application/\(appHash)") return try createSymlink(to: "/var/mobile/Containers/Data/Application/\(appHash)")
} }
static func createDescriptorsSymlink(appHash: String) throws -> URL { static func createDescriptorsSymlink(appHash: String, ext: String) throws -> URL {
// create a symlink directly to the descriptors // create a symlink directly to the descriptors
return try createAppSymlink(for: "\(appHash)/Library/Application Support/PRBPosterExtensionDataStore/61/Extensions/com.apple.WallpaperKit.CollectionsPoster/descriptors") print("linking to \(appHash)/Library/Application Support/PRBPosterExtensionDataStore/61/Extensions/\(ext)/descriptors")
return try createAppSymlink(for: "\(appHash)/Library/Application Support/PRBPosterExtensionDataStore/61/Extensions/\(ext)/descriptors")
} }
static func cleanup() { static func cleanup() {