5

Google でコンバーターを検索しましたが、何も見つかりませんでした。難読化された JavaScript コードをデコードするために利用できるツールはありますか?

そのようなツールがあると思いますが、適切なキーワードで Google を検索していません。コードは 3 ページの長さなので、ツールが必要です。

コードの例を次に示します。

<script>([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(!![]+[])[!+[]+!+[]+!+[]]+(+(+[])+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+!+[]+[+[]]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]])(([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+

ありがとうございました

4

2 に答える 2

4

This code is fascinating because it seems to use only nine characters ("[]()!+,;" and empty space U+0020) yet has some sophisticated functionality. It appears to use JavaScript's implicit type conversion to coerce arrays into various primitive types and their string representations and then use the characters from those strings to compose other strings which type out the names of functions which are then called.

Consider the following snippet which evaluates to the array filter function:

([][
   (![]+[])[+[]]               // => "f"
 + ([![]]+[][[]])[+!+[]+[+[]]] // => "i"
 + (![]+[])[!+[]+!+[]]         // => "l"
 + (!![]+[])[+[]]              // => "t"
 + (!![]+[])[!+[]+!+[]+!+[]]   // => "e"
 + (!![]+[])[+!+[]]            // => "r"
]) // => function filter() { /* native code */ }

Reconstructing the code as such is time consuming and error prone, so an automated solution is obviously desirable. However, the behavior of this code is so tightly bound to the JavaScript runtime that de-obsfucating it seems to require a JS interpreter to evaluate the code.

I haven't been able to find any tools that will work generally with this sort of encoding. It seems as though you'll have to study the code further and determine any patterns of usage (e.g. reliance on array methods) and figure out how to capture their usage (e.g. by wrapping high-level functions [such as Function.prototype.call]) to trace the code execution for you.

于 2012-01-18T01:30:16.730 に答える
1

この質問にはすでに回答が受け入れられていますが、いくつかの問題を解決するために投稿します。

このアイデアが浮かんだとき、ある人がこの方法で JavaScript をエンコードするジェネレーターを作成しました。することに基づいてい[]["sort"]["call"]()["eval"](/* big blob of code here */)ます。したがって、sort-call-eval 部分 (つまり、最初の 1628 バイト) を削除することで、このエンコーダーの結果を簡単にデコードできます。この場合、以下が生成されます。

if (document.cookie=="6ffe613e2919f074e477a0a80f95d6a1"){ alert("bravo"); }
else{ document.location="http://www.youtube.com/watch?v=oHg5SJYRHA0"; }

(面白いことに、このコードの作成者は、適切に圧縮して 1 キロバイトを節約することさえできませんでした)

このコードが新しいブラウザーで機能しなくなった理由についての説明もあります:Array.prototype.sortへの参照を返さないように変更されましたwindow。私が覚えている限りでは、これが への参照を取得する唯一の方法だったwindowので、このコードはちょっと壊れています。

于 2012-01-18T18:27:43.937 に答える