Skip to content

[Feature Request] Obfuscate Global Variables #753

Description

@BlackYuzia

Description

How we know we have global variables like console, window, alert and etc.

If I obfuscate some code, for example:

const date = new Date(); 
let kruzya = 0;
kruzya++;
if (kruzya >= 1) console.log(`${kruzya} is more like 0`, date);  // Output number (1) and timestamp (date)

we get:

const O = ['log', 'ike 0', 'ore l', ' is m'];
(function (j, u) {
    const k = function (C) {
        while (--C) {
            j['push'](j['shift']());
        }
    };
    k(++u);
}(O, -0x1 * -0x10fd + -0x92 + -0xf5b));
const j = function (u, s) {
    u = u - (-0x1 * -0x10fd + -0x92 + -0x106b);
    let E = O[u];
    return E;
};
const u = function (s, E) {
        return j(s - '0x3c8', E);
    },
    date = new Date();
let kruzya = -0x92 + 0x771 + -0x6df;
kruzya++;
if (kruzya >= 0x1c * -0xd1 + -0x92 + 0x176f) console[u('0x3c8')](kruzya + (u('0x3cb') + u('0x3ca') + u('0x3c9')), date);

but some code we didn't obfuscate. For example: new Date(), console etc.
What about obfuscate this too?

Why?
If I have debug in my code user can check by code what exact is wrong or etc.
UPD: Yep, if I just disable console... I can didn't obfuscate console, but what if I really need it?

This is more question like suggestion but ... what about create method to obfuscate global methods and/or variables? 👀

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions