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

Syntax error with ES6 shorthand properties #16

Closed
ralfstx opened this issue Sep 23, 2016 · 5 comments
Closed

Syntax error with ES6 shorthand properties #16

ralfstx opened this issue Sep 23, 2016 · 5 comments
Labels

Comments

@ralfstx
Copy link

ralfstx commented Sep 23, 2016

The following input file (test.js) contains shorthand properties:

let a = 23;
let b = 42;
exports.o = {a, b};

Node.js can handle them:

$ node --version
v6.6.0
$ node
> require('./test.js')
{ o: { a: 23, b: 42 } }

However, loading the obfuscated file raises a syntax error:

$ javascript-obfuscator test.js --output obfuscated.js
$ node
> require('./obfuscated.js')
/home/ralf/git/test/obfuscated.js:1
(function (exports, require, module, __filename, __dirname) { var _0x8065=['\x6a\x6f\x69\x6e','\x73\x70\x6c\x69\x74'];(function(_0x18a2d3,_0x168483){var _0x427e21=function(_0x18c5bd){while(--_0x18c5bd){_0x18a2d3['\x70\x75\x73\x68'](_0x18a2d3['\x73\x68\x69\x66\x74']());}};(function(){var _0x655c94=function(){return'\x64\x65\x76';};!Function('\x72\x65\x74\x75\x72\x6e\x2f\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d\x2f')()['\x74\x65\x73\x74'](_0x655c94['\x74\x6f\x53\x74\x72\x69\x6e\x67']())?[]['\x66\x69\x6c\x74\x65\x72']['\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72']((+0x20)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x21)+(+0x65)['\x74\x6f\x53\x74\x72\x69\x6e\x67'](0x15)[0x1]+([![]]+undefined)[0xa]+(![]+'')[0x2]+(!![]+'')[0x3]+'\x28\x74\x72\x75\x65\x29\x7b\x7d')():Function('\x61','\x62','\x61\x28\x2b\x2b\x62\x29')(_0x427e21,_0x168483)?[]['\x66\x69\x6c\x74\x65\x72']['\x63\x6f\x6e\
SyntaxError: Unexpected token ,

After replacing the shorthand properties in test.js with {a: a, b: b}, things work fine.

@sanex3339 sanex3339 added the bug label Sep 23, 2016
@sanex3339
Copy link
Member

sanex3339 commented Sep 23, 2016

As i understand, i should convert shortland object expression to full object expression.

@sanex3339
Copy link
Member

sanex3339 commented Sep 23, 2016

I pushed fix to the master branch.
b862c3f

Please, temporary add this branch to you package.json, update version and say - problem was fixed or not? If yes - i will publish 0.7.2 version to npm.

@ralfstx
Copy link
Author

ralfstx commented Sep 25, 2016

With git://github.com/sanex3339/javascript-obfuscator.git#master, I cannot reproduce the problem anymore. Thanks!

@sanex3339
Copy link
Member

Nice, i should fix strange decreasing of tests code coverage and then i will release it on npm

@sanex3339
Copy link
Member

0.7.2 is out. Now - its time to fix and update plugin for webpack.

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

No branches or pull requests

2 participants