Javascript-obfuscator: Transform object keys broke getter property

Created on 14 Aug 2020  路  3Comments  路  Source: javascript-obfuscator/javascript-obfuscator

Expected Behavior

Preserve the get syntax semantic.

Current Behavior

The getter property converted to function when --transform-object-keys true enabled.

Steps to Reproduce


Obfuscate the following source code

"use strict";
const agents = {
    get http() {
        return 'http';
    },
    get https() {
        return 'https';
    },
};

by cli command line

javascript-obfuscator lib/http/test.js --output lib/http/test.bin.js --compact false --transform-object-keys true

got the following output

const a0_0x3677 = [
    'http',
    'https'
];
(function (_0x257c1e, _0x3677f0) {
    const _0x414abf = function (_0x31802c) {
        while (--_0x31802c) {
            _0x257c1e['push'](_0x257c1e['shift']());
        }
    };
    _0x414abf(++_0x3677f0);
}(a0_0x3677, 0x101));
const a0_0x414a = function (_0x257c1e, _0x3677f0) {
    _0x257c1e = _0x257c1e - 0x0;
    let _0x414abf = a0_0x3677[_0x257c1e];
    return _0x414abf;
};
'use strict';
const a0_0x2057e1 = {};
a0_0x2057e1[a0_0x414a('0x1')] = function () {
    return a0_0x414a('0x1');
}, a0_0x2057e1[a0_0x414a('0x0')] = function () {
    return a0_0x414a('0x0');
};
const agents = a0_0x2057e1;

Your Environment

  • Obfuscator version used: 1.10.0_2020-08-13T23:26:38.945Z
  • Node version used: v14.8.0
bug high priority

All 3 comments

Released as 1.10.1

It works now! Many thanks! 馃憤

Was this page helpful?
0 / 5 - 0 ratings