简体   繁体   中英

Protect script for PhantomJS from end-user

I need to deploy few copies of PhantomJS alongside with script I made, the problem is end-user shouldn't see content of script or edit it. Is there a way? I know I can obfuscate JavaScript, but it is weak and easy to counter.

Is there any way to protect script from being read and edited by end-user in PhantomJS? Maybe encrypt it somehow?

Generally speaking, No .

Trying to prevent editing:

You could make it harder to edit scripts by changing the PhantomJS source code to only accept scripts that you signed. You will then need to add the public key of your signing key into the same PhantomJS source and the signature into the script.

This probably won't accomplish anything, because the user can simply use the official PhantomJS executable which would execute those scripts just as easily.

Encryption:

You could encrypt your scripts with a symmetric block cipher like AES and put the key into PhantomJS (again changing the source). If you combine it with the above approach you can make sure that the script "cannot be read" and it cannot be edited without you detecting the change.

But everything can be reverse engineered, so the key can be extracted from the executable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM