May 24, 2011
JJUG CCC 2011 Spring
id:sugyan
var
sugyan
= { name:
"すぎゃーん"
, age: 0x1C, from:
"Kamakura"
, lang: [
"Perl"
,
"JavaScript"
,
"Objective-C"
, ] };
http://livecoder.sugyan.com/
DEMO
$ cat qb.js
eval ($a=
'a=1;p= this[1\
&&"alert" ]?(a=0+0\
) ||alert:1 &&this["p"+ "rint"]?( \
1 &&print):console.log,u=unescape,q=u(( \
0 ||"%27")),f=Function,x=f("t,n","v \
= [];while(n--)v+=t;return"+(s=u("%20") \
)+"v"),n=u("%0a"),r=[45,95,145,194,243,1\
+290,339,387,436,486,537,589,642,695,749\
,53 +750,858,913,969];for(i=19;i--;)$a= $a\
[(e ="replace")](RegExp(".{"+r[i]+"}"),"" +(\
"$&" )+(b= u("%5c"))+n);if(a ){c=[ 5,(\
45), 5,55, 2, 31,58,43,2,31,( 58 ),53, 1,(\
30),( 86),( 58),43,1,30,86, 58,53 ,5,(\
45),5 ,28],o =521;for(i=26;i-- ;){$a= $a[e\
](($a) .substr(0,o+c[i]%28),"$&"+u("%1b")+"["+ (d=[(\
"0"),( "48;5;9"),"48;5;1","48;5;15"][Math["fl" +"oo"\
+"r"](c[ i]/28)])+"m"); ; o +=c[i]%28+3+d. length}\
};p(x(s ,5)+"eval"+x(s , 39)+"($a="+n+x (s,5)+\
q+$a+q+n +"."+e+x(s,11)+"(/"+b+("x1b")+b+( "[.*?"+\
"m/mig," +"/*")+x(s,11)+"qb*/"+q+q+( "))"));'
.replace (/\x1b\[.*?m/mig,/* qb*/''))
元ネタ:
http://d.hatena.ne.jp/ku-ma-me/20110405/p1
$ node qb.js eval ($a= 'a=1;p= this[1\ &&"alert" ]?(a=0+0\ ) ||alert:1 &&this["p"+ "rint"]?( \ 1 &&print):console.log,u=unescape,q=u(( \ 0 ||"%27")),f=Function,x=f("t,n","v \ = [];while(n--)v+=t;return"+(s=u("%20") \ )+"v"),n=u("%0a"),r=[45,95,145,194,243,1\ +290,339,387,436,486,537,589,642,695,749\ ,53 +750,858,913,969];for(i=19;i--;)$a= $a\ [(e ="replace")](RegExp(".{"+r[i]+"}"),"" +(\ "$&" )+(b=
u("%5c"))+n);if(a
){c=[ 5,(\ 45), 5,55,
2,
31,58,43,2,31,(
58
),53, 1,(\ 30),( 86),(
58),43,1,30,86,
58,53 ,5,(\ 45),5 ,28],o
=521;for(i=26;i--
;){$a= $a[e\ ](($a) .substr(0,o+c[i]%28),"$&"+u("%1b")+"["+ (d=[(\ "0"),( "48;5;9"),"48;5;1","48;5;15"][Math["fl" +"oo"\ +"r"](c[ i]/28)])+"m"); ; o +=c[i]%28+3+d. length}\ };p(x(s ,5)+"eval"+x(s , 39)+"($a="+n+x (s,5)+\ q+$a+q+n +"."+e+x(s,11)+"(/"+b+("x1b")+b+( "[.*?"+\ "m/mig," +"/*")+x(s,11)+"qb*/"+q+q+( "))"));' .replace (/\x1b\[.*?m/mig,/* qb*/''))
$ cat qb.js
$ js qb.js
$ node qb.js
$ cat qb.js | js
$ cat qb.js | js | js
Nodeでパイプ入力はv0.5から?
Thank you for your attention.
id:sugyan
http://sugyan.com/, sugi1982@gmail.com