Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Very nice. Although I had to cheat (had to print em) to figure out the unpack/pack combo, I was able so solve every thing else by hand. I had fun de-obfuing it. Note that the deobfu won't run the same as the original because spacing matters.

# A long string containing code is assigned to $raven. Colons # are actually spaces, as you will see later: my$raven=' # I admit, I had to cheat here; I actually had to print these # out to find out what they are. But then again, its pack # and unpack, its near impossible to solve them by hand... # Btw, a hint on the unpack one: it is actually quoted with # a q||, its not a bareword. the unpack one is in unicode, # which is translated to ascii; the pack is in hex (the * # means "apply to all characters"), and it returns a list # (which is ok, since print accepts a list!) # oh, and btw, these print the title. print:unpack("u",q|=5&AE(%)A=F5N(&)Y($5D9V%R($%L;&5N(%!O90H`|); print:pack("H*","51756f74682074686520726176656e203a0a"); # open $0 (the name of the file this is in) and assign it to # the filehandle LENORE. The < means the handle is for reading # only. open(LENORE,"<$0")||die$!; # $bird = 'nevermore'; $bird=q|nevermore|; # @saying = ('n', 'e', 'v', 'e', 'r', 'm', 'o', 'r', 'e'); @saying=split(//,$bird); # get rid of the shebang by using the filehandle in void context; # since the source code of the file is in <LENORE> because of # the open, using it in void context is kind of like shift(ing) it. <LENORE>; # same context to get rid of blank line <LENORE>; # loop through the rest of LENORE for(<LENORE>) { # replac all non space characters with a colon # \x3a is a colon btw :) (its in hex; 3a = 58 in # decimal; the \x "chr(s)" it; print chr(58) if # you don't believe me :) s|\S|\x3a|g; # globally replace all spaces (\x20 is a space; also, the # shape of ascii art is a silhoutte of a raven; the # silhoutte is what is being modified) with # '$saying[int$t++%9]', the e modifier makes it eval it, # below is an explanation of the inside: # first of all, the reason for the non-strict and # non-warnings is because $t is never declared. It # starts off at 0, and gets ++(ed) every pass through # the loop. Next, it gets modulus(ed) by 9, which # happens to be the size of @saying ($#saying). # Finally, this value is int(ed) so the value is an # integer. In this way, the phrase 'nevermore' is # "looped" through. s|\x20|$saying[int$t++%9]|ge; # $_ (current value of <LENORE>) is printed. print; # loop ends } # filehandle closed like a good boy ;) close(LENORE); # raven is end-quoted. '; # $_ is set to $raven $_=$raven; # all spaces are removed. $_=~s/\s//gx; # colons are changed to spaces; $_=~s/\x3a/\x20/g;eval # the whole bloody think is evalled (meaning all # of the code in $raven is evalled since $_ was # set to $raven. # ick sloppy! I need to show you guys a few tricks # to avoid things like this in shaping ;) ;;;;

P.S, don't be a panzy, shape by hand next time ;)


In reply to Re: The Raven by jryan
in thread The Raven by Beatnik

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 contemplating the Monastery: (5)
As of 2024-04-26 08:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found