#!/usr/bin/perl -w # This is the first attempt to write something useful to break all those # wonderful pieces-of-art that obfuscated code represents. How do they work? # How can i read them more easily? Is this Reverse Engineering? I just # started learning Perl and Obfuscation, and i wanted something to help when # learning from others' scripts. ASCII-art-formatted scripts are really hard # to read. this crumb of code helps a little, and I look for help to improve # it. For instance, it should detect and properly format regular expressions # which do not use regular "/" and hopefully better format loops! # And finally, how may the "enlightenment" come from "obfuscation" ? # Follow the light, and leave the Dark Side! ;-) # # (by the way, there's always something fascinating in darkness... # i like obfu!!! ;-P ) use strict; use vars '$output','$line'; $output = $ARGV[0].".deobfu"; open (INF, "< $ARGV[0]"); open (OUF, "> $output"); while () { $line .= $_; $line =~ s/\#(^\!).*\n//g; } $line =~ s/ +/ /g; $line =~ s/\t+/\t/g; $line =~ s/\n//g; $line =~ s/use /\nuse /g; $line =~ s/(qq)([\W])(\w*)([\W])/\"$3\"/g; $line =~ s/(q)([\W])(\w*)([\W])/\'$3\'/g; $line =~ s/\;/\;\n/g; $line =~ s/([\{||\}])/\n$1\n/g; print OUF $line; close (INF); close (OUF);