Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

417
Visualizações
Constructing a string array with Frida

I'm trying to call a function with Frida that takes a string array as one of its arguments.

public void coolFunction(long value, String[] strArr);

Within Java it gets called like this:

long importantValue = 4L;
String[] importantArr = new String[]{"TEST"};
coolFunction(importantValue, importantArr);

The overload looks like this: .overload('long', '[Ljava.lang.String;')

I could probably create a string array from scratch, but I don't know how to express it in Javascript. What's the Frida equivalent of new String[]{"TEST"}?

Because of that I tried to turn an ArrayList<String> into a String[], which also wasn't successful.

As far as I can tell there are two simple ways to turn ArrayList<String> into String[]:

Attempt #1:

List<String> list = new ArrayList<String>();
list.add("TEST");
String[] stringArray = list.toArray(new String[0]);

If I try to express it with Javascript it looks like this:

var AL_class = Java.use("java.util.ArrayList");
var arrList = AL_class.$new();
arrList.add("TEST");
var stringArray = arrList.toArray(Java.use("[Ljava.lang.String;").$new(0));

This fails with the following error message:

Error: no supported overloads

Attempt #2:

List<String> list = new ArrayList<String>();
list.add("TEST");
Object[] objectArray = list.toArray();
String[] stringArray = (String[]) objectArray;

Javascript:

var AL_class = Java.use("java.util.ArrayList");
var arrList = AL_class.$new();
arrList.add("TEST");
var arrayButAsObject = arrList.toArray();
var stringArray = Java.cast(arrayButAsObject, "[Ljava.lang.String;");

This fails because it assumes that I want to use Javascript's toArray() function.

The solution to this problem is probably very simple but I've been stuck here for quite a while now and can't seem to figure it out. Any help would be appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Instead of trying to use construct a List and then convert it to an array I would use the Frida function Java.array and directly construct a String array:

var javaStringArray = Java.array('java.lang.String', [ "Test" ]);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda