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.

Obfuscation takes extremely long for large files (12+ hours)

See original GitHub issue

I have a javascript file that’s 24 MB big. In javascript terms, where things like jquery are about 84 KB, I would call my file above average big.

I had not issues running the obfuscation on the same file when it was just 500 KB large and I’ve tested running the program on the same file in both Linux and Windows.

Currently the obfuscation has been going for 12 hours, and is still going. Exactly what it’s doing I don’t know, but it’s eating 50% of my CPU so I know it’s still doing something and when it crashed once before due to Nodejs running out of memory I increased it to 6 GB and so now it’s not crashing but as I said, it’s been 12 hours already…

Here’s the command I used (absolute paths due to my setup): /usr/bin/nodejs /home/$USER/Programs/emsdk/node/4.1.1_64bit/lib/node_modules/javascript-obfuscator/bin/javascript-obfuscator.js MyJavascript.js --output Build/MyJavascript.js --compact true --controlFlowFlattening false --controlFlowFlatteningThreshold 0 --deadCodeInjection true --deadCodeInjectionThreshhold 0.1 --debugProtection true --debugProtectionInterval true --disableConsoleOutput true --log --mangle false --renameGlobals false --rotateStringArray true --selfDefending true --sourceMap false --stringArray true --stringArrayEncoding 'rc4' --unicodeEscapeSequence false --domainLock "https://my.game.com" --sourceMapBaseUrl "https://my.game.com"

Important thing to note here is that I’ve also tried running the obfuscation without any options (the above is for my release version) and it doesn’t seem to make any difference.

Here’s the output it’s showing currently:

[javascript-obfuscator] Obfuscation started...

[javascript-obfuscator] Random generator seed: 229941782...

[javascript-obfuscator] Stage: preparing AST-tree...

[javascript-obfuscator] Stage: analyzing AST-tree...

[javascript-obfuscator] Stage: dead code injection...

[javascript-obfuscator] Stage: obfuscation...

As you can see, it’s stuck at the obfuscation stage.

The source code I’m compiling is an Emscripten compiled file, which is why it’s so large. I’ve had no issues in obfuscating code due to Emscripten, it works fine, the problem is almost definitely related to javascript-obfuscator not handling large files very well. And yes, I know the performance drops from obfuscation and that Emscripten is already very heavy for a browser to handle, but at the very least I want to disable console output, so even if I later on decide the performance drop is too big to do full obfuscation I still want javascript-obfuscator to handle disabling console output.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
sanex3339commented, Dec 13, 2017

Amazing, because i never didn’t test so large files.

1reaction
ghostcommented, Dec 13, 2017

Works like a charm

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is obfuscation and how does it work? - TechTarget
Obfuscation means to make something difficult to understand. Programming code is often obfuscated to protect intellectual property or trade secrets, ...
Read more >
Obfuscated Files or Information, Technique T1027 - Enterprise
ID Name Description G0026 APT18 APT18 obfuscates strings in the payload. G0016 APT29 APT29 has used encoded PowerShell commands. G0050 APT32
Read more >
Shrink, obfuscate, and optimize your app - Android Developers
Enable shrinking, obfuscation, and optimization; R8 configuration files ... is too large, use SYMBOL_TABLE instead of FULL to decrease the file size.
Read more >
What is Data Obfuscation? Definition and Techniques - Talend
Challenges of data obfuscation​​ The biggest challenge is planning, which can eat up a lot of time and resources. Data management is always...
Read more >
Troubleshooting ProGuard issues on Android - Medium
Some developers care about obfuscation more, but for me the main benefit ... In short, ProGuard takes your project's class files as input, ......
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