如何解码这个javascript?

如何解码这个javascript?,javascript,Javascript,我的问题是如何解码这个JavaScript以及如何编码(使用哪个程序或在线工具) 下面是我要解码的JavaScript: 我所知道的理解这段代码的唯一方法是找到一个安全的环境(以防代码有恶意意图)并在调试器中逐行执行它,并观察它在自我除臭以将自己转换为正常javascript时所做的事情。变量名通常会保持模糊,但是_O中的巨大字符串会被解码成某种东西(可能是javascript代码)。每个模糊的脚本都需要某种评估。在这里,排队 _L = 'constr\x75\x63\x74\x6F\x72';

我的问题是如何解码这个JavaScript以及如何编码(使用哪个程序或在线工具)

下面是我要解码的JavaScript:

我所知道的理解这段代码的唯一方法是找到一个安全的环境(以防代码有恶意意图)并在调试器中逐行执行它,并观察它在自我除臭以将自己转换为正常javascript时所做的事情。变量名通常会保持模糊,但是_O中的巨大字符串会被解码成某种东西(可能是javascript代码)。

每个模糊的脚本都需要某种
评估。在这里,排队

_L = 'constr\x75\x63\x74\x6F\x72';
[][_L][_L](_Z[_h._t4](_F))();
我们正在这样做
\u L
是字符串
的“构造函数”
,而
[].constructor.constructor
函数的构造函数。它将被解码的脚本调用,并调用结果函数。我们可以用
警报代替它,将脚本粘贴到控制台*,然后等待结果-我们甚至不需要了解解码是如何工作的。在您的情况下,结果是(是,包括所有注释和换行符):

var alarm=“0”;
var内容=文件;
if((content.getElementById(“包装器”)!=null))
{
document.getElementById('wrapper').style.display='block';
}
函数a()
{
if((content.getElementById(“links”)!=null))
{
var temp=content.getElementById(“links”).innerHTML;
如果((温度索引('nofollow')+1)>0)报警=“1”;
否则如果((温度指数('noindex')+1)>0)报警=“1”;
}
else报警=“1”;
}
函数b()
{
if((content.getElementById(“aa”)!=null)和&(content.getElementById(“ab”)!=null))
{
temp=document.getElementById(“aa”).href;
如果(”http://uc-portaller.ru/“!=温度)报警=“1”;
temp=document.getElementById(“ab”).innerHTML;
如果“温度”报警=“1”;
}
else报警=“1”;
}
函数c()
{
if((content.getElementById(“ba”)!=null)和&(content.getElementById(“bb”)!=null))
{
temp=content.getElementById(“ba”).href;
如果(”http://austere.ru/“!=温度)报警=“1”;
temp=content.getElementById(“bb”).innerHTML;
如果“温度”报警=“1”;
}
else报警=“1”;
}
函数d()
{
if((content.getElementById(“ca”)!=null)和&(content.getElementById(“cb”)!=null))
{
temp=content.getElementById(“ca”).href;
如果(”http://www.for-creative.com/“!=温度)报警=“1”;
temp=content.getElementById(“cb”).innerHTML;
如果“温度”报警=“1”;
}
else报警=“1”;
}
a();
如果(报警==“0”)b();
如果(报警==“0”)c();
如果(报警==“0”)d();
如果(报警==“1”)提示(“ICQ:”、“376880395”);
$(文档).ready(函数(){
//当您单击poplight类的链接时,href以a#开头
$('a.poplight[href^=#]')。单击(函数(){
var popID=$(this.attr('rel');//获取弹出窗口名称
var popURL=$(this.attr('href');//获取Popup href以定义大小
//从href URL提取查询变量(&V)
var query=popURL.split(“?”);
var dim=query[1]。拆分('&');
var popWidth=dim[0]。拆分('=')[1];//获取第一个查询字符串值
//淡入弹出窗口并添加关闭按钮
$('#'+popID).fadeIn().css({'width':Number(popWidth)}).prepend('');
//定义中心对齐的边距(垂直+水平)-我们将高度/宽度增加80,以适应css中定义的填充+边框宽度
var popMargTop=($('#'+popID).height()+80)/2;
var popMargLeft=($('#'+popID).width()+80)/2;
//将边距应用于弹出窗口
$('#'+popID).css({
“页边距顶部”:-popMargTop,
“左边距”:-popMargLeft
});
//淡入背景
$('body').append(“”);//将淡入淡出层添加到body标记的底部。
$('#fade').css({'filter':'alpha(不透明度=0)}).fadeIn();//淡入淡入淡入层
返回false;
});
//关闭弹出窗口和淡入层
$('a.close,#fade').live('click',function(){//单击关闭或淡入淡出层时。。。
$('#淡入,.popup#u块')。淡出(函数(){
$(“#淡入,a.close”).remove();
});//把它们都淡出
返回false;
});
});
$.fn.tabs=函数(){
返回此。每个(函数(){
var$tabwrapper=$(这个);
var$panels=$tabwrapper.find('>div');
var$tabs=$tabwrapper.find('>ula');
$tabs。单击(函数(){
$tabs.removeClass('selected');
$(this.addClass('selected');
$panels
.hide()//隐藏所有面板
.filter(this.hash)//筛选到'this.hash'
.show();//只显示这个
返回false;
}).filter(window.location.hash?'[hash='+window.location.hash+']':':first')。单击();
});
};
$(文档).ready(函数(){
//console.log(window.location.hash);
$('div.tabs').tabs();
});
*)当然,你需要确定你在做什么。恶意脚本的风险很小,您可能没有找到所有
eval
s@jfriend00关于逐行执行代码段解码的提示是一种更安全的方法。

请看:

它们向您展示了如何做类似的事情,基本上就是使用chrome调试器来“美化”代码并使其更易于阅读

chrome的某些版本没有上下文菜单上的命令,只需查找命令“Pretty prin”
var alarm ="0";
var content = document;

if ((content.getElementById("wrapper") != null))
{
    document.getElementById('wrapper').style.display = 'block';
}

function a ()
{
    if ((content.getElementById("links") != null))
    {
        var temp = content.getElementById("links").innerHTML;
        if ((temp.indexOf('nofollow')+1) > 0)  alarm = "1";
        else if ((temp.indexOf('noindex')+1) > 0)  alarm = "1";
    }
    else alarm = "1";
}

function b ()
{
    if ((content.getElementById("aa") != null) && (content.getElementById("ab") != null))
    {
        temp = document.getElementById("aa").href;
        if ("http://uc-portaller.ru/" != temp) alarm = "1";

        temp = document.getElementById("ab").innerHTML;
        if ("скрипты для ucoz" != temp) alarm = "1";
    }
    else alarm = "1";
}

function c ()
{
    if ((content.getElementById("ba") != null) && (content.getElementById("bb") != null))
    {

        temp = content.getElementById("ba").href;
        if ("http://austere.ru/" != temp) alarm = "1";

        temp = content.getElementById("bb").innerHTML;
        if ("доска объявлений" != temp) alarm = "1";
    }
    else alarm = "1";
}

function d ()
{
    if ((content.getElementById("ca") != null) && (content.getElementById("cb") != null))
    {

        temp = content.getElementById("ca").href;
        if ("http://www.for-creative.com/" != temp) alarm = "1";

        temp = content.getElementById("cb").innerHTML;
        if ("темы для ucoz" != temp) alarm = "1";
    }
    else alarm = "1";
}

a ();

if (alarm == "0") b ();
if (alarm == "0") c ();
if (alarm == "0") d ();

if (alarm == "1") prompt('Нарушены условия использования, по всем вопросам обращайтесь в ICQ:', '376880395');












$(document).ready(function(){

    //When you click on a link with class of poplight and the href starts with a # 
    $('a.poplight[href^=#]').click(function() {
        var popID = $(this).attr('rel'); //Get Popup Name
        var popURL = $(this).attr('href'); //Get Popup href to define size

        //Pull Query & Variables from href URL
        var query= popURL.split('?');
        var dim= query[1].split('&');
        var popWidth = dim[0].split('=')[1]; //Gets the first query string value

        //Fade in the Popup and add close button
        $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('');

        //Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css
        var popMargTop = ($('#' + popID).height() + 80) / 2;
        var popMargLeft = ($('#' + popID).width() + 80) / 2;

        //Apply Margin to Popup
        $('#' + popID).css({ 
            'margin-top' : -popMargTop,
            'margin-left' : -popMargLeft
        });

        //Fade in Background
        $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
        $('#fade').css({'filter' : 'alpha(opacity=0)'}).fadeIn(); //Fade in the fade layer 

        return false;
    });


    //Close Popups and Fade Layer
    $('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
        $('#fade , .popup_block').fadeOut(function() {
            $('#fade, a.close').remove();  
    }); //fade them both out

        return false;
    });


});




        $.fn.tabs = function () {
            return this.each(function () {
               var $tabwrapper = $(this); 

               var $panels = $tabwrapper.find('> div');
               var $tabs = $tabwrapper.find('> ul a');

               $tabs.click(function () {  
                   $tabs.removeClass('selected');
                   $(this).addClass('selected');

                   $panels
                    .hide() // hide ALL the panels
                    .filter(this.hash) // filter down to 'this.hash'
                        .show(); // show only this one

                   return false;
               }).filter(window.location.hash ? '[hash=' + window.location.hash + ']' : ':first').click();
            });
        };

        $(document).ready(function () {
            // console.log(window.location.hash);

            $('div.tabs').tabs();
        });
1) (s\u0065lf + ([] * 0) * 1)
2) '\x5B'
3) ((s\u0065lf + ([] * 0) * 1)[0 ^ 0] == '\x5B')
1) "[object Window]0"
2) "["
3) true