i have a java method i am trying to call manually

public static native Object a(int i, int i2, long j, String str, Object obj);

whenever i try to call it and pass the needed arguments it raises a error pointer expected the obj parameter is a string list this is the code i tried

var e = ["string1","string2"];
var arr = Java.array('java.lang.String', e);
var x = Java.use("ms.bd.o.k")
x.a.overload('int', 'int', 'long', 'java.lang.String', 'java.lang.Object').call(x, 50331649, 0, 140734272498240, url, arr)

i also tried changing the overload to .overload('int', 'int', 'long', 'java.lang.String', '[java.lang.String') this raises the error below

Error: a(): argument types do not match any of:
        .overload('int', 'int', 'long', 'java.lang.String', 'java.lang.Object')
    at X (frida/node_modules/frida-java-bridge/lib/class-factory.js:563)
    at value (frida/node_modules/frida-java-bridge/lib/class-factory.js:967)
    at e (frida/node_modules/frida-java-bridge/lib/class-factory.js:547)
    at <anonymous> (/script1.js:94)
    at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:12)
    at perform (frida/node_modules/frida-java-bridge/index.js:193)
    at ms_bd_c_h_a (/script1.js:99)
    at apply (native)
    at <anonymous> (frida/runtime/message-dispatcher.js:13)
    at c (frida/runtime/message-dispatcher.js:23)
  • Where do you got the method signature from, are you sure it is correct? And I am not sure how good Frida is able JNi methods (methods that are native).
    – Robert
    Commented Oct 15, 2022 at 23:02
  • @Robert i got the method signature from the code after i decompiled the app i also put a wrong overload and copy pasted the one frida provided
    – ahmed mani
    Commented Oct 16, 2022 at 13:23
  • i think the problem arises from casting the string list to a java.lang.object since its throws the same error as Java.cast(Java.array('java.lang.String', ["a"]), Java.use("java.lang.Object")) Java.array does not returns a pointer and the cast method needs a pointer do you know any way to retrieve the pointer of a array using frida
    – ahmed mani
    Commented Oct 16, 2022 at 13:50
  • This is what I managed to do. But the result is somewhat discouraged. I suggest the author to exchange contacts. Java.perform(function () { var classname = "ms.bd.o.k"; var classmethod = "a"; var methodsignature = "public static native java.lang.Object a(int,int,long,java.lang.String,java.lang.Object)"; var hookclass = Java.use(classname); hookclass.a.overload("int","int","long","java.lang.String","java.lang.Object").implementation = function (v0,v1,v2,v3,v4) { var ret = this.a(v0,v1,v2,v3,v4); console.log(eval(v0)+"\n"); console.log(v1+"\n"); console.log(v2+"\n"); console.log(v3+"\n"); consol
    – Alexsize
    Commented Oct 17, 2022 at 15:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.