Very interesting. Of course, it will break obfuscated
scripts that require a certain whitespace alignment, but
it does a pretty good job. Here's how it did on one of
my shorter ones. First, the original:
open(0,$0);$/=$;;<0>=~m{(ET / /).*(C[^\*]+)}s;$b=$1;($G=$g=$2)
=~s/.*(en).*/s$1d(t,/s;$_=join');',S($g),S($g),"$G\"G$b\n\n\",
0","\$/=<t>";substr($_,26,1,'"'.pack("cx2c5x8",2,80,209,85,3,
25).'"');sub S{split(//,shift);$_[3]=chr(ord($_[3])-($*?6:9));
$_[5]=chr(ord($_[5])-($*?11:-6));$_[7]='(t,';if(!$*++){$_[8]=
join(',',split(/5?/,(ord($_[10])+104)));$_[2]='c';$_[6]="";
$_[0]='s'}$#_=8;lc join('',@_);}$_=eval;s/.*\r\n//s;
s#(<[^>]+>)*(\w{0,2})#"$1<FONT COLOR=".(int rand 999999).">
$2</FONT>"#eg;print;#Content-type
And now, the perltidy version:
open( 0, $0 );
$/ = $;;
<0> =~ m{(ET / /).*(C[^\*]+)}s;
$b = $1;
( $G = $g = $2 ) =~ s/.*(en).*/s$1d(t,/s;
$_ = join ');', S($g), S($g), "$G\"G$b\n\n\",
0", "\$/=<t>";
substr( $_, 26, 1, '"' . pack( "cx2c5x8", 2, 80, 209, 85, 3, 25 ) . '"
+' );
sub S {
split ( //, shift );
$_[3] = chr( ord( $_[3] ) - ( $* ? 6 : 9 ) );
$_[5] = chr( ord( $_[5] ) - ( $* ? 11 : -6 ) );
$_[7] = '(t,';
if ( !$*++ ) {
$_[8] = join ( ',', split ( /5?/, ( ord( $_[10] ) + 104 ) ) );
$_[2] = 'c';
$_[6] = "";
$_[0] = 's';
}
$#_ = 8;
lc join ( '', @_ );
}
$_ = eval;
s/.*\r\n//s;
s#(<[^>]+>)*(\w{0,2})#"$1<FONT COLOR=".(int rand 999999).">
$2</FONT>"#eg;
print; #Content-type
Not bad. I like it. Always meant to write some sort
of de-obfuscator myself. This is a good start, the next
obvious step would be to have it replace those oft-used
global vars with something simpler like $x,$y, etc..
|