Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The program cannot be started after obfuscation #141

Open
darkSuperman opened this issue Aug 14, 2023 · 16 comments
Open

The program cannot be started after obfuscation #141

darkSuperman opened this issue Aug 14, 2023 · 16 comments
Labels
bug Something isn't working

Comments

@darkSuperman
Copy link

darkSuperman commented Aug 14, 2023

[2023-08-14 16:34:45 INF][BitMono.CLI.Program] Everything is seems to be ok, starting obfuscation..
[2023-08-14 16:34:45 INF][BitMono.CLI.Program]
       ___  _ __  __  ___
      / _ )(_) /_/  |/  /__  ___  ___
     / _  / / __/ /|_/ / _ \/ _ \/ _ \
    /____/_/\__/_/  /_/\___/_//_/\___/
    https://github.com/sunnamed434/BitMono
    BitMono v0.16.2.0
[2023-08-14 16:34:46 INF][BitMono.Obfuscation.BitMonoObfuscator] Module ***, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[2023-08-14 16:34:46 INF][BitMono.Obfuscation.BitMonoObfuscator] Module Target Framework: .NETCoreApp
[2023-08-14 16:34:46 INF][BitMono.Obfuscation.BitMonoObfuscator] PE TimeDateStamp: 04/16/2105 12:16:23
[2023-08-14 16:34:46 INF][BitMono.Obfuscation.BitMonoObfuscator] Module culture: ["u", "n", "k", "n", "o", "w", "n"]
[2023-08-14 16:34:46 INF][BitMono.Obfuscation.Notifiers.ProtectionsNotifier] (5) Enabled protection(s): BitMethodDotnet, AntiDecompiler, BitTimeDateStamp, BitDotNet, BitMono
[2023-08-14 16:34:46 WRN][BitMono.Obfuscation.Notifiers.ProtectionsRuntimeMonikerNotifier] [!!!] AntiDecompiler - Intended for Mono runtime
[2023-08-14 16:34:46 WRN][BitMono.Obfuscation.Notifiers.ProtectionsRuntimeMonikerNotifier] [!!!] BitDotNet - Intended for Mono runtime
[2023-08-14 16:34:46 WRN][BitMono.Obfuscation.Notifiers.ProtectionsRuntimeMonikerNotifier] [!!!] BitMono - Intended for Mono runtime
[2023-08-14 16:34:46 WRN][BitMono.Obfuscation.Notifiers.ProtectionsNotifier] (10) Disabled protection(s): AntiDe4dot, AntiDebugBreakpoints, AntiILdasm, CallToCalli, DotNetHook, FullRenamer, NoNamespaces, ObjectReturnType, StringsEncryption, UnmanagedString
[2023-08-14 16:34:46 INF][BitMono.Obfuscation.BitMonoObfuscator] Running on Microsoft Windows NT 6.1.7601 Service Pack 1, .NETFramework v4.0.30319.42000, x64 bits
[2023-08-14 16:34:46 INF][BitMono.Obfuscation.BitMonoObfuscator] Starting resolving dependencies...
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: PresentationFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: PresentationCore, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Collections, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Net.NetworkInformation, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Diagnostics.Process, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: RestSharp, Version=106.12.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Security.Cryptography.X509Certificates, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Net.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Xaml, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Net.Sockets, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Security.Cryptography.Csp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Security.Cryptography.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.IO.FileSystem, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Security.Cryptography.Algorithms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.ComponentModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: ViewFaceCore, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: SkiaSharp, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Drawing.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: QRCoder, Version=1.4.3.0, Culture=neutral, PublicKeyToken=c4ed5b9ae8358a28
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: QRCoder.Xaml, Version=1.4.3.0, Culture=neutral, PublicKeyToken=8ca57126c5670df7
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: WindowsFormsIntegration, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Net.Requests, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Net.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Linq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Net.Security, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Threading, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.ComponentModel.TypeConverter, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: ViewFaceCore.Extension.SkiaSharp, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Text.RegularExpressions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Runtime.InteropServices, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Console, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Net.ServicePoint, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Net.WebHeaderCollection, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: OpenCvSharp.WpfExtensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: PresentationFramework, Version=5.0.17.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: PresentationCore, Version=5.0.17.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: WindowsBase, Version=5.0.17.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Xaml, Version=5.0.17.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Private.Uri, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: WindowsFormsIntegration, Version=5.0.17.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Successfully resolved dependency: System.Windows.Forms, Version=5.0.17.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] References resolve have been completed!
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] Executing Protections... this could take for a while...
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] BitMethodDotnet -> OK
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] AntiDecompiler -> OK
[2023-08-14 16:34:47 INF][BitMono.Obfuscation.BitMonoObfuscator] AntiDnSpyAnalyzer -> OK
[2023-08-14 16:34:48 INF][BitMono.Obfuscation.BitMonoObfuscator] The protected module was saved in ***\output
[2023-08-14 16:34:48 INF][BitMono.Obfuscation.BitMonoObfuscator] BitTimeDateStamp -> OK
[2023-08-14 16:34:48 INF][BitMono.Obfuscation.BitMonoObfuscator] BitDotNet -> OK
[2023-08-14 16:34:48 INF][BitMono.Obfuscation.BitMonoObfuscator] BitMono -> OK
[2023-08-14 16:34:48 INF][BitMono.Obfuscation.BitMonoObfuscator] Protections have been executed!
[2023-08-14 16:34:48 INF][BitMono.Obfuscation.BitMonoObfuscator] Since obfuscation elapsed: 00:00:01.3051686
Enter anything to exit!
{
  "Protections": [
    {
      "Name": "AntiILdasm",
      "Enabled": false
    },
    {
      "Name": "AntiDe4dot",
      "Enabled": false
    },
    {
      "Name": "ObjectReturnType",
      "Enabled": false
    },
    {
      "Name": "NoNamespaces",
      "Enabled": false
    },
    {
      "Name": "FullRenamer",
      "Enabled": false
    },
    {
      "Name": "AntiDebugBreakpoints",
      "Enabled": false
    },
    {
      "Name": "StringsEncryption",
      "Enabled": false
    },
    {
      "Name": "UnmanagedString",
      "Enabled": false
    },
    {
      "Name": "DotNetHook",
      "Enabled": false
    },
    {
      "Name": "CallToCalli",
      "Enabled": false
    },
    {
      "Name": "AntiDecompiler",
      "Enabled": true
    },
    {
      "Name": "BitMethodDotnet",
      "Enabled": true
    },
    {
      "Name": "BitTimeDateStamp",
      "Enabled": true
    },
    {
      "Name": "BitDotNet",
      "Enabled": true
    },
    {
      "Name": "BitMono",
      "Enabled": true
    }
  ]
}
@sunnamed434
Copy link
Owner

Hey, this is because you're using protections which are working only with Mono runtime - specifically Unity, not a NET Core applications

When you see log in console at the start that says - 'Protection is intended for Mono' then don't use it, it's not compatible without specific runtime runned on top of the NET

@darkSuperman
Copy link
Author

So how can I do it, please suggest me. Copy the BitMono.cs file in BitMono.Protections and put it in my project?

@sunnamed434
Copy link
Owner

Simply install some of the mono versions, let's say the 5.2.0

After installation run the Mono.exe and provide path to your application, and it will be runned, iirc it work only with .exe files or make another dummy exe file and load your dll application via assembly load and reflection

@darkSuperman
Copy link
Author

If I don’t need Mono runtime and just want the simplest obfuscation and protection, I try to enable only AntiILdasm, AntiDe4dot, and StringsEncryption, which are three options, and the other options are not enabled. The output log indicates success, but the program still cannot be started. Forgive my little knowledge about obfuscating and protecting dll files...T^T

@sunnamed434
Copy link
Owner

I guess it won't work because your application is .NET (Core) and the BitMono application is running on .NET Framework 462, to fix this issue we gonna need to add a .NET Core support in the BitMono as additional target framework

@sunnamed434 sunnamed434 added the bug Something isn't working label Aug 15, 2023
@darkSuperman
Copy link
Author

Looking forward to supporting .NET (Core) earlier, .NET Framework is very old, and there are very few programs based on .NET Framework, thank you for your work. :)

@sunnamed434
Copy link
Owner

Not this month obviously, but I'll start doing this time-by-time by at least creating a new branch, thanks ; )

@sunnamed434
Copy link
Owner

Let me know how it work with new version

@darkSuperman
Copy link
Author

darkSuperman commented Sep 5, 2023

Hello, I tried it, and an error occurred. My program is packaged based on .Net 6. obfuscation.json is not changed by default. The error log and protections.json are as follows:

[2023-09-05 10:55:04 INF][BitMono.CLI.Modules.CLIObfuscationNeedsFactory] Please, specify file or drag-and-drop in BitMono CLI
"E:\Pa\BZY\Application Files\Demo_\Demo.exe"
[2023-09-05 10:55:08 INF][BitMono.CLI.Modules.CLIObfuscationNeedsFactory] File successfully specified: ***\Demo.exe
[2023-09-05 10:55:08 INF][BitMono.CLI.Modules.CLIObfuscationNeedsFactory] Dependencies (libs) directory was automatically found in: ***\libs!
[2023-09-05 10:55:08 INF][BitMono.CLI.Program] File: ***\Demo.exe
[2023-09-05 10:55:08 INF][BitMono.CLI.Program] Dependencies (libs): ***\libs
[2023-09-05 10:55:08 INF][BitMono.CLI.Program] Everything is seems to be ok, starting obfuscation..
[2023-09-05 10:55:08 INF][BitMono.CLI.Program]
       ___  _ __  __  ___
      / _ )(_) /_/  |/  /__  ___  ___
     / _  / / __/ /|_/ / _ \/ _ \/ _ \
    /____/_/\__/_/  /_/\___/_//_/\___/
    https://github.com/sunnamed434/BitMono
    BitMono v0.18.0.0
Something went wrong! System.BadImageFormatException: Input PE image does not contain a .NET metadata directory.
   at AsmResolver.DotNet.Serialized.SerializedModuleDefinition..ctor(IPEImage peImage, ModuleReaderParameters readerParameters)
   at AsmResolver.DotNet.ModuleDefinition.FromImage(IPEImage peImage, ModuleReaderParameters readerParameters)
   at AsmResolver.DotNet.ModuleDefinition.FromBytes(Byte[] buffer, ModuleReaderParameters readerParameters)
   at BitMono.Obfuscation.Modules.ModuleFactory.Create()
   at BitMono.Obfuscation.Starter.BitMonoStarter.StartAsync(FinalFileInfo info, IModuleFactory moduleFactory, IDataWriter dataWriter, IReferencesDataResolver referencesDataResolver, CancellationToken cancellationToken)
   at BitMono.Obfuscation.Starter.BitMonoStarter.StartAsync(IncompleteFileInfo info, CancellationToken cancellationToken)
   at BitMono.CLI.Program.Main(String[] args)
   at BitMono.CLI.Program.Main(String[] args)
Enter anything to exit!
{
  "Protections": [
    {
      "Name": "AntiILdasm",
      "Enabled": true
    },
    {
      "Name": "AntiDe4dot",
      "Enabled": true
    },
    {
      "Name": "ObjectReturnType",
      "Enabled": true
    },
    {
      "Name": "NoNamespaces",
      "Enabled": true
    },
    {
      "Name": "FullRenamer",
      "Enabled": true
    },
    {
      "Name": "AntiDebugBreakpoints",
      "Enabled": true
    },
    {
      "Name": "StringsEncryption",
      "Enabled": true
    },
    {
      "Name": "UnmanagedString",
      "Enabled": true
    },
    {
      "Name": "DotNetHook",
      "Enabled": true
    },
    {
      "Name": "CallToCalli",
      "Enabled": false
    },
    {
      "Name": "AntiDecompiler",
      "Enabled": false
    },
    {
      "Name": "BitMethodDotnet",
      "Enabled": false
    },
    {
      "Name": "BitTimeDateStamp",
      "Enabled": false
    },
    {
      "Name": "BitDotNet",
      "Enabled": false
    },
    {
      "Name": "BitMono",
      "Enabled": false
    }
  ]
}

@sunnamed434
Copy link
Owner

Hello, I tried it, and an error occurred. My program is packaged based on .Net 6. obfuscation.json is not changed by default. The error log and protections.json are as follows:

[2023-09-05 10:55:04 INF][BitMono.CLI.Modules.CLIObfuscationNeedsFactory] Please, specify file or drag-and-drop in BitMono CLI
"E:\Pa\BZY\Application Files\Demo_\Demo.exe"
[2023-09-05 10:55:08 INF][BitMono.CLI.Modules.CLIObfuscationNeedsFactory] File successfully specified: ***\Demo.exe
[2023-09-05 10:55:08 INF][BitMono.CLI.Modules.CLIObfuscationNeedsFactory] Dependencies (libs) directory was automatically found in: ***\libs!
[2023-09-05 10:55:08 INF][BitMono.CLI.Program] File: ***\Demo.exe
[2023-09-05 10:55:08 INF][BitMono.CLI.Program] Dependencies (libs): ***\libs
[2023-09-05 10:55:08 INF][BitMono.CLI.Program] Everything is seems to be ok, starting obfuscation..
[2023-09-05 10:55:08 INF][BitMono.CLI.Program]
       ___  _ __  __  ___
      / _ )(_) /_/  |/  /__  ___  ___
     / _  / / __/ /|_/ / _ \/ _ \/ _ \
    /____/_/\__/_/  /_/\___/_//_/\___/
    https://github.com/sunnamed434/BitMono
    BitMono v0.18.0.0
Something went wrong! System.BadImageFormatException: Input PE image does not contain a .NET metadata directory.
   at AsmResolver.DotNet.Serialized.SerializedModuleDefinition..ctor(IPEImage peImage, ModuleReaderParameters readerParameters)
   at AsmResolver.DotNet.ModuleDefinition.FromImage(IPEImage peImage, ModuleReaderParameters readerParameters)
   at AsmResolver.DotNet.ModuleDefinition.FromBytes(Byte[] buffer, ModuleReaderParameters readerParameters)
   at BitMono.Obfuscation.Modules.ModuleFactory.Create()
   at BitMono.Obfuscation.Starter.BitMonoStarter.StartAsync(FinalFileInfo info, IModuleFactory moduleFactory, IDataWriter dataWriter, IReferencesDataResolver referencesDataResolver, CancellationToken cancellationToken)
   at BitMono.Obfuscation.Starter.BitMonoStarter.StartAsync(IncompleteFileInfo info, CancellationToken cancellationToken)
   at BitMono.CLI.Program.Main(String[] args)
   at BitMono.CLI.Program.Main(String[] args)
Enter anything to exit!
{
  "Protections": [
    {
      "Name": "AntiILdasm",
      "Enabled": true
    },
    {
      "Name": "AntiDe4dot",
      "Enabled": true
    },
    {
      "Name": "ObjectReturnType",
      "Enabled": true
    },
    {
      "Name": "NoNamespaces",
      "Enabled": true
    },
    {
      "Name": "FullRenamer",
      "Enabled": true
    },
    {
      "Name": "AntiDebugBreakpoints",
      "Enabled": true
    },
    {
      "Name": "StringsEncryption",
      "Enabled": true
    },
    {
      "Name": "UnmanagedString",
      "Enabled": true
    },
    {
      "Name": "DotNetHook",
      "Enabled": true
    },
    {
      "Name": "CallToCalli",
      "Enabled": false
    },
    {
      "Name": "AntiDecompiler",
      "Enabled": false
    },
    {
      "Name": "BitMethodDotnet",
      "Enabled": false
    },
    {
      "Name": "BitTimeDateStamp",
      "Enabled": false
    },
    {
      "Name": "BitDotNet",
      "Enabled": false
    },
    {
      "Name": "BitMono",
      "Enabled": false
    }
  ]
}

Hey, you need to obfuscate the .dll file which contains inside all managed code for .exe file, the .exe file is kinda compiled in native code

@darkSuperman
Copy link
Author

I only confuse the dll, but there are some error logs in the console, and the obfuscated dll file is output, and the program cannot start using the obfuscated dll file. Please see the attachment for the log

errolog.txt

@sunnamed434
Copy link
Owner

So interesting, will see what can be done to fix that

@sunnamed434
Copy link
Owner

Hey!
Check if new version solves the problem

@sunnamed434
Copy link
Owner

and don't forget to use BitMono-v0.19.0-alpha.34-CLI-net6.0.zip, not a net framework build

@darkSuperman
Copy link
Author

I'm sorry to tell you that an error still occurs and the program cannot be started after obfuscation. Attach log files and protections.json files.
bitmono-2023-10-12-17-26-45.log
protections.json

@sunnamed434
Copy link
Owner

From your logs:

[2023-10-12 17:27:25 INF][BitMono.Obfuscation.Notifiers.ProtectionsNotifier] (10) Enabled protection(s): AntiILdasm, AntiDe4dot, ObjectReturnType, NoNamespaces, FullRenamer, AntiDebugBreakpoints, StringsEncryption, UnmanagedString, DotNetHook, BitMono
[2023-10-12 17:27:25 WRN][BitMono.Obfuscation.Notifiers.ProtectionsRuntimeMonikerNotifier] [!!!] UnmanagedString - Intended for .NET Core runtime
[2023-10-12 17:27:25 WRN][BitMono.Obfuscation.Notifiers.ProtectionsRuntimeMonikerNotifier] [!!!] UnmanagedString - Intended for .NET Framework runtime
[2023-10-12 17:27:25 WRN][BitMono.Obfuscation.Notifiers.ProtectionsRuntimeMonikerNotifier] [!!!] BitMono - Intended for Mono runtime
[2023-10-12 17:27:25 WRN][BitMono.Obfuscation.Notifiers.ProtectionsNotifier] (5) Disabled protection(s): AntiDecompiler, BitDotNet, BitMethodDotnet, BitTimeDateStamp, CallToCalli
[2023-10-12 17:27:25 INF][BitMono.Obfuscation.BitMonoObfuscator] Running on Microsoft Windows NT 10.0.19045.0, .NETFramework v6.0.21, x64 bits

BitMono can not work the output file, because it works only with Mono runtime, not .NET (Core)
When you see Intended for Mono runtime, don't use this protection.

Try to run the obfuscation only with AntiDe4dot, and test if the output file works (just for testing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants