Skip to content

Commit

Permalink
Flag File system
Browse files Browse the repository at this point in the history
  • Loading branch information
c22dev authored Nov 28, 2023
1 parent bb02a9b commit 50b8552
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions TipsGotTrolled/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,25 @@ struct ContentView: View {
Button("Change Tips") {
do {
let documentsDirectoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first

let flagFilePath = documentsDirectoryURL!.appendingPathComponent("_trolled")
if FileManager.default.fileExists(atPath: flagFilePath.path) {
UIApplication.shared.alert(title: "Please delete Tips app then reinstall it before proceeding", body: "⚠️ It looks like your Tips app have been tweaked. Please, delete it from Home Screen and reinstall it from the App Store. A reboot is recommended after reinstalling the Tips app.⚠️", withButton: false)
return
}
if FileManager.default.fileExists(atPath: documentsDirectoryURL!.path().appending("Tips")) {
try AbsoluteSolver.delete(at: documentsDirectoryURL!.appendingPathComponent("Tips"))
}

try AbsoluteSolver.copy(at: URL(fileURLWithPath: ts.getTipsPath()!), to: documentsDirectoryURL!.appendingPathComponent("Tips")) // backup previous binary just in case
try MacDirtyCow.overwriteFileWithDataImpl(originPath: ts.getTipsPath()!, replacementData: Data(contentsOf: Bundle.main.url(forResource: "PersistenceHelper_Embedded", withExtension: "")!))

patched = true
FileManager.default.createFile(atPath: flagFilePath.path, contents: nil, attributes: nil)

UIApplication.shared.alert(title: "Done, READ!!!", body: "⚠️ PLEASE, DO NOT LAUNCH TIPS AFTER INSTALLATION. REBOOT RIGHT NOW, THEN LAUNCH IT! DO NOT RUN Change Tips AGAIN UNLESS YOU UNINSTALLED EVERYTHING! OTHERWISE YOU MIGHT GET A SEMI-BOOTLOOP (BASED ON HAXI0'S EXPERIENCE!). AFTER TROLLSTORE IS INSTALLED AND EVERYTHING IS WORKING, YOU MAY DELETE THIS APP. ⚠️", withButton: false)
} catch {
UIApplication.shared.alert(title: "Error", body: "Error: \(error)")
}
}.disabled(!exploited)
.disabled(patched)
}
} header: {
Label("Hijack Tips", systemImage: "hammer")
} footer: {
Expand Down

0 comments on commit 50b8552

Please sign in to comment.