Javascript 混淆的新手.. 为什么它不执行?

New to Javascript Obfuscation.. Why is it not executing?

我正在尝试 运行 一些已被混淆的 Java 脚本,但由于某种原因什么都没有发生...我的文件名为 test2.js 并且包含此代码它:

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))};while(c--){if(k[c]){p=p.replace(new RegExp('\b'+e(c)+'\b','g'),k[c])}}return p}('L 6;6=\'p\';r c A(){1.2("3").0=""q(6<B){1.2("h").0+="C. s I o n k? I u l m 5 p <4>"}y q(6>w){1.2("h").0+="x D!. s I o n k? I u l m 5 6 <4>"}1.2("3").0+="<a 9=\'#\' 7=\'g();\'>e i, j d 5 f</a><4>"1.2("3").0+="<a 9=\'#\' 7=\'g();\'>e i, j d 5 f</a><4>"8 b}c g(){1.2("3").0=""1.2("h").0+="e i, j d 5 f<4>";1.2("3").0+="<a 9=\'#\' 7=\'v();\'>z H</a><4>"8 b}c v(){1.2("3").0=""1.2("3").0+="<a 9=\'#\' 7=\'t();\'>E M K J, F G?</a><4>"8 b}c t(){1.2("3").0=""8 b}',49,49,'innerHTML|document|getElementById|NPCResponseWindow|br|is|GetCharHP|onclick|return|href||false|function|name|Hi|Player|nicetomeetyou|NPCTalkWindow|NPC|my|today|your|HP|you|help|399|if||Can|END|see|Beginnings2|450|Go|else|Same|Beginnings|400|Hello|away|Lets|shall|we|here||again|this|var|do'.split('|')))

我的 HTML 文件有这个:

<script src="test2.js"></script>

<HTML>
<BODY>
<table>
    <tr>
        <td><div id="NPCTalkWindow"></div></td></tr>
    <tr>
        <td> <div id="NPCResponseWindow"> <a href='#' onclick='Beginnings();'>Begin Conversation</a></div>
        </td>
    </tr>
</table>
</body>
</html>

但是除了开始对话之外什么都没有出现。有什么帮助吗?我做错了什么?

不出所料,它们是未混淆代码的错误:

var GetCharHP;
GetCharHP = '399';
r    // there is an error here, add the ;
function Beginnings() {
    document.getElementById("NPCResponseWindow").innerHTML = ""
    if (GetCharHP < 400) {
        document.getElementById("NPCTalkWindow").innerHTML += "Hello. Can I help you today? I see your HP is 399 <br>"
    } else if (GetCharHP > 450) {
        document.getElementById("NPCTalkWindow").innerHTML += "Go away!. Can I help you today? I see your HP is GetCharHP <br>"
    }
    document.getElementById("NPCResponseWindow").innerHTML += "<a href='#' onclick='nicetomeetyou();'>Hi NPC, my name is Player</a><br>"
    document.getElementById("NPCResponseWindow").innerHTML += "<a href='#' onclick='nicetomeetyou();'>Hi NPC, my name is Player</a><br>"
    return false
}

function nicetomeetyou() {
    document.getElementById("NPCResponseWindow").innerHTML = ""
    document.getElementById("NPCTalkWindow").innerHTML += "Hi NPC, my name is Player<br>";
    document.getElementById("NPCResponseWindow").innerHTML += "<a href='#' onclick='Beginnings2();'>Same here</a><br>"
    return false
}

function Beginnings2() {
    document.getElementById("NPCResponseWindow").innerHTML = ""
    document.getElementById("NPCResponseWindow").innerHTML += "<a href='#' onclick='END();'>Lets do this again, shall we?</a><br>"
    return false
}

function END() {
    document.getElementById("NPCResponseWindow").innerHTML = ""
    return false
}

并为您的 HTML 添加文档类型 并将脚本移动到文件末尾(之前) 您无法隐藏 javascript 代码,这很容易通过在线服务消除混淆