question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Obfuscate Global Variables

See original GitHub issue

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? 👀

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
sanex3339commented, Sep 19, 2020

So the suggestion is to transform

new Date()

into

new window['Date']()

After that it can be moved to the strings array

2reactions
sanex3339commented, Sep 20, 2020

Like this idea. Will try to implement it in the feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global variables introduced by obfuscator · Issue #170 - GitHub
I've noticed that enabling some of the obfuscator features (e.g. "stringArray") causes variables to be placed in the global namespace of the ...
Read more >
Global Function for Obfuscating User Names in Query
Hi @All, I want to obfuscate user names in reports. The queries the reports are based on get their data mainly from lists...
Read more >
Variable Name Obfuscation - GDevelop Forum
Would it be possible for Gdevelop to comb through your project and gather variable names (scene variables, global variables, ...
Read more >
Synthetic Monitoring Settings - Datadog Docs
Global variables are variables that are accessible from all your Synthetic tests. They can be used in all single and multistep API tests...
Read more >
Are global variables bad? - c++ - Stack Overflow
The problem with global variables is that since every function has access to these, it becomes increasingly hard to figure out which functions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found