beautifier / js-beautify

Beautifier for javascript
https://beautifier.io
MIT License
8.63k stars 1.39k forks source link

'$' issues when use javascriptobfuscator_unpacker #1610

Open lovelyelfpop opened 5 years ago

lovelyelfpop commented 5 years ago

Description

Orignal code:

var a = {
    a: '1',
    b: 2,
    currencySymbol: '$',
    c: 3
};

Input

code after obfuscated

var _0xbe98 = ["\x63\x75\x72\x72\x65\x6e\x63\x79\x53\x79\x6d\x62\x6f\x6c", "\x24"];
var a = {};
a['\x61'] = '\x31';
a['\x62'] = 0x2;
a[_0xbe98[0]] = _0xbe98[1];
a['\x63'] = 0x3;

Expected Output

Expecting result as below after unpack

var a = {};
a['\x61'] = '\x31';
a['\x62'] = 0x2;
a['currencySymbol'] = '$';
a['\x63'] = 0x3;

Actual Output

var a = {};
a['\x61'] = '\x31';
a['\x62'] = 0x2;
a['currencySymbol'] = '; //missing $'
a['\x63'] = 0x3;;
a['\x63'] = 0x3; // where is this line come from?

Steps to Reproduce

JavascriptObfuscator.unpack(code)

Reason

The symbol $ is treated as a capture when replace string using RegExp, standalone $ sign should be escaped for this scenario.

immaithil commented 3 years ago

Can I take up this issue

Dhananjay-12 commented 1 year ago

Hi, @bitwiseman is this issue still open?

bitwiseman commented 1 year ago

Yes, it is still open.

N-45div commented 1 year ago

is this issue still open ?