Recently I've seen a number of Seekers who ask for ways of obfuscating production code. And although anybody will tell you it's a bad idea, I'd like to provide where there is a real demand. Service is my middle name.
Without further ado, I present you: the code obfuscator. It uses psychology, fear, doubt and uncertainty and the newest advances of modern science to deter all but the most daring and curious hackers.
#!/usr/bin/perl # --- highly optimized obfuscation coder ------------------------- +--------- # sub encode(@) { local $_ = q/ M(PHC($YO=&AI;F<@:7,@87,@:70@<V5E;7,N+BXN+@HC"B,@4&QE87-E(&)E M(&%W87)E('1H870@=&AE(&9O;&QO=VEN9R!C;V1E(&ES(&AI9VAL>2!O8F9U M<V-A=&5D('1O"B,@:&ED92!T:&4@9&5T86EL<R!O9B!I=',@:6UP;&5M96YT M871I;VX@9G)O;2!T:&4@<75E<W1I;F<@97EE+@HC"B,@4F5A9&EN9R!I="!M M87D@:6YD=6-E(&-O;F9U<VEO;BP@=&5M<&]R87)Y(&)L:6YD;F5S<R!A;F0@ M<&%R=&EA;`HC(&EN<V%N:71Y+B!";&%C:R!H;VQE<R!H879E(&)E96X@:VYO M=VX@=&\@;W!E;B!U<"!A;F0@<W=A;&QO=R!T:&4*(R!R96%D97(N($%N9"!E M=F5N('1H;W5G:"P@86-C;W)D:6YG('1O(&UO9&5R;B!S8VEE;F-E+"!I;B!S M=6-H(&$*(R!C87-E(&YO="!A;&P@:6YF;W)M871I;VX@:7,@;&]S="P@:70@ M=VEL;"!B92!C:&%N9V5D(&)E>6]N9"!D96-R>7!T:6]N+@HC"B,@4V\@8F4@ H=V%R;F5D.B`*(R!.;W1H:6YG(&ES(&%S(&ET('-E96US+BXN+@HC"@``/; s/^\s+//gm;splice@_,$_[0]=~/^#\s*!/?1:0,0,unpack'u',$_; join'',@_; } # --- process all files ------------------------------------------ +--------- # foreach (@ARGV) { if (open my $fp, $_) { print encode<$fp> } else { warn "can't open $_:$!\n" } } __END__ =head1 NAME obfucoder -- Obfuscate files for all but the most daring readers =head1 SYNOPSIS obfucode filename ... =head1 DESCRIPTION This coder reads the files that are pased to it on the command line and encode them using an obfuscation method based on modern advances in science and psychology, so that only the most hardened, daring and curious hacker will attempt to read more than the first couple of lines. =head1 AUTHOR Red "Service" Lemon
Grain-of-Salt department
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Code Obfuscator
by Jaap (Curate) on Jan 25, 2005 at 15:56 UTC | |
by wolfger (Deacon) on Jan 25, 2005 at 19:26 UTC |