js混淆

js混淆工具--開源項目

? UglifyJS: https://github.com/mishoo/UglifyJS2 

? terser: https://github.com/terser/terser 

? javascript-obfuscator: https://github.com/javascript-obfuscator/javascript-obfuscator 

? jsfuck: https://github.com/aemkei/jsfuck 

? AAEncode: https://github.com/bprayudha/jquery.aaencode 

? JJEncode: https://github.com/ay86/jEncrypt 

Uglifyjs(開源)

uglifyjs是一個開源的js 壓縮工具,主要用于壓縮,混淆功能并不強。

Uglify混淆主要使用了以下方法(AST指抽象語法樹):
字符串解析成AST
解析AST,計算出作用域、變量名等
提供遍歷AST的方法,找到你想要修改的節(jié)點
提供把AST打印成源代碼的功能
提供美化代碼的功能
提供定位某個word位置的功能

terser

為什么選擇terser?

uglify-es is no longer maintained and uglify-js does not support ES6+.

terser is a fork of uglify-es that mostly retains API and CLI compatibility with uglify-es and uglify-js@3.

javascript-obfuscator

important:
Only obfuscate the code that belongs to you.
It is not recommended to obfuscate vendor scripts and polyfills, since the obfuscated code is 15-80% slower (depends on options) and the files are significantly larger.

jsfuck

jsfuck 是一個開源的js 混淆工具,原理比較簡單,其實就是通過特定的字符串加上下標定位字符,再由這些字符替換源代碼,從而實現(xiàn)混淆。
官網(wǎng):http://www.jsfuck.com/,混淆功能看上去比較強大,但是本質(zhì)上我認為是一種編碼,而且它讓會文件體積增大很多。對于太多的代碼不能混淆,混淆后會出錯。

AAEncode

用法:使用方式不合適,需要在javaScript中嵌入其語法
HTML

<textarea id='demo'>alert('Hello, World!');</textarea>

javaScript

var demo = $('#demo').aaencode();
console.log(demo);

JJEncode

偏向于加密

js混淆--在線混淆工具

? https://obfuscator.io/ 

? https://www.sojson.com/jscodeconfusion.html 

? http://www.jshaman.com/protect.html 

? http://www.freejsobfuscator.com/ 

? https://www.daftlogic.com/projects-online-javascript-obfuscator.htm 

? http://beautifytools.com/javascript-obfuscator.php 

jshsman

jshaman是一個商業(yè)級工具,看了很多社區(qū)的評論,這個目前是最好的,可以在線免費使用,也可以購買商業(yè)版。

地址:http://jshaman.com/
網(wǎng)站很干凈,沒什么煩人的廣告,用起來挺清爽。

js混淆--商業(yè)服務(wù)

? https://javascriptobfuscator.com/ 

? https://jscrambler.com/ 

? http://stunnix.com/

總結(jié)

建議:如果要做代碼壓縮,建議使用Uglifyjs/terser,如果是為了安全性,做js代碼混淆,建議使用jshaman。

另外 單純的本地文件加密:https://juejin.cn/post/6844904154436124686(優(yōu)點:在編譯階段完成加密,不需要在工程外進行加密)

參考鏈接:
https://blog.csdn.net/weixin_38927522/article/details/107919946
https://zhuanlan.zhihu.com/p/88300966

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容