Obfuscated Code

ObfuscatedCode is code that has been made very hard to re-engineer and understand due to intended obfuscation. Writing ObfuscatedCode is a very bad way to try and ensure some JobSecurity.


There are tools written specifically to obfuscate code. For instance, if you write a class in any .NET language, it is extremely easy to decompile it. Everything except local variable names will be exactly the same. RemoteSoft, for instance, made Salamander .NET decompiler, which decompiles .NET code quite nicely. However, that code can be obfuscated to a certain extent by changing all function names to random names. To obfuscate it even more, you have to link it with .Net's internal functions, and obfuscate those names as well. -- DorKleiman

There are also tools written to specifically deobfuscate code. PerlLanguage has B::Deparse, which generates Perl source code based on the internal compiled structure that perl itself creates after parsing a program, and B::Deobfuscate, which adds symbol renaming functions to Deparse. Running the latter on the following chunk of line noise

 $q=q+s~|})jwx}qn{)yn{u)qjltn{)+;$l=5**2;sub ntljq{chr @_->[0];}sub xwj
 {substr@_->[0],@_->[1],@_->[2];}sub qn{print@_->[0].qq#\n\n#;}$t=0;sub
 ny{ord @_->[0];}while($t<$l){$y.=ntljq(ny(xwj($q,$t++,1))-9,);}&qn($y)

produces the following (using the default list of words for symbol naming):

 $q = 's~|})jwx}qn{)yn{u)qjltn{)';
 $stethoscope = 25;
 sub performance {
     chr @_->[0];
 }
 sub paperweight {
     substr @_->[0], @_->[1], @_->[2];
 }
 sub millionaire {
     print @_->[0] . "\n\n";
 }
 $chambermaid = 0;
 sub businessman {
     ord @_->[0];
 }
 while ($chambermaid < $stethoscope) {
     $y .= performance(businessman(paperweight($q, $chambermaid++, 1)) - 9);
 }
 &millionaire($y);

(It prints "just another perl hacker".) Of course, Perl has long had a tradition of people writing ObfuscatedCode for fun (see http://www.perlmonks.org/index.pl?node=Obfuscated%20Code , where the above example came from).


EditText of this page (last edited July 9, 2004) or FindPage with title or text search