javascript-obfuscator icon indicating copy to clipboard operation
javascript-obfuscator copied to clipboard

Version: 4.0.0. Error: Evaluation failed: ReferenceError: _0x5b9d0e is not defined with config stringArray: true

Open HomerQing opened this issue 3 years ago • 12 comments

javascript-obfuscator version: 4.0.0

stringArray: true will cause this error, UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: _0xa28d is not defined

config:

{
       "compact": true,
}

run code sussessed after added stringArray: false to config.

Code:

const puppeteer = require('puppeteer-core');

let params = {
  ignoreHTTPSErrors: true,
  args: [
    '--ignore-certificate-errors',
    '--no-sandbox',
  ],
  executablePath: this.chromePath,
  headless: true,
};
const browser = await puppeteer.launch(params);

var page = await browser.newPage();
await page.goto(this.url, { waitUntil: 'load' });
await page.content();       ----------------------- error in this line
await page.setViewport({ width: 1600, height: 1200 });
await page.waitForTimeout(2000);

Error info:

(node:22648) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: _0xa28d is not defined
    at __puppeteer_evaluation_script__:1:21
    at _0x1ce9f4._evaluateInternal (E:\xx\dist\bundle.js:1:3355462)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async _0x1ce9f4.evaluate (E:\xx\dist\bundle.js:1:3353310)
    at async _0x23b99f.content (E:\xx\dist\bundle.js:1:3400665)
    at async _0x14d154.content (E:\xx\dist\bundle.js:1:3508435)
    at async _0x571581.getContentInaSinglePage (E:\xx\dist\bundle.js:1:4423286)
    at async _0x508402.isInteresting (E:\xx\dist\bundle.js:1:4622902)
    at async _0x508402.startScan (E:\xx\dist\bundle.js:1:4641280)
    at async _0x421a37.scan (E:\xx\dist\bundle.js:1:4643371)
    at async E:\xx\dist\bundle.js:1:4970734

I'm not sure if it's something I'm using wrong or a BUG.

HomerQing avatar Jun 15 '22 05:06 HomerQing

I am getting a similar problem randomly (not always) and at different points of code while using gulp-javascript-obfuscator to prepare our code.

I am using the following in gulpfile.js

const javascriptObfuscator = require('gulp-javascript-obfuscator');

gulp.src(['app/scripts/**/*.js']) .pipe(javascriptObfuscator({ compact: true }));

A few points to notice are...

  1. It breaks the code sometimes, not always.
  2. It is not breaking the same file/or piece of code, rather it breaks on file or other dynamically.
  3. If I prepare the code again then it works.
  4. I never noticed it breaking on my Mac, but on the CentOS server, we face this issue very often.

The error looks like below (One example):

Uncaught TypeError: Cannot read properties of undefined (reading '12') at _0x13b6 (utility.js:1:49938) at _0x13b6 (utility.js:1:49969) at utility.js:1:70153 at dispatch (jquery.js:4435:9) at jquery.js:4121:28

Any suggestions/help will be appreciated.

satinder1208 avatar Jun 19 '22 09:06 satinder1208

Have you found any fix for this? I am having this same issue.

RusstyCrussty123 avatar Jun 23 '22 19:06 RusstyCrussty123

I switched from

gulp-javascript-obfuscator
javascript-obfuscator

to other obfuscation module

gulp-js-obfuscator
js-obfuscator

and no issues so far.

.

satinder1208 avatar Jun 23 '22 19:06 satinder1208

I am having this same issue. on the CentOS server ,sometimes some js files => Cannot read properties of undefined

liyanglin avatar Jun 28 '22 03:06 liyanglin

I really need a fix for this. Any more news?

RusstyCrussty123 avatar Jun 30 '22 20:06 RusstyCrussty123

Hi. Right now i dont't have time to work on this project. But PR welcomed (with tests, etc)

sanex3339 avatar Jul 01 '22 06:07 sanex3339

I haven't try js-obfuscator, but looks like it will upload the code to the cloud

HomerQing avatar Jul 01 '22 07:07 HomerQing

no update, I'm still using stringArray: false 😟 ,and expecting a helpful reply.

HomerQing avatar Jul 01 '22 07:07 HomerQing

i has the same problem,in 4.0.0version javascript-obfuscator

ReferenceError: hz_904_0x57ff is not defined

k713927 avatar Jul 26 '22 03:07 k713927

I switched from

gulp-javascript-obfuscator javascript-obfuscator

to other obfuscation module

gulp-js-obfuscator js-obfuscator

and no issues so far.

.

I can confirm after using the other module for over a month that I never encountered that issue in this package.

satinder1208 avatar Jul 26 '22 03:07 satinder1208

I ran into the same issue. It turned out that the reason was that options.identifiersPrefix needs a different value for each file you are obfuscating.

Also see here: https://github.com/javascript-obfuscator/javascript-obfuscator/issues/568

In my case it was the https://github.com/javascript-obfuscator/grunt-contrib-obfuscator Grunt plugin which didn't properly generate those prefixes, I created a PR there (https://github.com/javascript-obfuscator/grunt-contrib-obfuscator/pull/41) but also a new Grunt plugin (npmjs.com/package/grunt-contrib-obfuscator-4 )

softworkz avatar Jun 29 '23 23:06 softworkz