Chris, one of the totl crew, won his catagory in the 5th Obfuscated Perl Contest.
The code will only run in a linux terminal! It uses evil, evil escape codes.
Don't try and cut and paste the code - extra whitespace will kill it! Download it from here. Save it as timepiece then run it from a linux console by typing perl timepiece.
$;=$_;$/='0#](.+,a()$=(\}$+_c2$sdl[h*du,(1ri)b$2](n} /1)1tfz),}0(o{=4s) 1rs(2u;2(u",bw-2b $ hc7s"tlio,tx[{ls9r11$e(1(9]q($,$2)=)_5{4*s{[9$,lh$2 ,_.(ia]7[11f=*2308t$$)]4,;d/{}83f,)s,65o@*ui),rt$bn;5(=_stf*0l[t(o$.o$r srt.c!(i([$a]$n$2ql/d(l])t2,$.+{i)$_.$zm+n[6t(e1+26[$;)+]61_l*,*)],(41$ {/@20)/z1_0+=)(2,,4c*2)\5,h$4;$91r_,pa,)$[4r)$=_$6i}tc}!,n}[h$]$t 0rd)_ $';open(eval$/);$_=<0>;for($x=2;$x<666;$a.=++$x){s}{{.|.}};push@@,$&;$x ==5?$z=$a:++$}}for(++$/..substr($a,1885)){$p+=7;$;.=$@[$p%substr($a,$!, 3)+11]}eval$;
Frightening, ain't it? Can you see what it is yet?
Here's a clue; this code results in a string which is 'eval'd at the end. The contents of that eval is:
($d,$/)=(" "x1924,.10486);for($l..666){z(24,46,$_,\$d)}for(27,91,59,72) {substr($d,$n++,1)=chr$_}$d.=chr(10);while(){$a=$d,@t=localtime;l(20,59 ,$t[0])+l(21,42,$t[1])*l(18,35,5*$t[2]+$t[1]/12);print$a}sub z{substr($ {$_[3]},int(sin($_[2]*$/)*$_[$!])+(2*int(12-cos($_[2]*$/)*$_[$!]/2)+1)* 40+4,1)=chr($_[1])}sub l{$q=shift;for(0..$q){z($_,@_,\$a)}}
That code with indents, and some obfuscation removed, and sensible variable names becomes:
$default = " "x1924; $PIBY30=.10486; for(0..666){ plotchar(24,46,$_,\$default) } for(27,91,59,72){ substr($default,$n++,1)=chr$_ } $default.=chr(10); while(){ $buffer=$default; @t=localtime; my ($sec,$min,$hour, @crap) = @t; drawhand(20,59,$sec); drawhand(21,42,$min); drawhand(18,35,5*$hour+$min/12); print $buffer; } sub plotchar{ ($dist,$char,$angle,$stringptr) = @_; $x=int(sin($angle*$PIBY30)*$dist); $y=(2*int(12-cos($angle*$PIBY30)*$dist/2)+1); $pos = $x+$y*40+4; substr(${$stringptr}, $pos, 1)=chr($char); } sub drawhand{ ($length,$char,$angle)=@_; for(0..$length){ plotchar($_,$char,$angle,\$buffer); } }
The actual result should look like this, an analog clock showing the current time.
................... .... ..... ... ... ... .. .. ... .. .. .. ; .. .. ;;;; .. .. ;;; .. . ;;;; . . ;;;; . . ;;; . . ###### . . * ####### . . * ##### . .. ** .. .. ** .. .. ** .. .. ** .. ... * .. .. * .. ... * ... ..... ..... ................... |
The sick part is that this page is a CGI script- that clock above should be showing correct GMT! |