javascript 如何对javascript进行反混淆

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20884577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 19:32:36  来源:igfitidea点击:

how to deobfuscate javascript

javascriptdeobfuscation

提问by Oussama L.

can any one tell me how to de-obfuscate this?

谁能告诉我如何消除混淆?

é=-~-~[],ó=-~é,?=é<<é,t=?+~[];ì=(ó-ó)[?=(''+{})[é+ó]+(''+{})[ó-é]+([].ó+'')[ó-é]+(!!''+'')[ó]+({}+'')[ó+ó]+(!''+'')[ó-é]+(!''+'')[é]+(''+{})[é+ó]+({}+'')[ó+ó]+(''+{})[ó-é]+(!''+'')[ó-é]][?];ì(ì((!''+'')[ó-é]+(!''+'')[ó]+(!''+'')[ó-ó]+(!''+'')[é]+((!''+''))[ó-é]+([].$+'')[ó-é]+'\''+''+'\\'+(...Masked for confidentiality reasons

é=-~-~[],ó=-~é,?=é<<é,t=?+~[];ì=(ó-ó)[?=(''+{})[é+ó]+(''+{})[ó-é]+([].ó+'')[ó-é]+(!!''+'')[ó]+({}+'')[ó+ó]+(!''+'')[ó-é]+(!''+'')[é]+(''+{})[é+ó]+({}+'')[ó+ó]+(''+{})[ó-é]+(!''+'')[ó-é]][?];ì(ì((!''+'')[ó-é]+(!''+'')[ó]+(!''+'')[ó-ó]+(!''+'')[é]+((!''+''))[ó-é]+([].$+'')[ó-é]+'\''+''+'\\'+(...Masked for confidentiality reasons

回答by finn

Look for the "()" in the end. Those are for executing the obscured function code. If you remove the last one and use "toString()" instead in node you will get the following (After formatting a bit):

寻找最后的“()”。那些用于执行模糊的功能代码。如果删除最后一个并在节点中使用“toString()”,您将得到以下结果(稍微格式化后):

function anonymous() {
   na = prompt('Entrez le mot de passe');
   if(a == 'I changed this to not make it too easy for you' {
      alert('bravo');
   } else {
      alert('fail...');
   }
}

Try it yourself, but always be careful, since if you are not careful this kind of code can run harmful stuff on your computer.

自己尝试一下,但要始终小心,因为如果您不小心,此类代码可能会在您的计算机上运行有害的东西。

PS: A few more words about how it actually works. Those weird french seeming letters everywhere are just variables, which are defined in the beginning. é for example has the value of 2, since using the bitwise not operator on an empty array results a -1, and -~-(-1) = 2. All those backslashes are then used in combination with this numeric variables to get characters which eventually form the code of the function.

PS:关于它的实际工作原理再多说几句。那些随处可见的奇怪的法语字母只是变量,它们是在开头定义的。例如,é 的值为 2,因为在空数组上使用按位非运算符会导致 -1 和 -~-(-1) = 2。然后所有这些反斜杠与此数字变量结合使用以获取字符最终形成函数的代码。