<?xml version="1.0" encoding="windows-1252"?>
<node id="542489" title="Let's go to the movies" created="2006-04-11 05:08:26" updated="2006-04-11 01:08:26">
<type id="1588">
obfuscated</type>
<author id="252827">
teamster_jr</author>
<data>
<field name="doctext">
Hello monks,&lt;br&gt;
Here's my latest effort, it's pure perl, so should run anywhere.&lt;p&gt;
It is parametised so it will take the number of boxes in the output as an argument in the form:&lt;Br&gt;
&lt;code&gt; # perl blah.pl 19x20&lt;/code&gt;&lt;br&gt;
(19x20 is the default)&lt;p&gt;
This will produce a variable sized file (default is normally around 6Mb) called al.XXX (where XXX would reveal the surprise) in the directory from which it is run&lt;p&gt;
&lt;code&gt;


                                                           $_=q^($w,$h)=s
             plit/x/,shift||"19x20";$q=10+10*$w;$r=20+10*$h;@m=((31,(15)x
 ($w-1))x$h,(31)x$w);$m[$c]|=16,!(@a=grep!($m[$c+$$_[0]]&amp;16+$|*$$_[1]),[-
 1,8],[1,1],[$w,4],[-$w,2])?$c=pop@p:${($i,$j)=@{$a[rand@a
 ]};$m[$c]&amp;=~
 (8/$j);push@p,$c;$m[$c+=$i]&amp;=~$j;++$u-$h*$w+$h||map$_&amp;=15,@m,splice(@p),
 $c=$|=1}until$|&amp;$c+2&gt;$w*$h;$C=$q-4*int$q/4;$A=($q+$C)*$r;$u=pack"x"x(($q
 +$C)*$r);subZd{my($f,$g,$h,$i,$e)=@_;@a=sort{"000$a"&lt;=&gt;"000$b"}$h,$i||$h
 ;for($a[0]..$a[1]){$s=($r-$_)*($q+$C)+$f;vec($u,$_,8)=$e||2 for$s..$s+$g
 -1}};subZt{$a=shift;$x=10*($a%$w);$y=10*(2+int$a/$w)};dZ9,$q-20,10;dZ9,$
 q-20,$r-10;dZ9,1,10,$r-10;dZ$q-11,1,10,$r-10;map{t$_;if($_%$w){$m[$_]&amp;2?
 d$x-1,11,$y:"";$m[$_]&amp;8?d$x+9,1,$y-10,$y:"";}}0..-1+$w*$h;$F="LIST";open
 (FH,"&gt;al.avi");binmodeZFH;selectZFH;printZpack"V*",/\d/?$_:unpack"V*",$_
 Zfor"RIFF",(1256+($A+24)*($B=3+scalar@p)),"AVIZ$F",1216,"hdrlavih",56,50
 0000,32,0,2064,$B,0,1,$A,$q,$r,(0)x4,$F,1140,"strlstrh",56,"vids",(0)x4,
 1,10,0,$B,$A,-1,(0)x3,"strf",1064,40,$q,$r,pack("vv",1,8),0,$A,(0)x4,pac
 k(("C"x1024),(0xff)x3,0,128),$F,(4+($A+8)*$B),"movi";map{printZSTDOUT"."
 ;t$z||1;$l=$x;$t=$y;t$_;$ri=$x;if($l&gt;$x){$ri=$l;$l=$x}d$l+2,5+$ri-$l,($t
 &lt;$y?$t:$y)-7,($t&lt;$y?$y:$t)-3,1;$z=$_;print"00db".pack("V",$A).$u}@p,(-1+
 $w*$h)x3;print"idx1".pack"V",16*$B;$o=4;for(1..$B){print"00db".pack"VVV"
 ,16,$o,$A;$o+=$A+8}^;s#((?{$a.=$+})\s?(\S*)\s?)*#$a=~s/Z/ /g;$a#see

&lt;/code&gt;
(that's supposed to be a clapboard btw!)&lt;p&gt;
&lt;strike&gt;If there is enough interest i'll write a deobfuscation/explanation of what went into it,&lt;/strike&gt;&lt;br&gt;
I've written a clean version [542789|here].&lt;p&gt;
In the meantime some of my references and some other notes are in the spoiler below:&lt;br&gt;

&lt;spoiler&gt;
I've tested the output in windows media player and mplayer (on windows and linux), however i couldn't get it working with winamp - i tried to fix it, but i'm not entirely sure it's not winamp.&lt;p&gt;

&lt;ul&gt;
&lt;li&gt;the data is generated by a hacked up version of [301203|this]
&lt;li&gt;[http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html#bmih|BMP file format]
&lt;li&gt;I used [80749|tachyon's] post [315232|here] to remind me a bit about packing and to explore bmp file headers
&lt;li&gt;An excellent reference on the avi format can be found [http://198.170.116.198/avitech.html#AVIDIB|here]
&lt;/spoiler&gt;
&lt;p&gt;
I hope you all enjoy it.&lt;Br&gt;
Alex
&lt;Br&gt;&lt;small&gt;&lt;b&gt;update:&lt;/b&gt; Add link to [542789|explanation].&lt;br&gt;
Also use V not L (see [550028|this]) to force correct endianness - this should now work on mac's&lt;br&gt;
and fixed a bug where it didn't work for 5.8.8&lt;/small&gt;&lt;br&gt;
</field>
</data>
</node>
