frida / frida-java-bridge

Java runtime interop from Frida
318 stars 116 forks source link

There is any way to access instance variable within a hooked method ? #8

Closed GuilhermeFM closed 7 years ago

GuilhermeFM commented 7 years ago

There is any way to access instance variable within a hooked method ?

Java class Example:

public class TestClass {
      public int a;
      private int c;
      protected int d;

      public void methodTest() {
            ......
      }
}

Javacript Hooker:

if (Java.available) {
    Java.perform(function () {
        var module = Java.use("com.package.TestClass");
        module.TesteClass.implementation = function() {
            send("vars => " + this.a + " " + this.b + " " + this.d );   
        };   
    });
}
else {
    send("Not ready")
}
oleavr commented 7 years ago

Use this.a.value. Cheers!