Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

The Most Cleverly Hidden Secret of All Time! (666th post)

by Mr. Muskrat (Canon)
on Apr 16, 2003 at 14:49 UTC ( [id://250914]=obfuscated: print w/replies, xml ) Need Help??

I have stumbled across the most cleverly hidden secret of all time!

"What is it?", you ask, "What?", even "Huh?"

"Tell us more!", you demand, "You'd better tell!" No need to yell or get nasty. I hear you, I hear you! And please, do not all talk at once. Two voices are more than enough for me to bear.

Please allow me to share with you how it has forever changed me! We are a new man! Yes we are my precious. All will be made known soon enough. In the proper time and in the proper way, all will be made manifest. For you see, it is my duty, Nay!, my destiny! to reveal it to all of you. Oh my. I have been rambling. You must forgive me but I have been altered by this discovery! And I cannot stop talking about it and its effects.

"The discovery!", you say. Yes! The discovery! I should get started telling you about it! It... It is simply... marvelous!!! Oh my! It is so difficult to find the words to express my findings. But I shall attempt it...

If you blend certain words and symbols together in a certain way, you get the usual, the expected result. Take this program for example:

print &{'Just Another Perl Hacker'},$/; sub AUTOLOAD{ *$AUTOLOAD=sub{(split'::',$AUTOLOAD)[1]}; goto&$AUTOLOAD; }
Pretty easy to follow right? Of course it is. It doesn't do anything unexpected at all.

Now let me show you a funny variable trick:

${'::*&^%$#@!'} = 'Just Another Perl Hacker'; print ${$::{'*&^%$#@!'}},$/;

Here is another example that (while less than sane) is prefectly valid:

_10: print "Just Another Perl Hacker\n"; _20: goto _10;

But! by simply twisting the words and symbols around in a most peculiar fashion; creating new and unusual "phrases"; you will witness a most, uh, interesting outcome. Yes, interesting... It changes everything! Everything I tell you!!!

Argh!!!! I simply cannot express it in words... No! no my precious, I tried. True! I tried! It does involve words but words alone cannot convey the deeper meaning. Nay! One must be shown, yes! one must be shown! Come my precious! We will show them.

#!/usr/bin/perl -w use strict;sub t{map{chr($_)}@_}sub l{return(split' ',&s)[0=>1]} BEGIN{$%=2=>$;[0]=23=>$;[1]=$;[0]++=>$;[2]=3;@;=&t(@;)=>$^H^=$%} $.=-${$;[1]}=>$!=$:=~s/\s//g=>$!++=>$?=$=/$!/($%+$!)=>$=/=$!;$~= substr((split/[\/\\]/=>${$;[0]})[$.]=>$[=>$?)=>@~=split//,$~;$^= qq#h$~[${$;[1]}]$~[$!]$~[$|]#=>@~=qx/$~$"$:$:$^/;$=++if(@~==30); $~=$~[$=]=>$^=substr($~=>index($~=>$:)+${$;[1]}=>${$;[1]})=>1,0; $@=::j(),1,0,1,0,0=>1=>1=>0=>1=>0;$b='_',1,0,1,0,0,1,1,0,1,0;*$b =sub{$~=shift;$~->($b,@_);};goto&{$@->$^};sub s{unpack($^,$@->_) };sub j{$a={_=>'92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``',};$;=sub{ $:=shift;$a->{$:};};bless($;);$;;}sub u{die(&i);}sub v{(split' ' =>&s)[2=>3]}sub i{join' '=>(&l=>join(''=>&t(@{&e}))=>&v=>$/)}sub e{[69,118,105,108]};sub p{'Just'}sub r{'Hacker'}sub o{'Another'}

See? Do you see it? Isn't it amazing? Yes my precious, it is very impressive! Who would have guessed it? By mixing certain words and symbols into complex phrases the outcome twists around and... and... becomes evil. Oh so... evil! It is everywhere. Beware the evil! Or you too might be corrupted. I've said to much my precious?

Now I must go. My precious says so. I must obey my precious. Farewell!

Updated: Added post number to title.

Updated!: Patched code to work with 5.8.x. Thanks broquaint and The Mad Hatter for testing. jeffa tells me that it also works on 5.6.0! Fixed yet another sneaky bug thanks to katgirl!

Replies are listed 'Best First'.
I give... where does the 1 come from?
by jonadab (Parson) on Apr 17, 2003 at 02:31 UTC

    Okay, two questions: first, why does ${chr(23)} evaluate to 1 and second, how in the name of all that is sane did you discover this gem of trivia?


    for(unpack("C*",'GGGG?GGGG?O__\?WccW?{GCw?Wcc{?Wcc~?Wcc{?~cc' .'W?')){$j=$_-63;++$a;for$p(0..7){$h[$p][$a]=$j%2;$j/=2}}for$ p(0..7){for$a(1..45){$_=($h[$p-1][$a])?'#':' ';print}print$/}

      ${chr(23)} = $^W. Same as $foo = ${foo}.

      90% of every Perl application is already written.
      dragonchild

        D'oh. I theoretically should have known that, I just forgot about the way unix handles bucky bits. (I come from the DOS world, where holding Ctrl causes the Ctrl bit to be set in the KSB, and pressing W causes the character W to be sent on hardware interrupt 9, and it is also possible to type in character 23 (Alt+023 on the keypad), which is different and will usually have a different effect. I've been using Linux for a while now, but I haven't done any lowlevel assembly-language stuff, so I only occasionally brush into this, and it hasn't firmly taken root in my brain yet.)


        for(unpack("C*",'GGGG?GGGG?O__\?WccW?{GCw?Wcc{?Wcc~?Wcc{?~cc' .'W?')){$j=$_-63;++$a;for$p(0..7){$h[$p][$a]=$j%2;$j/=2}}for$ p(0..7){for$a(1..45){$_=($h[$p-1][$a])?'#':' ';print}print$/}
Re: The Most Cleverly Hidden Secret of All Time! (666th post)
by Anonymous Monk on Apr 16, 2003 at 15:14 UTC
Re: The Most Cleverly Hidden Secret...( Mwah! Deparse spat at me:()
by Anonymous Monk on Apr 17, 2003 at 03:47 UTC

    Bravo.

    perl -MO=Deparse #!/usr/bin/perl -w use strict;sub t{map{chr($_)}@_}sub l{return(split' ',&s)[0=>1]} BEGIN{$%=2=>$;[0]=23=>$;[1]=$;[0]++=>$;[2]=3;@;=&t(@;)=>$^H^=$%} $.=-${$;[1]}=>$!=$:=~s/\s//g=>$!++=>$?=$=/$!*($%+$!)=>$=/=$!;$~= substr((split/[\/\\]/=>${$;[0]})[$.]=>$[=>$?)=>@~=split//,$~;$^= qq#h$~[${$;[1]}]$~[$!]$~[$|]#=>@~=qx/$~$"$:$:$^/=>$~=$~[$=]=>$^= substr($~=>index($~=>$:)+${$;[1]}=>${$;[1]});$@=::j();$b='_';*$b =sub{$~=shift;$~->($b,@_);};goto&{$@->$^};sub s{unpack($^,$@->_) };sub j{$a={_=>'92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``',};$;=sub{ $:=shift;$a->{$:};};bless($;);$;;}sub u{die(&i);}sub v{(split' ' =>&s)[2=>3]}sub i{join' '=>(&l=>join(''=>&t(@{&e}))=>&v=>$/)}sub e{[69,118,105,108]};sub p{'Just'}sub r{'Hacker'}sub o{'Another'} ^D Can't call method "PADLIST" on an undefined value at /usr/bin/perl/lib +/B/Deparse.pm line 1039. CHECK failed--call queue aborted.

      Huh? B::Deparse works here... (Version 0.60, perl 5.6.1, FreeBSD).

        B::Deparse works for me on my linux system but not my windows systems.
        Mr. Muskrat shrugs...

        Added: Yes, 5.6.1 on Windows.

Re: The Most Cleverly Hidden Secret of All Time! (666th post)
by ihb (Deacon) on Apr 21, 2003 at 10:00 UTC

    I'm usually not overly excited by obfuscation, yet I read this thread and liked it.

    I'll upvote this not because I'm impressed by the obfu (haven't dissected it), but because the English surrounding it was pleasant to read. OK. Perhaps I got a bit disappointed when a piece of obfu was presented as the finale, but I still like to encourage well-written and enjoyable presentations.

    Keep up the good work,
    ihb

      Perhaps I got a bit disappointed when a piece of obfu was presented as the finale
      I'm sorry to let you down but it was my evil post. ;-)

      I worked on this post for a very long time (probably somewhere in the neighborhood of 18 to 24 hours over a period of about two weeks).

      It started out as a simple idea. As the obfuscation evolved, so too did my ideas for the surrounding text. I am quite sure that if I had went ahead with my original idea for the text, it would have received some very snide replies.

      Perhaps I'll even post my first draft of the obfuscation just so you all can have a good laugh at my expense.

Re: The Most Cleverly Hidden Secret of All Time! (666th post)
by halley (Prior) on Apr 17, 2003 at 14:32 UTC

    I don't know, but I am more impressed with obfuscations which actually run on a variety of valid installations. I'm not trying to be snide, but I think there's a fine line between the use of obscure language constructs, and the (ab)use of accidental implementation issues.

    I couldn't run this on Windows (ActiveState 5.6.0), nor on Solaris (5.005_03). Since there's no indication of what version of perl this expects, I'll try it on a Linux 5.8.0 when I get home. Maybe someone else can post a spoiler?

    --
    [ e d @ h a l l e y . c c ]

      I haven't used AS 5.6.0 in quite some time, and it's been even longer since I've used 5.005.

      I apologize for not specifying that this will probably only work on 5.6.1 or greater.

Re: The Most Cleverly Hidden Secret of All Time! (666th post)
by Mr. Muskrat (Canon) on Apr 17, 2003 at 16:50 UTC
    After much trial and error, I finally have it working with 5.6.1 and 5.8.0
Original Obfu Concept for The Most Cleverly Hidden Secret of All Time!
by Mr. Muskrat (Canon) on Apr 22, 2003 at 15:15 UTC

    The code is pretty bad but the text that I was going to use was even worse!

    #!/usr/bin/perl -w use strict; goto the_end; print "Wakka wakka wakka!\n"; the_middle: goto somewhere_else; $_='\x045\x067\x088\x069'; spaghetti: goto cheese; print eval($_); burger: goto with_fries; print "can't catch me!\n"; $!=3; covered_in_gravy: goto and_salt; do_not: goto go; print "Collect $200!"; stop: goto circles; squares: $_="Just Another Perl Hacker\n"; my $japh=die($_); goto &$japh; circles: goto squares; $_="He's evil I tell you!"; go: goto stop; $^=5; and_salt: goto do_not; print "Evil is afoot!\n"; dump; with_fries: goto covered_in_gravy; $"=','; cheese: goto burger; @_=qw(who is your daddy?); somewhere_else: goto spaghetti; print "Booyah!\n"; the_end: goto the_middle;

Re: The Most Cleverly Hidden Secret of All Time! (666th post)
by Acolyte (Hermit) on Apr 16, 2003 at 21:07 UTC
    I'm getting the following error in Win32:

    Goto undefined subroutine &main::1 at (file name here) line 8.
    Update: I tested on Windows 2000 with Perl 5.8.0 using the old cut and paste method to drop the code into notepad and save. After retesting the changes everything is working beautifully.

    Acolyte
    Studying at the feet of the masters
      I must say that you have me stumped with that error. How'd you save the code? What OS is this on? What version of Perl?
        This is Win2k Perl5.8.0 using cygwin.

        But then again, it is only Windows x-)
        janx

Deconstructing The Most Cleverly Hidden Secret of All Time!
by Mr. Muskrat (Canon) on Jun 07, 2003 at 23:43 UTC

    Don't read if you want to figure this out for yourself!

Re: The Most Cleverly Hidden Secret of All Time! (666th post)
by katgirl (Hermit) on Apr 22, 2003 at 14:26 UTC
    Huh?

    'perl.exe' is not recognized as an internal or external command, operable program or batch file. Use of uninitialized value in scalar assignment at Untitled line 8. Can't locate object method "" via package "main" (perhaps you forgot to load "main"?) at Untitled line 10.
      Thanks for the report. When I posted my last "bugfix", I inadvertantly changed one single character and that one character makes a big difference in the outcome.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-24 02:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found