"this" reference
How to get and use the "this" parameter from Java
**** NOTE: BLOG MOVED TO https://cmrodriguez.me/ ****
In Java (and a lot of other languages as well) there is always a special variable called this that references the object which is running the method. In Frida, whenever someone is rewriting a method, he has access to the "this" parameter. Check the following script as an example:
In this case the "this" references the class BasicTypes. So by calling the "this.addTwoInts" we are calling the original implementation of the method, instead of reimplementing it. This feature is useful for many use cases as:
know if a method is being called (as shown in the example above)
print the input values to know what is being received by the function.
print the stack trace to know where it is being called.
In all these cases the idea is not to change the workflow of the methods, just trace or debug the functionality.
Last updated