Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
miadz opened this issue Apr 2, 2017 · 5 comments

Comments

@miadz
Copy link

miadz commented Apr 2, 2017

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.

@miadz miadz changed the title src folder Cannot read property 'validateSync' of undefined and src folder not exist Apr 2, 2017
@Wain-PC
Copy link
Contributor

Wain-PC commented Apr 7, 2017

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
Copy link
Author

miadz commented Apr 8, 2017

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
Copy link
Contributor

Wain-PC commented Apr 10, 2017

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
Copy link
Contributor

Wain-PC commented Apr 18, 2017

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

@miadz
Copy link
Author

miadz commented Jul 21, 2017

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 :

[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]

[email protected]


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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants