block-toast-with-stacktrace
4 views
0ef0064e...
Description
a simple code that tells you how called for a toast!
How to Use
Download the script and run it with Frida CLI:
Download ScriptThen run with Frida:
frida -U -f YOUR_PACKAGE_NAME -l block-toast-with-stacktrace.js
Replace YOUR_PACKAGE_NAME with the target app's package name.
Source Code
JavaScript
Java.perform(function() {
var Toast = Java.use("android.widget.Toast");
var Thread = Java.use("java.lang.Thread");
var originalMakeText = Toast.makeText.overload('android.content.Context', 'java.lang.CharSequence', 'int');
Toast.makeText.overload('android.content.Context', 'java.lang.CharSequence', 'int').implementation = function(context, text, duration) {
var toastText = text.toString();
if (toastText.includes("امکان باز کردن")) {
console.log("[!] TARGET TOAST CREATED - BLOCKING: " + toastText);
var stackTrace = Thread.currentThread().getStackTrace();
console.log("=== CALL STACK ===");
for (var i = 3; i < Math.min(stackTrace.length, 15); i++) {
var frame = stackTrace[i];
console.log(" -> " + frame.getClassName() + "." + frame.getMethodName());
}
var fakeToast = originalMakeText.call(this, context, text, duration);
fakeToast.show.implementation = function() {
console.log("[!] Blocked target toast from showing: " + toastText);
return;
};
return fakeToast;
}
return originalMakeText.call(this, context, text, duration);
};
console.log("[*] Targeted Toast blocker active for 'امکان باز کردن'");
});
Comments