in reply to The Raven

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 ;)

Replies are listed 'Best First'.
Re: Re: The Raven
by Beatnik (Parson) on Dec 26, 2001 at 14:27 UTC
    Nice work :)

    Anyway, on the shape by hand comment... I tried that the first 10 attempts :) and eventually just wrote a small script. Squeezing filler chars in without cheating is quit hard, since the statements on the second last line can't have space in em. Anyway, the raven was my first obfu art. I'll try harder next time :))

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.