iOS openURL
4 views
17276ebd...
Description
Frida iOS script that hooks both - openURL: and - openURL:options:completionHandler: and prints the opened URLs.
How to Use
Download the script and run it with Frida CLI:
Download ScriptThen run with Frida:
frida -U -f YOUR_PACKAGE_NAME -l ios-openurl.js
Replace YOUR_PACKAGE_NAME with the target app's package name.
Source Code
JavaScript
if (ObjC.available) {
var UIApplication = ObjC.classes.UIApplication;
function tryAttach(methodName, label) {
var m = UIApplication[methodName];
if (!m) {
console.log('[*] ' + methodName + ' not found on UIApplication');
return;
}
Interceptor.attach(m.implementation, {
onEnter: function(args) {
try {
// args[0] = self, args[1] = _cmd, args[2] = NSURL *
if (args[2].isNull()) {
console.log(label + ' called with NULL url');
return;
}
var url = new ObjC.Object(args[2]);
// absoluteString is the most reliable readable form
var s = (typeof url.absoluteString === 'function') ? url.absoluteString().toString() : url.toString();
console.log(label + ' -> ' + s);
} catch (e) {
console.log(label + ' -> error reading url: ' + e);
}
}
});
console.log('[*] Attached to UIApplication ' + methodName);
}
tryAttach('- openURL:', '[openURL:]');
tryAttach('- openURL:options:completionHandler:', '[openURL:options:completionHandler:]');
} else {
console.log('Objective-C runtime is not available!');
}
Comments