Last active
September 10, 2024 15:52
-
-
Save miticollo/27eab97ad313f0cdce504562dcdce3b9 to your computer and use it in GitHub Desktop.
frida-swift-bridge: first attempt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GRDB_PATH: string = Process.enumerateModules().find((x: Module): boolean => x.name === "GRDB")!.path; | |
declare let Swift: any; | |
if (Swift.available) { | |
// Tested on iOS 14.4.2 and iOS 15.1b1. | |
const mangled: string = "$s4GRDB8DatabaseC13usePassphraseyy10Foundation4DataVKF"; | |
const demangled: NativePointer = Swift.api.swift_demangle(Memory.allocUtf8String(mangled), mangled.length, NULL, NULL, 0); | |
console.log(`Function hooked: ${demangled.readUtf8String()}`); | |
const listener = Interceptor.attach(Module.getExportByName(GRDB_PATH, mangled), { | |
onEnter(args) { | |
const passphrase = new Swift.Object(args[1]); | |
const description = passphrase.$metadata.getDescription(); | |
console.log(JSON.stringify(Swift.modules[description.getModuleContext().name].classes[description.name]["$fields"], null, 4)); | |
console.log(passphrase.$fields); | |
listener.detach(); | |
}, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment