How to restore obfuscated property names?

后端 未结 1 489
星月不相逢
星月不相逢 2020-11-27 08:23

So I\'m decrypting a javascript code, and after long time of looking on the internet I have no clue on how to decrypt this a quick way.

The code starts off with a la

相关标签:
1条回答
  • 2020-11-27 09:03

    A simple regex replace will do:

    var _$_21e2 = ["jQuery", "userAgent", "test", "onmouseup", "onmousemove", "pink", "greenyellow", "gold"];
    return code.replace(/\[_\$_21e2\[(\d+)\]\]/g, function(_, i) {
        return "."+_$_21e2[i];
    }).replace(/_\$_21e2\[(\d+)\]/g, function(_, i) {
        return JSON.stringify(_$_21e2[i]);
    });
    

    Given the code as a string, this will yield a code string with human-readable property names and literals.

    0 讨论(0)
提交回复
热议问题