4

I'm trying to use Frida (Android 7 device - rooted emulator) according to the JavaScript API.

This is the current code:

Java.perform(function() {
    var x = Java.use('com.x.myCustomClass.util')
    console.log(x.functionIKnowExists) // will return function n() { [ecmascript code] }
}

However, while accessing functions, I get this error:

     ____
    / _  |   Frida 12.6.12 - A world-class dynamic instrumentation toolkit
   | (_| |
    > _  |   Commands:
   /_/ |_|       help      -> Displays the help system
   . . . .       object?   -> Display information about 'object'
   . . . .       exit/quit -> Exit
   . . . .
   . . . .   More info at http://www.frida.re/docs/home/
Attaching...
function n() { [ecmascript code] }

How can I view the actual implementation (decompiled code) of of the function "functionIKnowExists()" instead?

Robert
  • 39,162
  • 17
  • 99
  • 152
  • 1
    AFAIK Frida and the functions you use are designed to hook methods, not to dump the (Java byte) code. If you want to decompile a method process the APK using apktool, Jadx or any other Android decompiler. – Robert Aug 15 '19 at 12:43
  • What can I do with hooks then? –  Aug 15 '19 at 14:39
  • Write your own code and replace the original function with it or execute your code before/after the method is called. You can also print (or change) variables at run-time. – Robert Aug 15 '19 at 14:43
  • How do I print variables in run time? if i may ask here –  Aug 18 '19 at 12:18
  • That depends on the concrete variable, the type... Search here on SO or read the Frida documentation. – Robert Aug 18 '19 at 13:53
  • Read the entire javascript docs and nothing, any chance you can link me somewhere? i just want to print passed variables. –  Aug 18 '19 at 15:31
  • "Just printing" can be quite difficult. Anyway we are here in the comments. Hook the method you want to check the parameter of. Once you have a working example (see other Frida questions as example here on SO) create a new question with a concrete example and a concrete question including the parameter type! – Robert Aug 18 '19 at 15:40

0 Answers0