gpt4 book ai didi

javascript - 定位混淆函数

转载 作者:行者123 更新时间:2023-11-30 12:42:38 27 4
gpt4 key购买 nike

我正在尝试对具有解码编码字符串功能的网站进行逆向工程。该函数在其中一个内联脚本中被调用:

<script type='text/javascript'>
var str = dec("BHUJLOUBHUNK");
</script>

即使我有完整的源代码,我也没有成功找到实际函数 dec 所在的位置。我怀疑该函数隐藏在以下脚本中的某处(但我可能是错的):

<script type="text/javascript">var _0xb557=["\x6B\x65\x79","\x4A\x30\x2B\x49\x52\x68\x42\x33\x2B\x4C\x79\x4F\x30\x66\x77\x32\x49\x2B\x32\x71\x54\x32\x44\x66\x38\x48\x56\x64\x50\x61\x62\x77\x6D\x4A\x56\x65\x44\x57\x46\x46\x6F\x70\x6C\x6D\x56\x78\x46\x46\x35\x75\x77\x36\x5A\x6C\x6E\x50\x4E\x58\x6F\x3D"];jwplayer[_0xb557[0]]=_0xb557[1];</script>
<script type="text/javascript">
eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d[c]=k[c]||c}k=[function(e){return d[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}('10 14(15){5 3=15+\'\',2=3.17(0);8(9<=2&&2<=21){5 19=2;8(3.13===1){4 2}5 12=3.17(1);4((19-9)*20)+(12-11)+22}8(11<=2&&2<=29){4 2}4 2}10 28(3){5 6="";23(7=0;7<3.13;7++){5 18=14(3.27(7));16=18^26;6=6+24.25(16)}4 6}',10,30,'||code|str|return|var|decoded|i|if|0xD800|function|0xDC00|low|length|ord|string|a|charCodeAt|b|hi|0x400|0xDBFF|0x10000|for|String|fromCharCode|123|charAt|dec|0xDFFF'.split('|'),0,{}))
</script>

如何追踪 dec() 函数?

最佳答案

使用jsbeautifier.org或几个类似网站中的任何一个来取消混淆来源。或者实际上,就这样做:

console.log(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d[c]=k[c]||c}k=[function(e){return d[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}('10 14(15){5 3=15+\'\',2=3.17(0);8(9<=2&&2<=21){5 19=2;8(3.13===1){4 2}5 12=3.17(1);4((19-9)*20)+(12-11)+22}8(11<=2&&2<=29){4 2}4 2}10 28(3){5 6="";23(7=0;7<3.13;7++){5 18=14(3.27(7));16=18^26;6=6+24.25(16)}4 6}',10,30,'||code|str|return|var|decoded|i|if|0xD800|function|0xDC00|low|length|ord|string|a|charCodeAt|b|hi|0x400|0xDBFF|0x10000|for|String|fromCharCode|123|charAt|dec|0xDFFF'.split('|'),0,{}));

...查看未混淆的来源。

例如,如果您将 eval 行粘贴到 JSBeautifier 中,您将获得:

function ord(string) {
var str = string + '',
code = str.charCodeAt(0);
if (0xD800 <= code && code <= 0xDBFF) {
var hi = code;
if (str.length === 1) {
return code
}
var low = str.charCodeAt(1);
return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000
}
if (0xDC00 <= code && code <= 0xDFFF) {
return code
}
return code
}

function dec(str) {
var decoded = "";
for (i = 0; i < str.length; i++) {
var b = ord(str.charAt(i));
a = b ^ 123;
decoded = decoded + String.fromCharCode(a)
}
return decoded
}

关于javascript - 定位混淆函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23875307/

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