javascript-obfuscator / javascript-obfuscator/gulp-javascript-obfuscator

Obfuscating going wrong - Not same result always

Open
#34 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
103
Forks
37
PR merge metrics
No merged PRs in 30d

Description

node --version
v10.16.3
"gulp-concat": "~2.3.3",
"gulp-preprocess": "^1.2.0",
"gulp-javascript-obfuscator": "^1.1.2",
The following gulp code is used:

```
var preprocess = require('gulp-preprocess'),
concat = require('gulp-concat'),
javascriptobfuscator = require('gulp-javascript-obfuscator');

gulp.task('app', function() {
return gulp.src('./js/app.js')
.pipe(preprocess({
context: {
HOST: host,
VER: ver
}
}))
.pipe(concat('app.js'))
.pipe(javascriptobfuscator({
reservedStrings:['loadScript','loadCss']
}))
.pipe( gulp.dest('dist/target/js'));
});
```

The following code:
`if(index < scriptFiles.length-1)`

is converted to:
` if (_0x219af0 < _0x441e3a[_0x56ae('0xf')] - 0x1)`

If I step through in Chrome Browser, __0x56ae('0xf')_ is incorrectly equated as '_style_' instead of '_length_'.
If I build it again, it goes fine.
So, it is intermittent. Can somebody point if I am doing anything wrong?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the gulp task shown, especially the ./js/app.js input and generated dist/target/js/app.js, then run the build repeatedly and compare the obfuscated output in Chrome. Done means repeated builds consistently map the length property correctly instead of intermittently producing the style mapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.