Javascript调用Function()来创建一个函数 [英] Javascript calling Function() to create a function
问题描述
函数(
pre>
函数(
'return \ \\141\\75\\160\\162\\157\\155\\160\\164\\50\\ 47\\105\\156\\164\\162\\145\\172\\40\\154\\145\\ 40\\155\\157\\164\\40\\144\\145\\40\\160\\141\\ 163\\163\\145\\47\\51\\73\\151\\146\\50\\141\\ 75\\75\\47\\164\\157\\164\\157\\61\\62\\63\\ 154\\157\\154\\47\\51\\173\\141\\154\\145\\162\\ 164 \\\50\\47\\142\\162\\141\\166\\157\\47\\51\\73\\ \\\175\\145\\154\\163\\145\\173\\141\\154\\145\\162\\ \\\164\\50\\47\\146\\141\\151\\154\\56\\56\\56\\ (
)()
有趣的是:使用
Function()
创建了一个实际的函数。
但是由于我无法查看本机代码,因此我很难理解正在创建的实际功能。这是取自root-me.org Javascript - 本机代码的挑战。
解决方案它反混淆为:
a =提示('Entrez le mot de passe');
if(a =='toto123lol'){
alert('bravo');
} else {
alert('fail ...');
}
要在Chrome中验证,请打开Developer Tools,打开控制台并粘贴in:
功能(
'return \\\\\\\\\\\'' \\160\\162\\157\\155\\160\\164\\50\\47\\105\\156\\\ \\164\\162\\145\\172\\40\\154\\145\\40\\155\\157\\\ \\164\\40\\144\\145\\40\\160\\141\\163\\163\\145\\\ \\47\\51\\73\\151\\146\\50\\141\\75\\75\\47\\\ \\164\\157\\164\\157\\61\\62\\63\\154\\157\\154\\\ \\47\\51\\173\\ 141\\154\\145\\162\\164\\50\\47\\142\\162\\141\\ 166\\157\\47\\51\\73\\175\\145\\154\\163\\145\\ 173\\141\\154\\145\\162\\164\\50\\47\\146\\141\\ 151 \\ 154 \\\\\\\\\\\\\\\\\\\\\\\\\\\\' ()
这是编码工作原理的基本步骤。 编码字母a:
test =a;
console.log(test.charCodeAt(0)); // 97
console.log(parseInt('141',8)); // 97
console.log('\141'); // a
Can anyone explain the following code?
Function( Function( 'return \'\\141\\75\\160\\162\\157\\155\\160\\164\\50\\47\\105\\156\\164\\162\\145\\172\\40\\154\\145\\40\\155\\157\\164\\40\\144\\145\\40\\160\\141\\163\\163\\145\\47\\51\\73\\151\\146\\50\\141\\75\\75\\47\\164\\157\\164\\157\\61\\62\\63\\154\\157\\154\\47\\51\\173\\141\\154\\145\\162\\164\\50\\47\\142\\162\\141\\166\\157\\47\\51\\73\\175\\145\\154\\163\\145\\173\\141\\154\\145\\162\\164\\50\\47\\146\\141\\151\\154\\56\\56\\56\\47\\51\\73\\175\'' ) () )()
Interesting here: an actual function is getting created using the
Function()
.But since I cannot view the native code, I am having difficulty understanding the actual function that is getting created. This is taken from root-me.org Javascript - native code challenge.
解决方案It deobfuscates to:
a = prompt('Entrez le mot de passe'); if(a=='toto123lol'){ alert('bravo'); } else{ alert('fail...'); }
To verify, in Chrome, open Developer Tools, open the console, and paste in:
Function( 'return \'\\141\\75\\160\\162\\157\\155\\160\\164\\50\\47\\105\\156\\164\\162\\145\\172\\40\\154\\145\\40\\155\\157\\164\\40\\144\\145\\40\\160\\141\\163\\163\\145\\47\\51\\73\\151\\146\\50\\141\\75\\75\\47\\164\\157\\164\\157\\61\\62\\63\\154\\157\\154\\47\\51\\173\\141\\154\\145\\162\\164\\50\\47\\142\\162\\141\\166\\157\\47\\51\\73\\175\\145\\154\\163\\145\\173\\141\\154\\145\\162\\164\\50\\47\\146\\141\\151\\154\\56\\56\\56\\47\\51\\73\\175\'' ) ()
This is the steps of "how the encoding works", essentially. To "encode" the letter "a":
test = "a"; console.log(test.charCodeAt(0)); //97 console.log(parseInt('141', 8)); //97 console.log('\141'); //a
这篇关于Javascript调用Function()来创建一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!