JavaScript の圧縮・難読化ツールの定番 /packer/ で pack したコードを decode するツールを作成。
packer decoder
http://blog.shimazu.org/utils/packer_decoder.html
たとえば
eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\\\b'+e(c)+'\\\\b','g'),k[c]);return p}('1.3.6.8(h,\\'e\\',9(){1.3.6.8(\\'m\\',\\'k\\',9(){0 g=1.3.6;0 5=1.3.c;0 d=1.o;0 a=5.7(\\'l\\');0 b=5.7(\\'j\\');i("0 2=f"+a.2.n(4));b.2=2})});',25,25,'var|YAHOO|value|util||D|Event|get|addListener|function|||Dom|L|load|String|E|window|eval|out|click|in|run|slice|lang'.split('|'),0,{}))
というコードをツールにかけると
YAHOO.util.Event.addListener(window,'load',function(){YAHOO.util.Event.addListener('run','click',function(){var E=YAHOO.util.Event;var D=YAHOO.util.Dom;var L=YAHOO.lang;var a=D.get('in');var b=D.get('out');eval("var value=String"+a.value.slice(4));b.value=value})});
といったコードが得られる。
#これを Js Decoder にかければインデントもしてくれる。
つくりは簡単だけど、自分的にとても役立っている。
2008/01/24追記
decode前のサンプルコードにミスがあり、decoderで正しく処理できてなかったので、修正。
why decode code ? http://uploaded.to/?id=dgjezk
Pls help me
(snip)
Thank you for your comment.
I tried to decode it, but I couldn’t.
Maybe I think that the code doesn’t run on browser, properly.
すごいです
どもありがとう