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$_.$/}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.