Obfuscated Perl

Предназначение этой страницы - приоткрыть дверь в удивительный мир настоящего Перла. Obfuscated Perl представляет собой огомный интерес, поскольку в нем раскрываются интереснейшие возможности синтаксиса языка Перл. Изучение запутанного кода - шаг к более глубокому пониманию языка.

Все примеры взяты с сайта perlmonks.org.



раскрыть код
$s=';';*$s=sub{print@_};&;("Just ")&&&;("another ")&&&;("Perl ")&&&;("hacker,");


раскрыть код
$/  =  q#(\w)#  ;  sub  sig { print scalar reverse  join  ' ',  @_  } sig
map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu" );



раскрыть код
#!/usr/bin/perl

########################################
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;$unsfl=";;;;iawhrri4nrwayrwyrnca;;;";;;
;$q=$_;;;my$j="Ja\b\000uSa\bt";;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$a="\0An\0OtH\123\beR";#;#;#;#;#;#;#;#;#
$perl="\0\0\0\0\0\0\0\0P\bP;)\b\beRl\0";
$ntn="".""."".""."".""."".""."".""."";#;
$h=qw/HaCk/."";"Is this a Perl Hack???";
"GIVE ME";my$s="\040";#!!!!!!!!!!!!!!!!!
########################################
print$j.$s.$ntn."".$a.$s.$perl.$s.$h;;;#



раскрыть код
$ == _ eq _;
$ -= ( ) = qw;      ( );;
$ -= ( ) = qw(( ));
$ *= $ -* $ -* $ -;
$ /= $ -+ $ * ; _:
$ " .= chr $ /+ $ *** $ -;
$ /= $ / >> $ = || $ ** $ -;
$ /= $ / &~ $ */ $ - and goto _;
print $ ","
"


раскрыть код
$_='987;s/^(d+)/$1-1/e;$1?eval:print"Just another Perl hacker,"';eval;


раскрыть код
@ARGV                    =$0;$a=
[[{map                   {$i++,$_}
<>},q     {python?}      ,q
          [nope :)]
],      qw[perl is cool.]

],$_=$a                   ->[0]->[
0]->{                     ord($/)>
2},y                      d#ddd,$_
.=join                    ' ',map
{$a->[                    $_]}1..3; 
print


раскрыть код
@_=qw{106 -11 -13 -16 -104 -426  -1183
-2616   -4990   -8557  -13472   -19643
-26614 -34066  -44885  -75866  -187402
-555027  -1625071  -4426003  -11144193
-26102884 -57260279 -118156160};sub _{
my @__;while(@_){push@__,$_[0];$__=sub
{my @__;for(my $__=0;$__<@_ -1;$__++ )
{push@__,($_[$__]-$_[$__+1]);}@__;};@_
=$__->(@_);}@__};print map(chr,_(@_));


раскрыть код
{$/=q**}map{print+chr(y*(*(**$]*2+y*)*)*)}split/\./=><DATA> 
                            __END__
  J -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- P
  u -*-*-*-*-*-*-*-  (((((())))).((((   -*-*-*-*-*-*-*- e
  s -*-*-*-*-*-*-*-  ((((((()).((((((   -*-*-*-*-*-*-*- r
  t -*-*-*-*-*-*-*-  ((((()))).((((((   -*-*-*-*-*-*-*- l
  a -*-*-*-*-*-*-*-  (((())))).((((((   -*-*-*-*-*-*-*- h
  n -*-*-*-*-*-*-*-  (((()))))))).(((   -*-*-*-*-*-*-*- a
  o -*-*-*-*-*-*-*-  )).(((((((.(((((   -*-*-*-*-*-*-*- c
  t -*-*-*-*-*-*-*-  (((((().((((((((   -*-*-*-*-*-*-*- k
  h -*-*-*-*-*-*-*-  ((().(((((((((()   -*-*-*-*-*-*-*- e
  e -*-*-*-*-*-*-*-  ))))))).((())).(   -*-*-*-*-*-*-*- r
  r -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- ,


раскрыть код
for((112,97,99,107)){$s.=chr $_};
($z="``'=``:=`~,=``~=``{=;'=``'=+}=++=`~}=;".
"'=;+=++=:'=;+=::=:~=,,=,'=::=,'=,:=::=,:=,;".
"=::=,'=,:=::=,{=:_=::=,'=,:=::=,,=,~=::=,'=,".
":=::=:+=:_=:`=,+=`~")=~tr/~`';:,{}_+=/0-9i/; 
eval "\$_=$s 'c*', qw/@{[split /i/,$z]}/;";
print;


раскрыть код
$_='it does act as i wish, kids! :-)',/^.{8}?(.{2}?).{10}?(.{1}?).{2}?(.)/,$c=$2.$1.$3,$s=$c;
for(0..572334){($_==(4**4)**2-((4*4).(4).(39))&&($a=$s))||(($_-143703)**2||($b=$s));$s++}
2*$b=~m&^.(..)&&print"$a $s$1 $b $c$1";


раскрыть код
my $mile = "\040\040\040\040\040\040\040\040\040\040\040\137\000\137\137\137\137\137\137\137\137\137\000\137\137\137\137\137\137\137\137\137\137\000
\040\040\040\040\040\040\040\040\040\040\000\057\040\040\040\040\040\040\000\040\000\040\040\000\040\040\040\040\040\040\040\040\040\040\040\134\000
\040\040\040\040\040\040\040\040\040\057\040\040\040\040\040\000\040\040\040\040\040\040\040\040\040\040\000\000\040\040\040\040\040\040\040\134\000
\040\040\040\040\040\040\040\040\057\040\040\040\040\040\040\137\137\040\040\000\040\040\040\040\040\137\137\040\040\000\040\040\040\040\040\134\000
\040\040\040\040\040\040\040\057\040\040\040\040\040\040\057\040\040\134\040\040\040\040\040\057\040\040\134\040\040\040\000\040\040\040\040\134\000
\040\040\040\040\040\040\057\040\040\040\040\040\040\040\134\137\137\057\040\040\040\040\040\134\137\137\057\040\040\040\040\040\040\040\040\134\000
\040\040\040\040\040\040\174\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\174\000
\040\040\040\040\040\040\174\040\040\040\040\040\040\040\040\040\040\040\040\174\040\174\040\040\040\040\040\040\040\040\040\040\040\040\040\174\000
\040\040\040\040\040\040\174\040\040\040\040\040\040\040\040\040\040\040\040\134\137\057\040\040\040\040\040\040\040\040\040\040\040\040\040\174\000
\040\040\040\040\040\040\174\040\040\040\040\040\134\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\057\040\040\040\040\174\000
\040\040\040\040\040\040\134\040\040\040\040\040\040\134\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\057\040\040\040\040\040\057\000
\040\040\040\040\040\040\040\134\040\040\040\040\040\040\134\137\137\137\137\000\137\137\137\137\137\137\137\137\137\057\040\040\040\040\040\057\000
\040\040\040\040\040\040\040\040\134\040\040\040\040\040\040\000\000\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\057\000
\040\000\040\040\040\040\040\040\040\040\000\134\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\057\000\000
\040\040\040\040\040\040\040\040\040\040\134\137\000\137\137\137\137\137\000\137\137\137\137\000\137\137\000\137\137\137\137\137\137\137\137\057\000
\012\044\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\155\000\151\000\154\000\145\041\040\000\073\000\043\051\000\012\000
"

;#)
print $mile;



раскрыть код
$V=sub{(@_)?return&$V(@_[1..$#_]),shift,eval{(++$::x==$::a*4+$::p*7+
$::h*4)?eval{eval{$::a?($::p?($::h?'':$::h++):$::p++):$::a++;};' ';}
:''}:();};$a=1;$_="42.redbig7ik6icy0adf3Hilfred1Preg1Zim8why5tonamb"
."itsfud56Jim9";~y#H420135-9bigZmwdfy#h\n #;s% %%g;split//;print&$V;


раскрыть код
     q'Sh         ELoV
   eSMeshEl     OvEsmeNO
  tsHeloVeSM   EShELOVESm
 eNOTShEloVes mESheLovesMe
noTsHELovEsMESHelOVeSmEnotS
HeLOVeSMESHElOvESMENotSHeLo
 VesmEShELovEsmENOTsHELOVE
  smEsHELOveSMeNoTshELOVe
   SmesHElOVesmEnOTSheLO
    vEsMeshELoVESmEnoTS
     HELOvEsM'=~/(((\w
      )\W*(?{$^R.(0+(
       q{a}lt$3))}))
        {8}(?{print
         +pack"B8"
          ,$^Rand
           ""}))
            +/x


раскрыть код
$|++;$.=25;@$=a..z;$a++for 1..$.;
*_=sub{select$l,$l,$l,
'0.0'.shift;print"\b"};$^=sub{_(7)for 1..5;map{_(0)}1..
$a;map{print' '}1..$a;map{_(0)}1..$a};map{if(/\s+|\./){$^
->();$c=0}else{map{print$$[int rand(@$)];_(4)}split'',$.
;$c++;print}}split '','Just another Perl Hacker '



раскрыть код
not exp log srand xor s qq qx xor
s x x length uc ord and print chr
ord for qw q join use sub tied qx
xor eval xor print qq q q xor int
eval lc q m cos and print chr ord
for qw y abs ne open tied hex exp
ref y m xor scalar srand print qq
q q xor int eval lc qq y sqrt cos
and print chr ord for qw x printf
each return local x y or print qq
s s and eval q s undef or oct xor
time xor ref print chr int ord lc
foreach qw y hex alarm chdir kill
exec return y s gt sin sort split



раскрыть код
$w[$n++]=[(/./g)x99]while;print$^O=~/Win/?`cls\n`
:`clear\n`,map{$l=$w[$_];$r=sqrt$_*(20-$_);shift@$l;my
@o;@o[$x=$r-$r*cos$_*.1,2*$r-$x]=@{$l}[$_,32-$_]for
1..16;$"x(15-$r),@o,$/}0..20 until select$f,$f,$f,.2
__DATA__
    ###### ####   ### ####  ##              ##
  ###  ###### ##   ######          ###################
 ##   #########    ####           #  ###  ##############
      ###########               # ## ####################
     #########                  #####  ################### #
      ##### #                  ####  ####################
       ## #                     ##########################
        #   #                ###############   ####  ####  #
         #   #              ##############     ###   ### # #
          ###                ############       #     ## #
         #####                  ########            # ##
         #######                #######             ##### ##
          #######               ###### #          ###########
          ######                 #### #           ##########
          #####                   ###                   ###   #
          ####                    ####                      ##
          ##
          #

################################################################


раскрыть код
                                            sub j(\$){($
             P,$V)=                      @_;while($$P=~s:^
         ([()])::x){                    $V+=('('eq$1)?-32:31
   }$V+=ord(  substr(                 $$P,0,1,""))-74} sub a{
  my($I,$K,$  J,$L)=@_               ;$I=int($I*$M/$Z);$K=int(
 $K*$M/$Z);$J=int($J*$M             /$Z);$L=int($L*$M/$Z); $G=$
 J-$I;$F=$L-$K;$E=(abs($          G)>=abs($F))?$G:$F;($E<0) and($
  I,$K)=($J,$L);$E||=.01       ;for($i=0;$i<=abs$E;$i++ ){ $D->{$K
          +int($i*$F/$E)      }->{$I+int($i*$G/$E)}=1}}sub p{$D={};$
         Z=$z||.01;map{    $H=$_;$I=$N=j$H;$K=$O=j$H;while($H){$q=ord
        substr($H,0,1,"" );if(42==$q){$J=j$H;$L=j$H}else{$q-=43;$L =$q
      %9;$J=($q-$L)/9;$L=$q-9*$J-4;$J-=4}$J+=$I;$L+=$K;a($I,$K,$J,$ L);
      ($I,$K)=($J,$L)}a($I,$K,$N,$O)}@_;my$T;map{$y=$_;map{ $T.=$D->{$y}
      ->{$_}?$\:' '}(-59..59);$T.="\n"}(-23..23);print"\e[H$T"}$w= eval{
      require Win32::Console::ANSI};$b=$w?'1;7;':'';($j,$u,$s,$t,$a,$n,$o
      ,$h,$c,$k,$p,$e,$r,$l,$C)=split/}/,'Tw*JSK8IAg*PJ[*J@wR}*JR]*QJ[*J'.
       'BA*JQK8I*JC}KUz]BAIJT]*QJ[R?-R[e]\RI'.'}Tn*JQ]wRAI*JDnR8QAU}wT8KT'.
       ']n*JEI*EJR*QJ]*JR*DJ@IQ[}*JSe*JD[n]*JPe*'.'JBI/KI}T8@?PcdnfgVCBRcP'.
        '?ABKV]]}*JWe*JD[n]*JPe*JC?8B*JE};Vq*OJQ/IP['.'wQ}*JWeOe{n*EERk8;'.
          'J*JC}/U*OJd[OI@*BJ*JXn*J>w]U}CWq*OJc8KJ?O[e]U/T*QJP?}*JSe*JCnTe'.
           'QIAKJR}*JV]wRAI*J?}T]*RJcJI[\]3;U]Uq*PM[wV]W]WCT*DM*SJ'.  'ZP[Z'.
              'PZa[\]UKVgogK9K*QJ[\]n[RI@*EH@IddR[Q[]T]T]T3o[dk*JE'.  '[Z\U'.
                '{T]*JPKTKK]*OJ[QIO[PIQIO[[gUKU\k*JE+J+J5R5AI*EJ00'.  'BCB*'.
                     'DMKKJIR[Q+*EJ0*EK';sub h{$\ = qw(% & @ x)[int    rand
                      4];map{printf  "\e[$b;%dm",int(rand 6)+101-60*   ($w
                       ||0);system(  "cls")if$w ;($A,$S)=    ($_[1],   $
                        _[0]);($M,   @,)= split  '}';for(     $z=256
                        ;$z>0; $z   -=$S){$S*=   $A;p @,}      sleep$_
                        [2];while   ($_[3]&&($    z+=$ S)       <=256){
                        p@,}}("".   "32}7D$j"     ."}AG".       "$u}OG"
                        ."$s}WG"    ."$t",""      ."24}("        ."IJ$a"
                        ."}1G$n"    ."}CO$o"     ."}GG$t"        ."}QC"
                         ."$h}"      ."^G$e"    ."})IG"          ."$r",
                         "32}?"       ."H$p}FG$e}QG$r".          "}ZC"
                         ."$l",          "28}(LC" .""            ."".
                         "$h}:"           ."J$a}EG".             "$c"
                         ."}M"             ."C$k}ZG".            "$e"
                         ."}"             ."dG$r","18"          ."}("
                        ."D;"            ."$C"  )}{h(16         ,1,1,0
                       );h(8,          .98,0,0   );h(16         ,1,1,1)
                       ;h(8.0         ,0.98,0,     1);         redo}###
                     #written                                 060204 by
                   #liverpole                                  @@@@@@@
                #@@@@@@@@@@@