前言
上一篇讲的ob混淆https://blog.csdn.net/qq_26079939/article/details/108644855,这次给大家带来也是比较常见的一种JS混淆方式–packed混淆
一、什么是packed混淆?
像这样,eval后面的function参数类似packed组成的(也可能是其他组成的),我们就简称这种加密类型为packed混淆
eval(function (p, a, c, k, e, d) {
e = function (c) {
return (c < a ? "" : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
};
if (!''.replace(/^/, String)) {
while (c--) d[e(c)] = k[c] || e(c);
k = [function (e) {
return d[e]
}];
e = function () {
return '\\w+'
};
c = 2;
}
;
while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
return p;
}('0', 3, 3, 'hello!||'.split('|'), 0, {
}))
二、破解方法
这类的反混淆方法其实很简单
- 直接在控制台console.log(eval方法里的内容)
- 可以自己写个HTML,输出他的执行文本
三、方法验证
方法一
方法二
总结
这两种的解密方式本质是一样的,相对来说packed混淆还是比较简单的,然后贴下HTML方法的代码~
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<head>
<meta charset="UTF-8">
<script>
function myFunction()
{
// document.getElementById('divTest').innerText= 这里填入eval方法里的内容
document.getElementById('divTest').innerText= function(p,a,c,k,e,d){
e=function(c){
return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){
while(c--)d[e(c)]=k[c]||e(c);k=[function(e){
return d[e]}];e=function(){
return'\\w+'};c=2;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('0',3,3,'hello!||'.split('|'),0,{
})
}
</script>
</head>
<body>
<div id="divTest">
请开始你的表演!
</div>
<button type="button" onclick="myFunction()">点我解密 </button>
</body>
</html>