mikrofusion / gulp-obfuscate

gulp plugin to obfuscate your code using gulp-regex-replace
MIT License
366 stars 40 forks source link

Obfuscator brakes the code #6

Open LKay opened 9 years ago

LKay commented 9 years ago

Obfuscator brakes working code after processing and not working correctly with gulp-sourcemaps. My task looks like the following:

return gulp.src(paths.src.js)
        .pipe(gulpif((process.env.ENV !== "production"), sourcemaps.init()))
            .pipe(concat("all.js"))
            .pipe(obfuscate({
                replaceMethod: obfuscate.ZALGO
            }))
            .pipe(uglify())
        .pipe(gulpif((process.env.ENV !== "production"), sourcemaps.write()))
        .pipe(gulp.dest(paths.dist.js));

Uglify is optional of course and the same thing happens without it. First of all sourcemaps are not supported, but it's not the most important case.

There are a lot of broken code reporting errors such as undefined is not a function or cannot access property of undefined. For example this happens for Object.keys method and other core javascript methods as well as global variables and variables inside clojures. Tried to add such keywords to exclude but can't get rid of all errors.

daldegam commented 9 years ago

+1

gondo commented 8 years ago

same here. one example for all: function test(){} alert('test') is changed to functionಠ_ಠ727() {} alert("ಠ_ಠ727") as you can see, string inside alert was changed because there was a function named test. correct output should be alert('test') (its the same with single or double quotes) also a space between function and a changed function name ಠ_ಠ727 was removed. correct output should be function ಠ_ಠ727() {}

nmors commented 8 years ago

+1

koox00 commented 8 years ago

This also breaks an AngularJS application. Meaning: [ "$http", function($http) { has to always be: [ "$http", function( ಠ_ಠ727 ) { instead of: [ "ಠ_ಠ727", function( ಠ_ಠ727 ) {

dangquang1020 commented 8 years ago

The same issue, seems the owner is no longer developing it.

360disrupt commented 7 years ago

The same with nodejs module.exports gets broken. I use gulp-uglify which worked for me.

ronaldohoch commented 7 years ago

it still happening?

ghost commented 6 years ago

Same problems for me, changing the replaceMethod: obfuscate.ZALGO is giving me errors also.