简体   繁体   English

保护 Greasemonkey 脚本?

[英]Protect Greasemonkey scripts?

I know that anything that is downloaded and is in the user's possession is going to be pretty hard to protect, but I'm just wanting to hear opinions.我知道下载并由用户拥有的任何内容都将很难保护,但我只是想听听意见。 I'm thinking of selling a script (made with Greasemonkey...), and I want to be able to prevent the user from easily viewing the source code, or sending it to others.我正在考虑出售一个脚本(用 Greasemonkey 制作...),并且我希望能够防止用户轻松查看源代码或将其发送给其他人。 Thanks in advance.提前致谢。

Really the only thing you could try would be obfuscation but that is no guaranty that nobody will be able to read your code.实际上,您唯一可以尝试的是混淆,但这并不能保证没有人能够阅读您的代码。

Try - http://www.javascriptobfuscator.com/尝试 - http://www.javascriptobfuscator.com/

As with any javascript, complete protection is impossible due to the nature of the language, see:与任何 javascript 一样,由于语言的性质,完全保护是不可能的,请参阅:

Javascript library: to obfuscate or not to obfuscate - that is the question and How can I obfuscate (protect) JavaScript? Javascript 库:混淆或不混淆 - 这是一个问题我如何混淆(保护)JavaScript?

However, you can obfuscate your javascript code or minify it, neither of which will completely protect it, but they will make it less human-readable.但是,您可以混淆您的 javascript 代码或缩小它,这两者都不会完全保护它,但它们会降低人类可读性。

With Greasemonkey, there is another option beyond JavaScript obfuscation.使用 Greasemonkey,除了 JavaScript 混淆之外还有另一种选择。

You can compile your GM script into a Firefox extension instead.您可以将 GM 脚本编译为 Firefox 扩展。

Greasemonkey install makes it easy to see/get a GM's script code. Greasemonkey 安装可以轻松查看/获取 GM 的脚本代码。 But almost no civilians even know where to look for extension source files.但几乎没有平民甚至知道在哪里寻找扩展源文件。 (Of course, nothing will stop a determined programmer from getting and analyzing your code.) (当然,没有什么能阻止坚定的程序员获取和分析您的代码。)

One such compiler is at: http://arantius.com/misc/greasemonkey/script-compiler .一种这样的编译器位于: http : //arantius.com/misc/greasemonkey/script-compiler

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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