1

I have the following class (got this code via jadx)

package e.u.e.a.c;

public final class a implements AnalyticsConfig {

    public static final String f21227a;
    public static String f21231e;

    //.......
}

and I want to get the values of theses two static variables using Frida.

I have tried this

Java.perform(function x() { 

        var Test = Java.use("e.u.e.a.c.a");
        console.log( Test.f21227a.value );

});

but getting the following error.

TypeError: cannot read property 'value' of undefined

Edit:

I used this script to get the methods and class fields and that worked fine. I got the name of variables as

public static final java.lang.String e.u.e.a.c.a.a
public static java.lang.String e.u.e.a.c.a.d

but still I can't figure out how to get the actual runtime value of those variables.

john
  • 2,324
  • 3
  • 20
  • 37

1 Answers1

11

jadx deobfuscates variable names to make code readable. You have to use original name of member to access it.

So you need to use names "a" and "d" to access those variables:

Java.perform(function x() { 
        var Test = Java.use("e.u.e.a.c.a");
        console.log( Test.a.value );
        console.log( Test.d.value );
});

and If we have methods with the same name as class field, then we need _ before variable name to get its value

Java.perform(function x() { 
        var Test = Java.use("e.u.e.a.c.a");
        console.log( Test._a.value );
        console.log( Test._d.value );
});
john
  • 2,324
  • 3
  • 20
  • 37
Maxim Sagaydachny
  • 2,098
  • 3
  • 11
  • 22
  • I used frida script to deobfuscated them, here are the values. "public static final java.lang.String e.u.e.a.c.a.a", "public static java.lang.String e.u.e.a.c.a.c" still can't figure out how to get their values – john Nov 21 '19 at 09:00
  • Used this code https://github.com/frida/frida-java-bridge/issues/44#issuecomment-485746731 to get the name of methods and variables. It works perfectly but I need value of those variables. – john Nov 21 '19 at 09:04
  • If I use .value with that script i-e return f.toString().value , I just get null values for all variables – john Nov 21 '19 at 09:05
  • Thanks for your kind help. Still not working. I am getting "undefined" for all variables even though some of them have hardcoded values. – john Nov 21 '19 at 09:40
  • Got it. Actually the problem was there was a method with the same name. So, I need to use _a to get the value of the variable. Appreciate your help :) – john Nov 21 '19 at 09:50