gpt4 book ai didi

Javascript混淆帮助

转载 作者:行者123 更新时间:2023-11-30 13:40:27 24 4
gpt4 key购买 nike

我需要一些帮助来理解这段代码是如何被混淆的。代码是:

<a id="suggest" href="#" ajaxify="/ajax/social_graph/invite_dialog.php?class=FanManager&amp;node_id=108463912505356" class=" profile_action actionspro_a" rel="dialog-post">Suggest to Friends</a>

混淆是:

\x3c\x61\x20\x69\x64\x3d\x22\x73\x75\x67\x67\x65\x73\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x23\x22\x20\x61\x6a\x61\x78\x69\x66\x79\x3d\x22\x2f\x61\x6a\x61\x78\x2f\x73\x6f\x63\x69\x61\x6c\x5f\x67\x72\x61\x70\x68\x2f\x69\x6e\x76\x69\x74\x65\x5f\x64\x69\x61\x6c\x6f\x67\x2e\x70\x68\x70\x3f\x63\x6c\x61\x73\x73\x3d\x46\x61\x6e\x4d\x61\x6e\x61\x67\x65\x72\x26\x61\x6d\x70\x3b\x6e\x6f\x64\x65\x5f\x69\x64\x3d\x31\x30\x38\x34\x36\x33\x39\x31\x32\x35\x30\x35\x33\x35\x36\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x20\x70\x72\x6f\x66\x69\x6c\x65\x5f\x61\x63\x74\x69\x6f\x6e\x20\x61\x63\x74\x69\x6f\x6e\x73\x70\x72\x6f\x5f\x61\x22\x20\x72\x65\x6c\x3d\x22\x64\x69\x61\x6c\x6f\x67\x2d\x70\x6f\x73\x74\x22\x3e\x53\x75\x67\x67\x65\x73\x74\x20\x74\x6f\x20\x46\x72\x69\x65\x6e\x64\x73\x3c\x2f\x61\x3e","\x73\x75\x67\x67\x65\x73\x74

现在我对上面的混淆代码使用了unescape来读取它。我想知道的是,到底是用什么来混淆代码的?基本上,我需要将可读代码自定义为相同的混淆。

如有任何帮助,我们将不胜感激。

最佳答案

如果您使用 255 以上的 unicode 字符,则需要进行一些特殊处理。您还需要确保十六进制代码用 0 正确填充,否则该函数将因小于 16 的字符(例如\n 和\t)而中断:

function obfuscate(str) {
var escaped = [];
for (var i = 0; i < str.length; i++) {
var c = str.charCodeAt(i);
var cs = "0000" + c.toString(16);
if (c < 256) {
cs = "\\x" + cs.substr(-2);
} else {
cs = "\\u" + cs.substr(-4);
}
escaped.push(cs);
}
return escaped.join('');
}

var ob = obfuscate("Hello world!");
alert(ob);

关于Javascript混淆帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2614995/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com