Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Trying to learn something about obfuscation

by Bismark (Scribe)
on Feb 06, 2003 at 18:06 UTC ( #233210=perlquestion: print w/replies, xml ) Need Help??
Bismark has asked for the wisdom of the Perl Monks concerning the following question:

I'll admit that I am probably getting way ahead of myself, but I have been looking at some of the obfuscation and some of it is just driving me crazy. Would someone please give me some hints as to how the following code could print out JaPh? I understand how it is printing, just do not see where the letters are coming from.
"Yet what are all such gaieties to me
Whose thoughts are full of indices and surds?"
quotes the Lama

Replies are listed 'Best First'.
Re: Trying to learn something about obfuscation
by gmax (Abbot) on Feb 06, 2003 at 20:19 UTC
Re: Trying to learn something about obfuscation
by rob_au (Abbot) on Feb 06, 2003 at 18:55 UTC
    In addition to the direction provided by Mr. Muskrat above, I would also point you to assistance which the perl compiler itself can provide when deciphering obfuscated code. For example, using the Deparse backend, a parsed version of the code can be generated which is invariably much more readable:

    rob@kathmandu:~$ perl -MO=Deparse -e 'die$;!~y//.-~/c.$;.([$^=~/./g]&~ +$").$&.($;&{}).$/' die !($; =~ tr//.-~/c) . $; . ([$^ =~ /./g] & ~$") . $& . ($; & {}) . +$/; -e syntax OK

    Note though that some code can be written to deliberately not be able to be parsed in this manner. The joy of obfuscation.


    perl -le 'print+unpack("N",pack("B32","00000000000000000000001000101011"))'

Re: Trying to learn something about obfuscation
by Mr. Muskrat (Canon) on Feb 06, 2003 at 18:42 UTC

    Start by breaking it down. Remember that y/// is the same as tr///.

    Looking at perlvar we see that $; is $SUBSCRIPT_SEPARATOR, $^ is $FORMAT_TOP_NAME, $" is $LIST_SEPARATOR, $& is $MATCH and $/ is $INPUT_RECORD_SEPARATOR.

    So what do we have now?


    That should as clear as mud :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://233210]
Approved by Paladin
[Corion]: marioroy: Oh, that's always cool, having API-compatible modules. This makes testing and comparing things much easier
[marioroy]: IPC in MCE::Shared can handle 400k (sends) per second. That's seems a lot for being a pure-Perl module. After making the release, will come back and post a solution for a node by a fellow wanting faster logging.
[Corion]: While working on WWW::Mechanize:: Chrome, I had the suspicion that AnyEvent was doing something wrong, but I was able to swap it out for Mojolicious and the error persisted.
[Corion]: Of course, the error was in my own code ;)
[marioroy]: Corion, start and start_child in MCE::Hobo::Manager return a MCE::Hobo object, whereas P::FM returns the PID. I can have it return the PID though. I tried Hobo::Manager with several P::FM modules, just changed P::FM to MCE::Hobo::Manager and it works.
[marioroy]: I also have a Hobo driver for Forklift allowing folks to use in multiple classes, no conflicts with one another. That's not possible for P::FM.
[Discipulus]: congrats marioroy!
[marioroy]: CORE::wait works well eventhough multiple instances or classes using Hobo::Manager.
[Corion]: marioroy: I'm not sure what the normal use for the PID is in P:FM, but I guess that most programs just ignore or log it

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2017-05-26 08:40 GMT
Find Nodes?
    Voting Booth?