go ahead... be a heretic | |
PerlMonks |
Re^2: Self-constructing Japhby golux (Chaplain) |
on Nov 13, 2016 at 01:29 UTC ( [id://1175799]=note: print w/replies, xml ) | Need Help?? |
Sure, I'll try my best. :)
Here's what I did originally:
It's got some notes at the end, and I've added more comments to it just now, but it's essentially the same functionality as the final obfuscation with slightly differently formatted letters (the "H" got wider in the final version), and there wasn't any color added yet. Note that the reason it's drawn bottom-up is because to-down would obscure parts of the characters that have to be in "front", but would be overwritten by the sides that themselves need to be obscured. The easiest way to achieve this was to cheat and do it bottom-up. In contrast, here's the obfuscated version which has been fairly de-obfuscated:
There's a lot of standard "tricks" going on here, like using special variables in place of regular ones (such as $/ and $", and assigning $| to the print command, which simply turns off buffered output. And using $_ lets me do regex substitutions without the =~ operator, to keep the code size down. The redo command jumps back to reenter the large { ... } block, also with a minimum of chars. And chaining four ternary operators (...) ? (...) : (...) together makes it even harder to read. Anywhere you see \e[NNNm, you know it's doing something with Ansi colors -- 103 is yellow, 102 is green, and \e[m turns the color off. The sequence s,,2220;3500731;3522735071;1600715074;1622713,; constructs an encoded value into $_ "out of thin air". Then if you add some debugging: you can see how the encoded string is converted back a set of commands:
which still need to get parsed, but are a lot closer to the original sequence in the original program. I hope that answers some of your curiosity about the obfuscation. If you have any further questions don't hesitate to ask. And thanks for your interest! :D
In Section
Obfuscated Code
|
|