javascript-obfuscator / gulp-javascript-obfuscator

Gulp plugin for javascript-obfuscator package.
100 stars 38 forks source link

Cannot read property 'validateSync' of undefined and src folder not exist #2

Open miadz opened 7 years ago

miadz commented 7 years ago

gulp.task('task3', function () { return gulp.src('./src/inject/temp2-min.js') .pipe(javascriptObfuscator()) .pipe(concat('temp3-min.js')) .pipe(gulp.dest('./src/inject'));

});

C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\src\index.ts:100 return getFromContainer(Validator).validateSync(schemaNameOrObject as Object, objectOrValidationOptions as ValidatorOptions); ^ TypeError: Cannot read property 'validateSync' of undefined at Object.validateSync (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\src\index.ts:100:43) at new Options (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\javascript-obfuscator\dist\webpack:\src\options\Options.ts:179:55) at Binding.dynamicValue (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\javascript-obfuscator\dist\webpack:\src\container\InversifyContainerFac ade.ts:43:24) at _resolveRequest (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\resolution\resolver.js:39:30) at Object.resolve (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\resolution\resolver.js:65:12) at C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\container\container.js:220:37 at Container._get (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\container\container.js:211:44) at Container.get (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\container\container.js:176:21) at InversifyContainerFacade.get (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\javascript-obfuscator\dist\webpack:\src\container\InversifyCont ainerFacade.ts:99:34) at Function.obfuscate (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\javascript-obfuscator\dist\webpack:\src\JavaScriptObfuscator.ts:24:63)


i check this "gulp-javascript-obfuscator" folder and src not exist. then reinstall 'gulp-javascript-obfuscator' , but again i get that error. i think problem is "utf-8" when reading file.

Wain-PC commented 7 years ago

Hello! It seems like the error comes from the javascript-obfuscator itself, as I don't have the code that throws this error in this package. To prove that, you should run javascript-obfuscator directly from the CLI, using the following command within the directory with your project: javascript-obfuscator ./src/inject/temp2-min.js --output ./src/inject/temp2-obf.js If the issue persists, you should recreate it in that repo. Anyway, please respond here how it goes.

miadz commented 7 years ago

Hi works with cli , But still i can't use with gulp task. (javascript-obfuscator installed globally). I've checked everything. May be a problem from Windows.

Wain-PC commented 7 years ago

Thank you for your response. Would you please provide a code sample that causes the issue? I'll try to reproduce in on my machine. BTW, what gulp version do you use?

Wain-PC commented 7 years ago

Bumping the issue! @miadz Is there any news yet?

miadz commented 7 years ago

Sorry, I was not here for a while. I solved the problem without gulp, but I have problems with that. Also Firefox Crashes at Runtime when i use high obfuscator setting. (cpu usage is high and about 30% in 2core Processor- 2.9GHz)

npm :

+--gulp@3.9.1 +-- gulp-clean@0.3.2 +-- gulp-clean-css@3.0.4 +-- gulp-concat@2.6.1 +-- gulp-copy@1.0.0 +-- gulp-electron@0.1.3 +-- gulp-footer@1.0.5 +-- gulp-header@1.8.8 +-- gulp-javascript-obfuscator@1.1.2 +-- gulp-remove-files@0.0.3 +-- gulp-uglify@2.1.2 +-- gulp-watch@4.3.11 +-- gulp-zip@4.0.0

javascript-obfuscator@0.9.4


t5.js just have one line below

var t = "t";


js_obfuse settting

// high

var js_obfuse = { compact: true, controlFlowFlattening: true, controlFlowFlatteningThreshold: 1, debugProtection: true, debugProtectionInterval: true, disableConsoleOutput: true, rotateStringArray: true, selfDefending: true, stringArray: true, stringArrayEncoding: 'rc4', stringArrayThreshold: 1, unicodeEscapeSequence: false };

gulp task: gulp.task('t5', function () {

 return gulp.src([
             "./src/inject/t5.js"
     ])

 // when i comment the line below every thing works!
  .pipe(gulpjavascriptObfuscator(js_obfuse))

   .pipe(concat('temp3-min.js'))
    .pipe(gulp.dest('./src/inject'));

});


error

$ gulp t5 [15:02:38] Using gulpfile ~\Desktop\extension\gulpfile.js [15:02:38] Starting 't5'...

C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\src\index.ts:100 return getFromContainer(Validator).validateSync(schemaNameOrObject as Object, objectOrValidationOptions as ValidatorOptions); ^ TypeError: Cannot read property 'validateSync' of undefined at Object.validateSync (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\src\index.ts:100:43) at new Options (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\javascript-obfuscator\dist\webpack:\src\options\Options.ts:179:55) at Binding.dynamicValue (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\javascript-obfuscator\dist\webpack:\src\container\InversifyContainerFacade.ts:43:24) at _resolveRequest (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\resolution\resolver.js:39:30) at Object.resolve (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\resolution\resolver.js:65:12) at C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\container\container.js:220:37 at Container._get (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\container\container.js:211:44) at Container.get (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\inversify\lib\container\container.js:176:21) at InversifyContainerFacade.get (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\javascript-obfuscator\dist\webpack:\src\container\InversifyContainerFacade.ts:99:34) at Function.obfuscate (C:\Users\myuser\AppData\Roaming\npm\node_modules\gulp-javascript-obfuscator\node_modules\javascript-obfuscator\dist\webpack:\src\JavaScriptObfuscator.ts:24:63)