Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

$_="eval eval"; s/a/i/;

by o0lit3 (Friar)
on Aug 31, 2004 at 22:37 UTC ( [id://387348]=obfuscated: print w/replies, xml ) Need Help??

The Reason

Several months ago, a co-worker asked me why someone would ever want to use multiple evals in a regular expression. At the time I had no good answer and even had difficulties producing a working example. Now (somewhat unfortunately), I can't seem to get those eee's out of my mind.


The Code
($_=join+qq e.e,map+ord,(join+qq ee,<DATA>)=~/[\d\.]/g) &&s e.+e(36).qq+.+.(95).qq+.+.(32)eeeeeeeeeeeeeeeeeeeee __DATA__ 49.49.50.46.49.49.52.46.49.48.53.46.49.49.48.46.49.49.5 4.46.51.52.46.55.52.46.49.49.55.46.49.49.53.46.49.49.54 .46.51.50.46.57.55.46.49.49.48.46.49.49.49.46.49.49.54. 46.49.48.52.46.49.48.49.46.49.49.52.46.51.50.46.56.48.4 6.49.48.49.46.49.49.52.46.49.48.56.46.51.50.46.49.48.52 .46.57.55.46.57.57.46.49.48.55.46.49.48.49.46.49.49.52. 46.57.50.46.49.49.48.46.51.52.46.51.50.46.51.50.32.32.9

The Challange:

The above script ends with 21 e's, several of which are meaningless. Can you determine how many e's can be eliminated without effecting the output?


An Unrelated Question

Unlike most of my other obfus, this script should run under both strict and -w. What is the general consensus regarding this rule? Is it considered bad etiquette if obfuscated code does not run under these options?

Replies are listed 'Best First'.
Re: $_="eval eval"; s/a/i/;
by jdalbec (Deacon) on Aug 31, 2004 at 23:53 UTC
    Highlight to read:
    8 e's are required, so 13 e's may be omitted. I notice that 8+13=21 are all Fibonacci numbers. Is that deliberate?
      ... Fibonacci numbers. Is that deliberate?

      Wow, very perceptive, jdalbec! The use of Fibonacci numbers is not coincidental; it's a sort of signature that I use in a lot of my obfuscated code. I meant for it to be a hidden element, but there you go finding it as the first replier!

      I (foolishy) started all this nonsense after posting my first obfuscation, Fibonacci, before becoming a member. The use of Fibonacci numbers in this particular obfuscation is (in all honesty) quite silly.

Re: $_="eval eval"; s/a/i/;
by grinder (Bishop) on Sep 01, 2004 at 07:33 UTC
    The above script ends with 21 e's, several of which are meaningless

    Well, BooK wrote 59 /e which, like the title suggests, ends with 59 e's, all of which are necessary! You'll have to try harder :o)

    should run under both strict and -w

    No, not bad etiquette at all. Just state the conditions beforehand.

    - another intruder with the mooring of the heat of the Perl

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://387348]
Approved by EdwardG
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-18 18:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found