hook javascript interfaces

by
4 views aa085d9b...

Description

hook javascript interfaces

How to Use

Download the script and run it with Frida CLI:

Download Script

Then run with Frida:

frida -U -f YOUR_PACKAGE_NAME -l hook-javascript-interfaces.js

Replace YOUR_PACKAGE_NAME with the target app's package name.

Source Code

JavaScript
	Java.perform(function() {

	    var webView = Java.use('android.webkit.WebView');
	    var webSettings = Java.use('android.webkit.WebSettings');
	    webSettings.setJavaScriptEnabled.implementation = function(allow) {
	        console.log('[!] Java Script Enabled:' + allow);
	        return this.setJavaScriptEnabled(allow);

	    }
	    webView.addJavascriptInterface.implementation = function(object, name) {
	        console.log('[i] Javascript interface detected:' + object.$className + ' instatiated as: ' + name);
	        this.addJavascriptInterface(object, name);
	    }


	    webView.evaluateJavascript.implementation = function(script, resultCallback) {
	        console.log('WebView Client: ' + this.getWebViewClient());
	        console.log('[i] evaluateJavascript called with the following script: ' + script);
	        this.evaluateJavascript(script, resultCallback);
	    }
	    webView.removeJavascriptInterface.implementation = function(name) {
	        console.log('The ' + name + ' Javascript interface removed');
	        this.removeJavascriptInterface(name);
	    }
	});
Share this script:
Twitter LinkedIn

Comments

Login or Sign up to leave a comment.
Loading comments...