Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property renaming #140

Open
doctor8296 opened this issue Sep 11, 2024 · 2 comments
Open

Property renaming #140

doctor8296 opened this issue Sep 11, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@doctor8296
Copy link

That's it we need that xD

@doctor8296 doctor8296 added the enhancement New feature or request label Sep 11, 2024
@doctor8296 doctor8296 changed the title Property redefinitions Property renaming Sep 11, 2024
@MichaelXF
Copy link
Owner

Not planned. Too error-prone. It would most likely struggle with dynamic keys, just like Obfuscator.io's renameProperties (even on 'safe' mode):

// Input
(function () {
    const foo = {
        prop1: 1,
        prop2: 2,
        calc: function () {
            return this.prop1 + this.prop2;
        },
    };

    function doStuffWithFoo(foo) {
        var calc = "cal" + "c";
        console.log(foo[calc]());
    }

    doStuffWithFoo(foo);
})();
// 3

// Output
(function () {
    const _0x1ded56 = {
        '_0x7aa8af': 0x1,
        '_0x204e8e': 0x2,
        '_0x3d83a6': function () {
            return this['_0x7aa8af'] + this['_0x204e8e'];
        }
    };
    function _0x19b102(_0x420ffb) {
        var _0x643b75 = 'cal' + 'c';
        console['log'](_0x420ffb[_0x643b75]());
    }
    _0x19b102(_0x1ded56);
}());
// Uncaught TypeError: _0x18422a[_0x4ce7a3] is not a function

Object Extraction is safe alternative that can be used to rename property names by first converting them to individual variables.

Unless there is a concrete way to safely replace property names then I won't risk adding it. PRs are welcome to implement it.

@Mrgaton
Copy link

Mrgaton commented Oct 2, 2024

if values are static this could be posible if you pre evaluate all string conversions but it woudl be horrible to implement plus if it acces a property from for example a http request or something that is not in the code itself would be imposible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants