|
|
What is sickier than to write obfuscated programs? Write programs to obfuscate other programs? Close. What about writing obfuscated programs to obfuscate other programs? This is what the little horrors below are.
Disclaimer: Those obfuscating scripts are for entertainment purpose only. While they might ellicit sentiments of awe and delighted amazement in the breast of casual programmers, they are not (even remotely) serious encryption programs. Any Perl programmer worth his/her salt (and possessing a strong stomach) should be able to crack them in ten minutes flat. There, you've been warned.
#! /usr/bin/perl -p
# obfuscomatic.pl - your one-way ticket to the Perl Obfuscation Contest ;)
# perpetrated by Yanick Champoux (1/9/2000)
# usage: obfuscomatic days_before_expiration script.pl > encrypted.pl
BEGIN{$x='s!.!chr(ord($&)+1+0)!eg;';$t=shift@ARGV;}
END{$x=~s/\+/-/;$x=~s#0#'time()/'.(time+$t*86400)#e;
print"\n$0\n$x\$SIG{'__WARN__'}=sub{}; eval or die
\"Evaluation time expired\\n\";"}
$.==1 and $_.="\$_ = <<'$0';\n" and next; eval$x;
|
#! /usr/bin/perl -p
#usage: obfusc2 script.pl > obfuscated.pl
BEGIN{
$code=q!chomp;($a,$z)=(sort split'',$_)[0,-1];s/./chr(ord($z)-ord($&)+
ord($a))/eg;$_.="\n";!; }$.==1and print qq!$_\nfor(\@_=<DATA>){$code}
eval join'',\@_;\n__DATA__\n\n!and$_=''and next;eval$code;
|
#!/usr/bin/perl -p
#usage: obfusc3 script.pl > encrypted.pl
BEGIN{$_='s/./chr($x=(200+$x+ord$&)%200);/ge;';print
'$_=join"",<DATA>;',"$_;eval\n__DATA__\n";
s/chr\(\$x=/\$z=chr(/;s/;/;\$x=ord\$&;\$z/;s/\+/-/;
$code=$_;}eval$code;
|
#!/usr/bin/perl -p
#usage: obfusc4 script.pl > encrypted.pl
$y=('('.('.'x length).')')x2;s/$y/$2$1/g while $y=~s/\.\)/)/g;
BEGIN{ print ' while(<DATA>){ $y="(.)"x2;$y=~s/\(/(./g while s/$y/$2$1/g;eval}',
"\n__DATA__\n"; }
|
#!/smart2/bin/perl -n
#usage: obfusc5 script.pl > script.encrypted
#perpetred by Yanick Champoux (21/9/2001)
#The DATA segment can be removed from the script and given elsewhere
#as a validation key. To do only if you feel truly evil.
push@a,$_;END{@b=sort{$a[$a]cmp$a[$b]}1..$#a;print$a[0];$code='0`';
print <<'EOT';
open 0;my@a=<0>;for(split'`',<DATA>){for $d(split',',$_){$c[$d]=$a[$i];}$i++;}eval join '',@c;$x=<<'__END__';
EOT
for(@b){$code.=(($v=($a[$_]eq$last))?',':'`').($_+1);print$last=$a[$_]if!$v;
}print"\n__END__\n__DATA__\n$code\n";};
|
#!/usr/bin/perl -sp0
# usage: to encrypt -> muck script.pl > script.encoded
# to decrypt -> muck script.encoded > script.pl
$k{$1}++while/(\w+)/g;@a=sort keys%k;push@a,$a[-1]if@a%2;
%k=(@a,reverse@a);s/(\w+)/$k{$1}/g;
|