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

Absolute path as parameters #576

Closed
isaelblais opened this issue Mar 10, 2020 · 11 comments
Closed

Absolute path as parameters #576

isaelblais opened this issue Mar 10, 2020 · 11 comments

Comments

@isaelblais
Copy link

Hi,

I don't understand why I call javascript-obfuscator with absolute path and it doesn't work. I call it like this:

javascript-obfuscator C:\NodeJsObfuscate\src --output C:\NodeJsObfuscate\obfuscated

I get the error: Illegal characters in path. When I pass absolute path a source files, the app get the source correctly and it works, but the absolute path for the --output parameters cause error. What am I doing wrong ?

Thanks in advance

@sanex3339
Copy link
Member

Hi. I can't test it on the Windows, so maybe someone other can help you.

@sanex3339
Copy link
Member

Anyone can investigate this?

@xiaoyijun
Copy link

maybe you can try
javascript-obfuscator C:\\NodeJsObfuscate\\src --output C:\\NodeJsObfuscate\\obfuscated

@sanex3339
Copy link
Member

Hi. Any news?

@isaelblais
Copy link
Author

maybe you can try
javascript-obfuscator C:\\NodeJsObfuscate\\src --output C:\\NodeJsObfuscate\\obfuscated

I tried all the variants of slashes possible. The problem was still there, but i managed to found a workaround.

I'll need this obfuscator soon enough to give you feedback concerning this problem / bug

@da411d
Copy link
Contributor

da411d commented Jul 1, 2020

No, not slashes or backslashes cause this bug.

First, i used to think that is because of exception in mkdirp package, caused by path-arg.js:17
But then i checked it separately and it worked fine.

Then i added some console.log to /node_modules/javascript-obfuscator/node_modules/mkdirp/lib/path-arg.js and what i get that path (pathArg function argument) equals... D:\_PROJECTS\_WEB\test\result\D:\_PROJECTS\_WEB\test\src
And then mkdirp causes exception because of illegal : in path!

Soooo:
My command:
javascript-obfuscator D:\_PROJECTS\_WEB\test\src --output D:\_PROJECTS\_WEB\test\result

Expected result path:
D:\_PROJECTS\_WEB\test\result

Actual result path:
D:\_PROJECTS\_WEB\test\result\D:\_PROJECTS\_WEB\test\src

I think bug is in function getOutputCodePath in cli/utils/ObfuscatedCodeWriter.ts:38

@gaurav-cointab
Copy link

This we have also faced. Has this been addressed? @sanex3339

@sanex3339
Copy link
Member

sanex3339 commented Aug 30, 2020

PR welcomed. Also, i need a way to test this behaviour under UNIX environment, but I don't sure how to do that.

@sanex3339
Copy link
Member

Anybody can test this PR:
#772 ?

@sanex3339 sanex3339 reopened this Oct 8, 2020
@sanex3339
Copy link
Member

Merged to the master branch. I'll release a new version soon.

@sanex3339
Copy link
Member

Released as 2.5.0

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

No branches or pull requests

5 participants