0

This is different than just obfuscating the final product. I wish to obfuscate the source code, so that it still can be read by the compiler, but it is significantly more difficult to read. This is an example for JavaScript:

https://www.javascriptobfuscator.com/Javascript-Obfuscator.aspx

It changes:

function NewObject(prefix)
{
var count=0;
this.SayHello=function(msg)
{
      count++;
      alert(prefix+msg);
}
this.GetCount=function()
{
      return count;
}
}
var obj=new NewObject("Message : ");
obj.SayHello("You are welcome.");

to:

var _0x1579=["\x53\x61\x79\x48\x65\x6C\x6C\x6F","\x47\x65\x74\x43\x6F\x75\x6E\x74","\x4D\x65\x73\x73\x61\x67\x65\x20\x3A\x20","\x59\x6F\x75\x20\x61\x72\x65\x20\x77\x65\x6C\x63\x6F\x6D\x65\x2E"];function NewObject(_0xc74ex2){var _0xc74ex3=0;this[_0x1579[0]]= function(_0xc74ex4){_0xc74ex3++;alert(_0xc74ex2+ _0xc74ex4)};this[_0x1579[1]]= function(){return _0xc74ex3}}var obj= new NewObject(_0x1579[2]);obj.SayHello(_0x1579[3])

Is there something like this for c#? Thanks.

Rob
  • 26,989
  • 16
  • 82
  • 98
  • Just about all the same transformations (renaming, encoding using hex codes) that work on Javascript source code can be used on C#, but WHY? Javascript source code has to be sent to the client, C# code can be shipped without source. – Ben Voigt Oct 29 '16 at 23:26
  • @BenVoigt indeed sorry, removed the comment as it doesn't apply to this question. – Jim Oct 29 '16 at 23:27
  • 3
    Why do you need to obfuscate the *source*? Why not distribute obfuscated binaries? Typically handing over a source file is done with the intention of the receiver being able to modify it. – Rob Oct 29 '16 at 23:27
  • Yes I am aware @BenVoigt that JS is sent through the client. This is in case I obfuscate it, and it is deobfuscated by the same program, the code is still a little harder to read. It's just something I want to do. – Mason Cooper Oct 29 '16 at 23:31
  • @MasonCooper: Deobfuscator will handle those tricks whether they were added by the obfuscator or previously present in the source code. Deobfuscator algorithm does NOT give back exactly what was fed into obfuscator. – Ben Voigt Oct 29 '16 at 23:33
  • Compile it, obfuscate the binary, then decompile that. Make the result your source code. Repeat until satisfied. –  Oct 29 '16 at 23:38

0 Answers0