Change let to var in Frida script#2527
Conversation
|
Some days ago this problem was already addressed by PR #2525. It removed the duplicate class declarations. |
|
@jpstotz I saw that, but it only removes duplicates when you export multiple functions at the same time. With So scenario:
EDIT Java.use("com.google.android.material.appbar.AppBarLayout$BaseBehavior$a$a")["createFromParcel"].overload('android.os.Parcel', 'java.lang.ClassLoader').implementation = function (parcel, classLoader) {
console.log(`C0049a.createFromParcel is called: parcel=${parcel}, classLoader=${classLoader}`);
let result = this["createFromParcel"](parcel, classLoader);
console.log(`C0049a.createFromParcel result=${result}`);
return result;
}; |
|
Using
|
|
I still think var makes sense since the full classname is used as the variable name, so it would be weird if any other value is assigned to it other than a Frida reference to that class. So the choice is between:
|
|
Well, I agree, that |
Description
When generating Frida hooks, the generated scripts use 'let' for the class reference. Since you're typically prototyping different hooks and copy/pasting the hooks into your script, these let statements clash. Using
varinstead ofletfor the class definition fixes this.Alternatively we could wrap the generated code in a code block, but this var approach makes more sense to me.