Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Yes, that amused me when I tried it. My clue about deparse was in case anyone's perl wasn't called 'perl' or wasn't on the path; the deparsed version shows that part of how it works.

Here's a partially de-obfuscated version:

$_ = ( '_[]@^' ^ '/>/,~' ) . # 'perl ' '-' . # '-' ( '>]' ^ '[}' ) . # 'e ' '"' . # '"' ( '^])@*{.|~%{{]\\-' ^ './@.^[}(:`))}-\\' ) . # 'print STDERR qq' '(' . # '(' ( '*\\(]{\\./(@[-^-%^,{(!]+>^' ^ '@)[)[=@@\\(>_~]@,@[@@>@[,' ) . # 'just another perl hacker' '\\' . # '\' ( '.' ^ '@' ) . # 'n' ')"'; # ')"' `$_`

basically it's a concatenation of strings, using the bitwise xor operator '^' to generate alphanumeric characters, per chester's line noise JAPH. For example the 'p' in the first 'perl' comes by xoring '_' and '/':

perl -e "print '_' ^ '/'" p

Deparsing de-obfuscates it because the entire xoring and concatenation is made up of literals, so the compiler calculates the result and substitutes it into the compiled version. Deparse simply translates the compiled code back into Perl code. A simpler example might be:

perl -MO=Deparse -e "print 2 * 2" print 4; -e syntax OK

'2 * 2' is translated to '4' at compile time and deparse leaves it that way.

HTH

Roger

P.S. blokhead pointed out to me that this too has been done before!


In reply to Re^2: /^[^A-Za-z0-9 ]*$/ by Roger_B
in thread /^[^A-Za-z0-9 ]*$/ by Roger_B

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-03-28 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found