sunnamed434 / BitMono

Unlock new level of security with BitMono. Advanced code obfuscation that protects your intellectual property like never before. Try now!
https://bitmono.readthedocs.io/en/latest/
MIT License
298 stars 27 forks source link

FullRenamer on test app #162

Open Aetherinox opened 6 months ago

Aetherinox commented 6 months ago

Hey, came over here from ConfusedEx, and thus far this works much better. Thanks.

Originally when I used ConfusedEx, the main thing I wanted was obfuscated vars, methods, classes, etc.

I attempted to run the exe after using FullRenamer and the exe just flat out refuses to work. As soon as I open the executable, I get the windows hour glass for a split second, and then Windows pops up with "Did this install correctly?"

The "good" part is that I opened the exe in .NET Reflector and it does indeed throw off a bunch of bogus names, but there's just the slight issue of the exe not launching.

I guess my question is what is the best way to diagnose this to see exactly what is causing the issue.

The odd part is that I'm using a very simple app right now to test with. Basically just an interface with a button, and a single function which just returns a string. There's nothing terribly complicated about it. So if it's having issues with just that, I imagine a real app would be quite the pain.

Attached is the log

[2024-01-08 21:01:45 INF][BitMono.CLI.Modules.CLIObfuscationNeedsFactory] Please, specify file or drag-and-drop in BitMono CLI
[2024-01-08 21:02:01 INF][BitMono.CLI.Modules.CLIObfuscationNeedsFactory] File successfully specified: H:\NET\Tests\Source\bin\Release\SampleApp.exe
[2024-01-08 21:02:01 INF][BitMono.CLI.Modules.CLIObfuscationNeedsFactory] Dependencies (libs) directory was automatically found in: H:\NET\Tests\Source\bin\Release\libs!
[2024-01-08 21:02:01 INF][BitMono.CLI.Program] File: H:\NET\Tests\Source\bin\Release\SampleApp.exe
[2024-01-08 21:02:01 INF][BitMono.CLI.Program] Dependencies (libs): H:\NET\Tests\Source\bin\Release\libs
[2024-01-08 21:02:01 INF][BitMono.CLI.Program] Everything is seems to be ok, starting obfuscation..
[2024-01-08 21:02:01 INF][BitMono.CLI.Program] 
       ___  _ __  __  ___
      / _ )(_) /_/  |/  /__  ___  ___
     / _  / / __/ /|_/ / _ \/ _ \/ _ \
    /____/_/\__/_/  /_/\___/_//_/\___/
    https://github.com/sunnamed434/BitMono
    BitMono v0.20.0.0
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Module SampleApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=44acd75e5a0af3a4
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Module Target Framework: .NETFramework
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] PE TimeDateStamp: "2084-08-05T06:59:25.0000000"
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Module culture: ["u","n","k","n","o","w","n"]
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.Notifiers.ProtectionsNotifier] (1) Enabled protection(s): FullRenamer
[2024-01-08 21:02:03 WRN][BitMono.Obfuscation.Notifiers.ProtectionsNotifier] (15) Disabled protection(s): AntiDe4dot, AntiDebugBreakpoints, AntiDecompiler, AntiILdasm, BillionNops, BitDotNet, BitMethodDotnet, BitMono, BitTimeDateStamp, CallToCalli, DotNetHook, NoNamespaces, ObjectReturnType, StringsEncryption, UnmanagedString
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Running on Microsoft Windows NT 6.2.9200.0, .NETFramework v4.0.30319.42000, x64 bits
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Starting resolving dependencies...
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] References resolve have been completed!
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Executing Protections... this could take for a while...
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] FullRenamer -> OK
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] The protected module was saved in H:\NET\Tests\Source\bin\Release\output
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Protections have been executed!
[2024-01-08 21:02:03 INF][BitMono.Obfuscation.BitMonoObfuscator] Since obfuscation elapsed: 00:00:00.2245551

Running VS 2022 + .NET 4.8 Framework

sunnamed434 commented 6 months ago

Hey, yes you're right that large-scale apps can be more complex when using obfuscation, in this case (for example I don't use renamer for my projects, and some of them are quite complex), I recommend combining obfuscation somewhere bitmono somewhere confuserex and custom obfuscation, for the simple apps yes there might be problems with the renamer feature itself is unstable, so I'd recommend to either play with configuration and ignore some classes (strings) or edit the feature to make it work by your own or contribute to the project itself and fix it since I have now only time to answer to issues/approve PRs but not developing the project itself atm

About how to recognize the issue, just try-try and again try to change the obfuscation, add strings ignore put [ObfuscationAttribute] on top of your type, and check if it helps

Or just don't use Renamer because it is unstable, for example, I just don't use Renamer

Aetherinox commented 6 months ago

Yeah, I sort of figured renamer may be one of those hit-or-miss features. I did try a few alternative configs last night and then opened the exe up in reflector, and I'm not sure if I was just overly tired, or if I'm missing something. as an example, I had the following:

namespace MyNamespace
{
    class someClass
    {
          // class code
    }
}

I opted to not obfusfacte someclass, so in the config I attempted to add the entry

  "SpecificNamespacesObfuscationOnly": true,
  "SpecificNamespaces": [
    "MyNamespace.someClass",
  ],

Unless we only have control over the namespace itself, also tried internally by using

namespace MyNamespace
{

    [Obfuscation(Feature = "FullRenamer")] 
    public partial class FormParent : Form
    {

    }
}

And it still obfuscated in both instances. Like I said, I was extremely tired last night, so I'm going to try again today.

sunnamed434 commented 6 months ago

It could be a bug

sunnamed434 commented 2 months ago

Hi,

SpecificNamespace is more about to obfuscate only specific place i.e. specified namespaces, and nothing else