I wrote a script to bypass root detection in an android app. I run the following command to access the script frida -U --runtime=v8 -f com.app.example -l "C:\Users\rosha\frida.js"
but get the following error
ReferenceError: require is not defined
at C:\Users\obb\frida.js:2:13
at /frida/repl-2.js:1:8
Below is my script `
var Frida = require("frida");
var Process = Frida.Process;
function bypassRootDetection() {
var RootDetectorClass = Java.use("com.axisidp.mobile.setOnSwipeItemClickListener");
Device.setTargetElevation.implementation = function() {
return false;
}
}
Process.enumerateModules()
.then(function(modules) {
var targetModule = modules.find(function(m) {
return m.name === "cris.icms.ntes";
});
return Process.attach(targetModule.pid);
})
.then(function(process) {
Frida.getScript(bypassRootDetection)
.then(function(script) {
script.load();
})
.catch(function(error) {
console.error("Error injecting script:", error);
});
})
.catch(function(error) {
console.error("Error attaching to process:", error);
});
Please guide.
The script should bypass the root detection.