Skip to content

Instantly share code, notes, and snippets.

@o0xmuhe
Created September 8, 2023 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save o0xmuhe/98299328206820d2c55a7f44d300cdc0 to your computer and use it in GitHub Desktop.
Save o0xmuhe/98299328206820d2c55a7f44d300cdc0 to your computer and use it in GitHub Desktop.
enable system webview debug and append js flags to system webview, works on Pixel3, enjoy!
Java.perform(function() {
var Webview = Java.use("android.webkit.WebView")
Webview.loadUrl.overload("java.lang.String").implementation = function(url) {
console.log("[+]Loading URL from", url);
this.setWebContentsDebuggingEnabled(true);
this.loadUrl.overload("java.lang.String").call(this, url);
}
});
// var dlopen_addr = Module.findExportByName(null, 'dlopen');
var android_dlopen_ext_addr = Module.findExportByName(null, 'android_dlopen_ext');
if(android_dlopen_ext_addr){
Interceptor.attach(android_dlopen_ext_addr, function (args) {
if(args[0].readCString().endsWith('libmonochrome.so')){
console.log("[+]I see you....");
Java.perform(function () {
Java.enumerateClassLoaders({
onMatch: function (loader) {
try {
if(loader.findClass("org.chromium.base.CommandLine")){
console.log("[+]Successfully found loader")
console.log(loader);
Java.classFactory.loader = loader;
let CommandLine = Java.use("org.chromium.base.CommandLine");
CommandLine.nativeInit.implementation = function(...args){
this.nativeInit(...args);
this.nativeAppendSwitchWithValue("--js-flags", "--allow-natives-syntax");
}
}
}
catch(error){
console.log("[!]Find error:" + error)
}
},
onComplete: function () {
console.log("[+]onComplete");
}
});
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment