'Drew' a little more inspiration from liverpole's Cyclical japh.

#!/usr/bin/perl $_= q#sub'C{25+ 20*c AAAAAAAAAAAAAAAAAAAAAA TTTTTTTTTTTTTTTTTTT os(pop()* 2/pop) }for(0 ..1638){$ T[$_ ][C(14,$_)] =$ T[$_][C(14,$_ CCCCCCCCCCCCC GGGGGGGGGGGGGGGGGGGGGGG +21) ]="\e[1mo\e[0m "}$C=$ T=$l=$f=0;sub'g{ ($d,$s)= @_;my$l=(length$s )+1;$p='-'x (int($d/$l)-1);my$TTTTT AAAAAAn;for(split/ /,$s){$n.=$p.$_}$n. =$p;$n=~s/-([\ w,])-/G$1G/g;$n=$l>$d?substr( $n,int(($l-$d)/2),$d) :$n;while($d>=length$ n){($n='-'.$n)..($n=$n.'-')} split//,$n}sub'T{ print"\e[2J\e [0;1f\n"}sub'A{$ g=0;@g=();m ap{push@g,${g}if $_;$g++}@ {pop@_};($g[1] AAAAAAAAAAAAA TTTTTTTTTTTTT-$g[0]) }T;forG$A(@T ){$c= qw(tsuJG-G-G -Gr ehtonaG-G- G- GlrePG-G CCCCCCCCCCCCCCCCCCCC GGGGGGGGGGGGGGGGGGGGGGGG -G-G ,rekc ahG-G -G- )[$C%20 ]; $T=0;@A=g (A TTTTTTTTTTTTTTTTTTTTT AAAAAAAAAAAAAAAAAAA ($A),$c);fo r(@{ $A}){print$_? do{$T= $T&&${l}ne$_? 0:1;$l=$_ }&&$_:$T?!($C%4 )?do{$^=pop GGGGGGG CCCCCCCC @A;'^'eq${^}?'G' :$^}||'-':' G':'G'}print"\n"; $C++;if(!($C%20)){select$y,$y,$ y,.08;T}}#,s*[ATCG]{2,}**g ,s,\s+,,g,s,G, ,g, eval $_ && chargrill #

There are two ways your eyes can interpret what you're seeing when you run this - it will either appear to be scrolling, or rotating. I've tried to provide enough visual cues to help you see the latter. If, try as you might you're still only able to see it as scrolling, try to just concentrate on the first line.

Windows users might need to (save the code above as "dna.pl" and) use the following invocation:

$ perl -MWin32::Console::ANSI dna.pl

Most of the obfuscations of this nature ($somevar=q"compactedOrWhitespacedCode";s/\s+//;eval;) can generally be picked apart with something like:

$ sed 's/eval/print/' obfu.pl | perl | perl -MO=Deparse

I was a little surprised to find out I couldn't quite do that with this one due to a last minute formatting change (namely, that I didn't have enough code to complete the last line in the picture!). How to modify the above command line to see the meat of the code is left as an exercise for the reader.

Update: Hah, I noticed my unintentional pun in the first sentence :-D



--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

Replies are listed 'Best First'.
Re: DNA japh
by liverpole (Monsignor) on Nov 20, 2006 at 14:42 UTC
    Terrific as always!  ++chargrill

    It's interesting that, as you've noted ...

    ... your trick (or should I say "my trick"? :-)) of:
    sed 's/eval/print/' obfu.pl | perl | perl -MO=Deparse

    doesn't work here.

    But a very simple alternative is to "protect" the eval, after it becomes print, from the && chargrill following it with:

    sed 's/eval/print#/' obfu.pl | perl | perl -MO=Deparse

    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

      Did I first pick up that trick from you? I think perhaps I did. However, it is an exceedingly helpful trick to figure out why ...

      ... sometimes the 'transformation' doesn't work quite right due to some misunderstanding of how something gets parsed. More often than not, I find myself having *some* whitespace required, whether it is because I'm using an ne or an or or the x operator on something I'm converting to an int. Or something similar. It's always helpful to run the code in progress through some mechanism like this to ensure that it will compile (the extra trip through B::Deparse implements a -c style check). So step 1 is - did B::Deparse pick up all the code, and if so, step 2 is - does the code still resemble the original intended code?

      While your spin on the sed regex works, my solution was a bit more 'brute force':

      $ sed 's/eval.*/print/' obfu.pl | perl | perl -MO=Deparse


      --chargrill
      s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
        Yes, I first told you about that trick with regard to this Japh.

        s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/