js代码混淆压缩的原理解析

今天给大家来讲解js的代码混淆压缩原理解密,我们先看一段js的源码
alter("hello, world");
我们使用最基本的压缩工具来压缩混淆一下
eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0("1, 2");',3,3,'alter|hello|world'.split('|'),0,{}))
我去,代码好长,看不明白吧,我们来格式化一下
eval(function (p, a, c, k, e, r) {
e = String;
if (!''.replace(/^/, String)) {
while (c--) r[c] = k[c] || c;
k = [function (e) {
return r[e]
}];
e = function () {
return '\\w+'
};
c = 1
}
...点击查看剩余70%
网友评论0