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

264
Visualizações
JavaScript array deobfuscation

Solved: Replace array-mapped variables with the actual variable name/string?

I'm trying to decode some JS and I've got a good portion of it done, however, I'm stumped here. The code does something like this:

var arr = ["value", "value1", "value2"];
console.log(arr[0]);

Except the file is around 12k lines and there are over 1.4k things in the array. Is there a way I can replace arr[0] with the actual value of arr[0] (in the example, it would be "value"), then save the file? I tried using RegExp but got nowhere.

Any help will be appreciated.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

A simple idea would be having arrays in current scope and use target javascript file content as input string for replace() method:

var arr = ['hello', 'my', 'world']
var str = `
var arr = ['hello', 'my', 'world']
console.log('arr[2]')
console.log('arr[0]')
console.log('arr[1]')
`
console.log(str.replace(/\b(\w+)\[(\d+)]/g, function(match, $p1, $p2) {
   return window[$p1][$p2];
}))

​

over 4 years ago · Santiago Trujillo 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