2013-04-23 36 views
1

我的問題是如何解碼這個JavaScript,以及如何編碼(使用哪個程序或在線工具)。如何解碼此javascript?

這裏是我想解碼的JavaScript: http://pastebin.com/hZvKySjj

+3

它被混淆了.. – 2013-04-23 13:13:22

+1

如果你不知道它應該做什麼,去混淆它幾乎是不可能的。 – 11684 2013-04-23 13:15:48

+0

這不是可以輕易解碼的東西,這只是複雜的代碼編寫。 – 2013-04-23 13:15:49

回答

9

每個混淆腳本需要某種eval。在這裏,行

_L = 'constr\x75\x63\x74\x6F\x72'; 
[][_L][_L](_Z[_h._t4](_F))(); 

正在這樣做。 _L是字符串"constructor",並且[].constructor.constructor是構造函數Function。它將被解碼後的腳本調用,並且調用結果函數。我們可以用alert替代它,將腳本粘貼到控制檯*中,然後等待結果 - 我們甚至不需要了解解碼是如何工作的。在你的情況,結果是(當然,也包括所有的意見和換行符):

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(); 
     }); 

*)當然,你需要確保你在做什麼。總是有一個小小的風險,那就是它是一個惡意腳本,你可能還沒有找到所有的eval。 @ jfriend00提示逐行執行解碼片段是一種更安全的方法。

+0

這就是驚天動地 – VeXii 2013-04-23 13:30:56

+0

非常感謝,朋友! :) – 2013-04-25 14:18:58

2

我知道,瞭解這個代碼什麼的唯一方式是找一個安全的環境(如果代碼中有惡意),並執行它在調試器中逐行執行,並觀察它的作用,因爲它會將自身變成正常的javascript。變量名通常會保持模糊,但_O中的巨大字符串將被解碼爲某些內容(可能是javascript代碼)。

0

看一看:http://www.labnol.org/software/deobfuscate-javascript/19815/

他們告訴你如何,你可以做這樣的事情,它基本上是使用Chrome調試器來「美化」的代碼,使其更容易閱讀的問題。

部分Chrome版本沒有上下文菜單上的命令,只是看命令「漂亮打印」(具有類似的圖標 - >{}

一旦這樣做,你就可以使用JavaScript控制檯評估代碼的小片段來對其進行反向工程。例如。表達式(在你的代碼的開頭)

1) (s\u0065lf + ([] * 0) * 1) 
2) '\x5B' 
3) ((s\u0065lf + ([] * 0) * 1)[0^0] == '\x5B') 

返回此字符串在我的瀏覽器

1) "[object Window]0" 
2) "[" 
3) true 

只要找到切入點,並從那裏遵循。混淆代碼遵循與普通代碼相同的規則,只是全部搞砸了。

+0

你真的沒有看到pastebin代碼,是嗎?代碼* *已經美化/漂亮打印。 – Bergi 2013-04-23 14:09:05

+0

我認爲我太注意那個沒有注意到的藍色中間部分。 – Xocoatzin 2013-04-23 14:49:38