http://qs321.pair.com?node_id=434261
ktross's user image
User since: Feb 24, 2005 at 21:12 UTC (19 years ago)
Last here: Dec 07, 2011 at 19:49 UTC (12 years ago)
Experience: 2664
Level:Deacon (12)
Writeups: 67
Location:Ottawa, Canada
Current Sanity Level:Yellow (Mellow)
User's localtime: Mar 28, 2024 at 08:30 -05
Scratchpad: View
For this user:Search nodes
Watch for posts by this user

<link rel="stylesheet" href="?node_id=234493" type="text/css" /> <link rel="stylesheet" href="?node_id=227261" type="text/css" />


[OT] Perl Code Embedded in an Image

My user image is more than just a picture of a man riding a camel. It's also a perl s‎crip‎t!

Steps to run:
  1. Download my user image
  2. Run perl with the -x switch : perl -x perlmonks.gif
  3. Enjoy :)


A Portrait in Binary Static
#!/usr/bin/perl -w # With apologies to all the giants upon whoms backs I ride use strict; $_='my $s=12;my$came l=((q( #)."\040"x($s-1))x 8)."\n",my$ myeyeshurt;eval("seek \040DATA ,0,0;") ;foreach(1..3){<DATA>}m y@mes=<DATA>;my$me;f oreach$me(@mes){$me=spri ntf("%-72s",$me),$me= ~s;\S;1;g,$me=~s;\s;0;g;}wh ile(1){print$camel;f oreach$me(@mes){my@dimensional =split(//,$me );my$ch=0;my$staticbits=0;my@stareh ard;my@japh=( q(0),q(1),"\040");for(1..$s){push@star ehard,@japh[ra nd(@japh)]}for(@starehard){$myeyeshurt= $myeyeshurt.$_}foreach$staticbits(@dimensional){if($stati cbits<$ch){unshift@starehard,@japh[rand(@japh-1)]}elsif($st aticbits>$ch){shift(@starehard)}$myeyeshurt=$myeyeshurt.$sta rehard[0],$ch=$staticbits,$_=shift(@starehard),push(@stareha rd,$_)}$myeyeshurt=$myeyeshurt."\n",@starehard=q()}system((($ ^O)eq(qq(\x4D\x53\x57\x69\x6E\x33\x32)))?qq(\x63\x6c\x73):qq(\ x63\x6c\x65\x61\x72));print$camel;print$myeyeshurt;$myeyeshurt =q(),select$,,$,,$,,0.001}';s/\s*//g;eval;q'1';__DATA__ 47`/; $_=reverse;print"\040$_$Camel\n";}';;s/\s*//g;;eval; eval ("seek\040DATA,0,0;");undef$/;$_=<DATA>;s/\s*//g;( );;s ;^.*_;;;map{eval"print\"$_\"";}/.{4}/g; __DATA__ push @_ ,'ee'..'tt',push@_,'a'..'v',push @_,'J'.. 'P', push@_,'_' (;formy$s(@_){*{;no strict' ref s';\*$s}=s ub{$s=~s,v,,,prin $s}}END {p rintchr( ),v(&s t)),o(&n er)), c(&a),e 140\24 1\041\1 \141\ 115\14 1\157 \146\ 112\1 45\15 \240 \046\ 3\13 1\35 4\16 0\26 \064 \042 3\076 \140\ 9\040\ 177\1 40\150\ 125\132 \105\051 \133\143 \000\1 00\100\050
Sample Output from the above s‎crip‎t is shown below using JavaS‎crip‎t:

 
<s‎crip‎t language="javas‎crip‎t"> </s‎crip‎t>