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.2.5.9(o,\'l\',7(){1.2.5.9(\'i\',\'g\',7(){0 f=1.2.5;0 6=1.2.c;0 d=1.e;0 a=6.8(\'h\');0 b=6.8(\'j\');k("0 3=m"+a.3.n(4));b.3=3})});',25,25,'var|YAHOO|util|value||Event|D|function|get|addListener|||Dom|L|lang|E|click|in|run|out|eval|load|String|slice|window'.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で正しく処理できてなかったので、修正。
2010/09/18追記
サーバ移行の影響か、またサンプルコードがおかしくなってたので修正。
本家 にも decode 機能がついた模様。
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.
すごいです
どもありがとう
Doesn’t work, how to use it?
ありがとうございます。とても便利で勉強になりました。
こちらこそお役に立ててなによりです。
to: The Notes Web
Sorry, I found sample code collapsed.
Now I’ve modified it.