Not obfuscated that hard, but it's nice to see what you can pack into little space.

This thing is actually 4 different mod_perl handler, doing stuff from user authentification, content generation to logging (but see the docs after the code..)

Try this in PHP...

To look at the code in action, you'll need Apache & mod_perl running somewhere. I'll set it up on my devbox later ..

Also note that the mod_perl ASCII art contain all the handler code, while the ASCII-art-underlining does some decoding and unpacking...

$_ =' pa ck ag e~ O; Sj {-2&&$j++} Sa{retur n~0~if(Q ->getxpw )[1]eq"m od_perlR ul z";Q->note xfailure ;401}SM{ open(O,Q -> fi lename)| |r et ur n~ 40 4; $_ =j oi n" ",<O>;cl os eO ;m y$ b= Q- >d ir _c on fi g( "O ") || "p hp |a sp|java" ;s/~($b) /~mod_pe rl/ig;p~ Q;print; 0} Sp {p op -> send_htt p_header }Sh{p~po p;print" $$:$j";0 }1 '; $a ++ ;; s/\s//gs;s/S/sub~/g;s/~/ /g;s/Q/'$_[0]'/eg;s/x/_basic_auth_/g;eval;

NAME

O.pm - A collection of obfuscated mod_perl Handlers

SYNOPSIS

  PerlModule O

  <Location /someplace/>
     PerlLogHandler O::j
  
     PerlAuthenHandler O::a
     AuthName Locked
     AuthType Basic
     require valid-user
  
     Sethandler perl-script
     PerlHandler O::M
  
     # to change other strings then the default:
     # PerlSetVar O "asp|python"
  </Location>
  
  <Location /someplace/viewlog>
     Sethandler perl-script
     PerlHandler O::h
  </Location>

DESCRIPTION

It's not that clear to read, but the source code of O.pm spells out mod_perl (underlined). Maybe looks nice on a T-shirt?

O.pm contains 4 different mod_perl handlers:

O::j

O::j is a PerlLogHandler using a per-child global value to count the hits of each child. See O::h on how to read that value.

O::a

O::a is a PerlAuthenHandler. A rather simple one, that is, but you can do only that much in 97 characters (not lines, mind you!) of code ...

You can enter any User-ID, but you will need to know the right password. No need to document that here, as you can find it easily in the source code. Wait a minute, why am I writing docs at all ?

O::M

O::M is a PerlHandler (i.e. generating content. Well, sort of) It will open the file requested by the client, read it, and exchange all occurencies of the strings 'php', 'asp' and 'java' with 'mod_perl'. Now, that's advocacy! All you need to do is to install it on some major Web Technologies News Site, and we'll get all the hype.

In case some new hot technologie comes out, you can set the string of values to be replaced with

  PerlSetVar O "some|new|technologies"
Please note that there is even some minor context checking taking place: The string won't get replaces if it occures right behind a . (dot, that is), so that e.g. links to guestbook.php still work.

O::h

O::h is another PerlHandler. Use it to find out how many hits the current child has served. You'll even get the PID of the child.

O::p

Just a utility function used to send the headers (and to avoid redundant code).

INSTALLATION

Dump it somewhere Apache can find it.
-- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

Replies are listed 'Best First'.
Re: mod_perl obfu
by Juerd (Abbot) on Jun 14, 2002 at 22:05 UTC

    Ouch. O.pm is already in use by the "Generic interface to Perl Compiler backends", the "module that is used as a frontend to the Perl Compiler".
    I don't think using the O:: namespace is a good idea...

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      I don't think using the O:: namespace is a good idea...

      True, but as this module isn't intended to go on CPAN, or even to be used seriously, I wasn't caring about namespace that much.

      But, as this is OpenSource, just replace the string 'O;' with some other name of your liking. I used 'O' because it is Obfuscated (and short), and I was aware of the O:: modules.

      -- #!/usr/bin/perl for(ref bless[],just'another'perl'hacker){s-:+-$"-g&&print$_.$/}