You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have just started using Frida and I am not very familiar with how to correctly convert or generate data types inscripts. Before submitting an issue, I searched a lot of documents and web pages and could not find more information to solve the problem. Therefore, I have to come here to ask questions. I apologize for any inconvenience caused
Java code :
`
ArrayList<String> list = new ArrayList<>();
list.add("a");
list.add("b");
list.add("c");
list.add("d");
String[] arr = list.toArray(new String[0]);
System.out.println(Arrays.toString(arr)); // --> [Ljava.lang.String;@36d64342 This kind of data is what I need
`
frida script code:
`
var ArrayList = Java.use('java.util.ArrayList');
var String = Java.use('java.lang.String');
var Objects = Java.use('java.lang.Object')
var list = ArrayList.$new();
list.add("a");
list.add("b");
list.add("c");
list.add("d");
// console.log(Objects.$new()); ---> java.lang.Object@7d60079 -> This kind of data is what I need
// console.log(list.toArray(Objects.$new())); ---> Error: toArray(): argument types do not match any of:
// .overload('[Ljava.lang.Object;')
// console.log(Java.cast(list.toArray(),Objects.$new())); ---> Error: expected a pointer
// console.log(list.toArray(String.$new())); --> TypeError: not a function
// console.log(Java.cast(list.toArray(),String)); ---> Error: expected a pointer
// console.log(Java.cast(list.toArray(),String.$new())); ---> expected a pointer
`
I have tried all the methods I know that may have implemented the Java code above in the frida script, but
they have all failed. If anyone knows and can tell me, I would greatly appreciate it!
The text was updated successfully, but these errors were encountered:
Java code :
`
`
frida script code:
`
`
The text was updated successfully, but these errors were encountered: