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

Not working in IE #14

Closed
Luperi opened this issue Sep 1, 2016 · 32 comments
Closed

Not working in IE #14

Luperi opened this issue Sep 1, 2016 · 32 comments

Comments

@Luperi
Copy link

Luperi commented Sep 1, 2016

I have this sample code:

function hello() {
    alert('hello');
    var try= 'a';
    try= 'hi';
}

function load() {
    console.log('welcome!');
}

I'm using the CLI in this way:

javascript-obfuscator library.js --output ohoh.min.js --sourceMap true --disableConsoleOutput false

This simple HTML does not work in IE, whatever version...

<!DOCTYPE html>
<html>
    <head>
        <script type="text/javascript" src="ohoh.min.js"></script>
    </head>

    <body onload="load();">
        <button onclick="hello();">
            click me
        </button>
    </body>
</html>

...getting this error:

image

In both Google Chrome and Firefox is ok.
Thank you.

@sanex3339
Copy link
Member

At first - try is the reserved word in JavaScript, you shouldn't name variables with this name.

@sanex3339
Copy link
Member

sanex3339 commented Sep 1, 2016

i got error - looking into that

@sanex3339
Copy link
Member

found error, finding way to fix it

@Luperi
Copy link
Author

Luperi commented Sep 1, 2016

Great! :)

Il giovedì 1 settembre 2016, Timofey Kachalov notifications@github.com ha
scritto:

found error, finding way to fix it


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEaUEPP3hex4jE5LGodBi1-qt1sZDYFuks5qlyWDgaJpZM4Jy0xE
.

sanex3339 added a commit that referenced this issue Sep 1, 2016
@sanex3339 sanex3339 reopened this Sep 1, 2016
@sanex3339
Copy link
Member

sanex3339 commented Sep 1, 2016

Fixed in 0.7.1

@Luperi
Copy link
Author

Luperi commented Sep 2, 2016

@sanex3339 in my original code I have "prova" instead of "try", I've translated italian named vars here for more clarity :)
Thanks a lot.

@sanex3339
Copy link
Member

You haven't error after fix?

@Luperi
Copy link
Author

Luperi commented Sep 2, 2016

I'm using your code with CLI on Windows, installed with NPM command.
Do I have to update it with this code?

npm update javascript-obfuscator

If so, it doesn't work yet.

@sanex3339
Copy link
Member

better use npm i javascript-obfuscator@0.7.1

@sanex3339 sanex3339 reopened this Sep 2, 2016
@Luperi
Copy link
Author

Luperi commented Sep 2, 2016

Have you found the error?

@sanex3339
Copy link
Member

sanex3339 commented Sep 2, 2016

with 0.7.1 you still getting the same error? with same message?

@Luperi
Copy link
Author

Luperi commented Sep 2, 2016

Yes

@sanex3339
Copy link
Member

sanex3339 commented Sep 2, 2016

strange. ok, i will look into this later.

@Luperi
Copy link
Author

Luperi commented Sep 2, 2016

Have you tryed yourself?

@sanex3339
Copy link
Member

yep, yesterday after fix the error was missing

@sanex3339
Copy link
Member

sanex3339 commented Sep 2, 2016

I tested with this code

var _0x14e3=['\x77\x65\x6c\x63\x6f\x6d\x65\x21','\x68\x69','\x6c\x6f\x67'];(function(_0x13a6ac,_0x1d9124){var _0x29b8a0=function(_0x4bb58c){while(--_0x4bb58c){_0x13a6ac['\x70\x75\x73\x68'](_0x13a6ac['\x73\x68\x69\x66\x74']());}};(function(){var _0xc24bf1=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'](_0xc24bf1['\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')(_0x29b8a0,_0x1d9124)?[]['\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\x66\x61\x6c\x73\x65\x29\x7b\x7d')():[]['\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\x66\x61\x6c\x73\x65\x29\x7b\x7d')();}());}(_0x14e3,0xc1));var _0x2c40=function(_0x53f211){return _0x14e3[parseInt(_0x53f211,0x010)];};function hello(){alert('\x68\x65\x6c\x6c\x6f');var _0x36b7e8='\x61';_0x36b7e8=_0x2c40('0x0');}function load(){console[_0x2c40('0x1')](_0x2c40('0x2'));}(function(){var _0x1ee365=function(){return'\x64\x65\x76';},_0x301aec=function(){return'\x77\x69\x6e\x64\x6f\x77';};!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'](_0x1ee365['\x74\x6f\x53\x74\x72\x69\x6e\x67']())?Function('\x72\x65\x74\x75\x72\x6e\x2f\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b\x2f')()['\x74\x65\x73\x74'](_0x301aec['\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\x66\x61\x6c\x73\x65\x29\x7b\x7d')():[]['\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')():[]['\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\x66\x61\x6c\x73\x65\x29\x7b\x7d')();}());hello();load();

Everything is OK.
Try to remove node_modules/javascript-obfuscator and install again

@sanex3339
Copy link
Member

Show me your obfuscated code

@Luperi
Copy link
Author

Luperi commented Sep 2, 2016

var _0x23eb=['\x6c\x6f\x67','\x62\x65\x6e\x76\x65\x6e\x75\x74\x6f\x21','\x63\x69\x61\x6f','\x61'];(function(_0x276de8,_0x211059){var _0x5db4a3=function(_0x3c66e9){while(--_0x3c66e9){_0x276de8'\x70\x75\x73\x68';}};(function(){var _0x5a3298=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'?[]['\x66\x69\x6c\x74\x65\x72']'\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72'():Function('\x61','\x62','\x61\x28\x2b\x2b\x62\x29')(_0x5db4a3,_0x211059)?[]['\x66\x69\x6c\x74\x65\x72']'\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72'():[]['\x66\x69\x6c\x74\x65\x72']'\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72'();}());}(_0x23eb,0xfe));var _0x3e42=function(_0xbc90c9){return _0x23eb[parseInt(_0xbc90c9,0x010)];};(function(){var _0x3517a1=function(){return'\x64\x65\x76';},_0x39dac5=function(){return'\x77\x69\x6e\x64\x6f\x77';};!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'?Function('\x72\x65\x74\x75\x72\x6e\x2f\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b\x2f')()'\x74\x65\x73\x74'?[]['\x66\x69\x6c\x74\x65\x72']'\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72'():[]['\x66\x69\x6c\x74\x65\x72']'\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72'():[]['\x66\x69\x6c\x74\x65\x72']'\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f\x72'();}());function salutami(){alert(_0x3e42('0x0'));var _0x4bf6b0=_0x3e42('0x1');_0x4bf6b0='\x63\x69\x61\x6f';}function load(){console_0x3e42('0x2');}
//# sourceMappingURL=ohoh.min.js.map

@sanex3339
Copy link
Member

sanex3339 commented Sep 2, 2016

it is your code instantly after obfuscation? because it is wrong code.
_0x276de8'\x70\x75\x73\x68'; for example.
or {console_0x3e42('0x2');}

@Luperi
Copy link
Author

Luperi commented Sep 2, 2016

Yes shure, I'm generating it by CLI interface on Windows 10. You?

@sanex3339
Copy link
Member

sanex3339 commented Sep 2, 2016

Mac OS. Here my code after CLI with same input source code and same CLI arguments:

var _0x1cc8=['\x68\x69','\x6c\x6f\x67','\x77\x65\x6c\x63\x6f\x6d\x65\x21','\x68\x65\x6c\x6c\x6f','\x61'];(function(_0x3af426,_0x2e7ad2){var _0x16f240=function(_0x126d11){while(--_0x126d11){_0x3af426['\x70\x75\x73\x68'](_0x3af426['\x73\x68\x69\x66\x74']());}};(function(){var _0x4ed02c=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'](_0x4ed02c['\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')(_0x16f240,_0x2e7ad2)?[]['\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\x66\x61\x6c\x73\x65\x29\x7b\x7d')():[]['\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\x66\x61\x6c\x73\x65\x29\x7b\x7d')();}());}(_0x1cc8,0x143));var _0x5d39=function(_0xc9b54a){return _0x1cc8[parseInt(_0xc9b54a,0x010)];};(function(){var _0x1c53b9=function(){return'\x64\x65\x76';},_0x3b032f=function(){return'\x77\x69\x6e\x64\x6f\x77';};!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'](_0x1c53b9['\x74\x6f\x53\x74\x72\x69\x6e\x67']())?Function('\x72\x65\x74\x75\x72\x6e\x2f\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b\x2f')()['\x74\x65\x73\x74'](_0x3b032f['\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\x66\x61\x6c\x73\x65\x29\x7b\x7d')():[]['\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')():[]['\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\x66\x61\x6c\x73\x65\x29\x7b\x7d')();}());function hello(){alert(_0x5d39('0x0'));var _0x2edfec=_0x5d39('0x1');_0x2edfec=_0x5d39('0x2');}function load(){console[_0x5d39('0x3')](_0x5d39('0x4'));}
//# sourceMappingURL=ohoh.min.js.map

@Luperi
Copy link
Author

Luperi commented Sep 8, 2016

In my opinion the problem should be Windows.
How can I encrypt my code in a different way? Thank you.

@sanex3339
Copy link
Member

I have no idea how windows can affects on code generation with escodegen

@Luperi
Copy link
Author

Luperi commented Sep 8, 2016

I'm trying to use it on "bash on windows 10". I've successfully installed the library, but when I run it, I get this error:

image

is it a library problem?

@sanex3339
Copy link
Member

It's is not a obfuscator problem. What node version you use? I tested on 0.12+

@Luperi
Copy link
Author

Luperi commented Sep 8, 2016

0.12.15

@sanex3339
Copy link
Member

on 0.12.15 everything should be ok, look at travis-ci log
https://travis-ci.org/sanex3339/javascript-obfuscator/jobs/156909203

@Luperi
Copy link
Author

Luperi commented Sep 8, 2016

Ok, the problem was "bash on Windows 10" feature.
I've installed Ubuntu in Virtual Box, installed NodeJS, npm and javascript-obfuscator.
After that, i've obfuscated the same code above, and it's working correctly on both Chrome and IE.

It's a pity that I must use Ubuntu VM to obfuscate my code.
Anyway, thank you very much for your kind support!

@sanex3339
Copy link
Member

I think you should create an issue in escodegen repo

@sanex3339 sanex3339 reopened this Sep 8, 2016
@Luperi
Copy link
Author

Luperi commented Sep 9, 2016

About what exactly?

@sanex3339
Copy link
Member

Wrong code generation on bash on Windows 10

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants