|laziness, impatience, and hubris|
Spiraling Death: not a boustrophedon.by Dog and Pony (Priest)
|on Feb 28, 2002 at 23:51 UTC||Need Help??|
I got the idea for this obfuscation from this utterly cool snippet by BooK, but this is in no way a rip-off. While the obfu by BooK executes code that is written as a boustrophedon, my obfu executes code that is written in a spiral, starting from the center of a code block and going outwards. Thus, the name "Spiraling Death", and the reference to boustrophedons in the title.
To examplify this, I also thought I'd better need some spiraling code, so this code will search a directory recursively, searching all files for a POD =head\d entry NAME or TITLE (case insensetive). If found, it will print the path and the NAME/TITLE of the file. Try it on your /usr/lib directory, or wherever perl has it's modules installed on your computer. The program takes the directory as a commandline parameter or defaults to the current directory. You must have File::Find installed, though.
The part before __END__ is the (obfuscated, of course) parser, that decodes and executes the spiraling code, which is of course after __END__. You can read it by finding the middle letter in both axis, then going first to the right, then down, then left, up, etc...
But wait! I am not finished yet. Maybe you would like to create your own spiraling code? Then you can use the following spirali(zi)ng code...
just stick whatever code you will want to "spiralize" into the variable $code, like the example shows. The number of letters in the code must be an even square (like the parser also is), like 49 (7*7), 81 (9*9) or 225 (15*15), or the program will die with a warning. This wouldn't be 100% necessary, but it made life much easier, and will produce a nice square block of code. If you are having trouble getting to an even sqaure, remember that whitespace counts too. You should avoid any newlines though. Just paste the output from this snippet after __END__ in the first program and try it! :)
The silly example should produce this:
and when run with the parser, print a message before it exits. Yep, very contrived. :)
Tips: If something seems to not work, you can add the classic ... or die "$@"; to the last line of the parser, the one with the eval. If something went wrong with the execution of your code, this will show something. Not that it most likely will help much, in this case...
This was all I had for today, and I hope someone will like it. :)
You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.