Skip to content

Commit 61cc6dd

Browse files
authored
Merge pull request #199 from sunnamed434/updates
Updates
2 parents e64e54d + 46bba8b commit 61cc6dd

File tree

59 files changed

+429
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+429
-202
lines changed

.editorconfig

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,12 @@ indent_style = space
1111

1212
[*.{proj,csproj,vbproj,props,targets,resx,vsixmanifest}]
1313
indent_size = 2
14-
indent_style = space
14+
indent_style = space
15+
16+
[*.cs]
17+
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0290
18+
csharp_style_prefer_primary_constructors = false
19+
dotnet_diagnostic.IDE0290.severity = none
20+
21+
# https://www.jetbrains.com/help/rider/ConvertToPrimaryConstructor.html
22+
resharper_convert_to_primary_constructor_highlighting = none

README.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
[![MIT License][image_license]][license]
99
[![BitMono Discord][image_bitmono_discord]][bitmono_discord]
1010

11-
BitMono is a free, open-source C# obfuscator designed mainly for Mono, a version of the .NET framework used by Unity and other platforms. You can use it with the full .NET framework, but some features might not work as expected. Some protections work with .NET Core but not Mono.
11+
BitMono is a free, open-source C# obfuscator that was initially designed and intended mainly for Mono, however, now you're feel free to use it for any .NET app, but, be careful some protections work on .NET Framework, some on .NET, some on Mono, some on Unity only.
1212

13-
BitMono uses [AsmResolver][asmresolver] instead of dnlib for handling assemblies. If you have questions or issues, please let us know [here][bitmono_issues]. Download the latest version of BitMono [here][bitmono_releases].
13+
BitMono uses [AsmResolver][asmresolver] instead of [dnlib][dnlib] (which we used in the past) for handling assemblies. If you have questions or issues, please let us know [here][bitmono_issues]. Download the latest version of BitMono [here][bitmono_releases].
1414

1515
You can also use BitMono as an engine to build custom obfuscators. It is built using dependency injection (DI) using Autofac and follows the latest C# best practices.
1616

@@ -83,6 +83,16 @@ Read the **[docs][bitmono_docs]** to read protection, functionality, and more.
8383

8484
## Usage
8585

86+
### Download
87+
88+
Go and get [Latest BitMono Release][bitmono_latest_release] and download preferred archive file, and make sure to select the similar or same Target Framework of the app that you are going to protect, for example:
89+
90+
- Your Target File is for .NET 8 then use BitMono for .NET 8 `BitMono-v0.25.3+e64e54d3-CLI-net8.0-win-x64.zip`
91+
- Your Target File is for .netstandard then use BitMono for .NET Framework or .NET 8 `BitMono-v0.25.3+e64e54d3-CLI-net8.0-win-x64.zip`
92+
- Your Target File is .NET Framework then use BitMono for .NET Framework `BitMono-v0.25.3+e64e54d3-CLI-net462-win-x64.zip`
93+
94+
If you select wrong BitMono build you have a risk that your file going to be protected incorrectly, because you use different target framework build.
95+
8696
### Pre-Require
8797

8898
Set one of setting from `protections.json` to `true`.
@@ -188,6 +198,7 @@ Credits
188198
[license]: https://github.com/sunnamed434/BitMono/blob/main/LICENSE
189199
[previews]: https://github.com/sunnamed434/BitMono/blob/main/PREVIEWS.md
190200
[asmresolver]: https://github.com/Washi1337/AsmResolver
201+
[dnlib]: https://github.com/0xd4d/dnlib
191202
[bitmono_issues]: https://github.com/sunnamed434/BitMono/issues
192203
[bitmono_releases]: https://github.com/sunnamed434/BitMono/releases
193204
[bitmono_docs]: https://bitmono.readthedocs.io/en/latest/
@@ -207,6 +218,7 @@ Credits
207218
[author_kao_blog]: https://lifeinhex.com/
208219
[author_drakonia]: https://github.com/dr4k0nia
209220
[author_sunnamed434]: https://github.com/sunnamed434
221+
[bitmono_latest_release]: https://github.com/sunnamed434/BitMono/releases/latest
210222
[bitmono_discord]: https://discord.gg/sFDHd47St4
211223

212224
[troubleshooting]: https://github.com/sunnamed434/BitMono/blob/main/troubleshooting.md
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Native Code
2+
###########
3+
4+
If you want to use a native code in the protection you must do the following:
5+
6+
7+
.. code-block:: csharp
8+
9+
[ConfigureForNativeCode] // Add this attribute on top of the protection class
10+
public class CustomProtection : Protection
11+
12+
13+
A good example is ``UnmanagedString`` protection. It uses native code to encrypt strings. You can find the source code in the ``UnmanagedString`` file.
14+
15+
This thing is so important to do, before actually it was automatically done before the obfuscation without any attributes, however we found that this might break an app, because it changes the architecture of the app, so we decided to make it optional.

docs/source/developers/obfuscation-execution-order.rst

+12-11
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ BitMono uses its own obfuscation execution order which is good to be known, and
77
2. Output Information about BitMono (example, is it intended for .NET Core or Mono or .NET Framework, etc.) and running OS, etc.
88
3. Output Compatibility Issues in case of module is built for .NET Framework, but BitMono is running on .NET Core, or vice versa.
99
4. Sort Protections
10-
5. Basic output information about Protections
11-
6. Elapsed time counter
12-
7. Resolve References
13-
8. Expand Macros
14-
10. Run Protection, PipelineProtection and child pipeline protections
10+
5. Information about Protections
11+
6. Configuration for Native Code
12+
7. Elapsed time counter
13+
8. Resolve References
14+
9. Expand Macros
15+
11. Run Protection, PipelineProtection and child pipeline protections
1516

1617

1718
.. code-block:: csharp
@@ -21,16 +22,16 @@ BitMono uses its own obfuscation execution order which is good to be known, and
2122
public class Pipeline : PipelineProtection
2223
2324
24-
11. Optimize Macros
25-
12. [ObfuscationAttribute] cleanup
26-
13. Create PE Image
27-
14. Write Module
28-
15. Run Packers
25+
12. Optimize Macros
26+
13. [ObfuscationAttribute] cleanup
27+
14 Create PE Image
28+
15. Write Module
29+
16. Run Packers
2930
3031
3132
.. code-block:: csharp
3233
3334
public class Packer : PackerProtection
3435
3536
36-
16. Output Elapsed Time since obfuscation
37+
17. Output Elapsed Time since obfuscation
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
Unable to reference after protect?
2-
==================================
1+
Unable to Reference After Protection
2+
====================================
33

4-
You're probably stuck on a problem, when you want to use your ``.dll`` after protection, you protect it via BitMono and try to reference it in IDE or whatever else, you're doing a bit wrong, you need to have an original copy and use it as a reference, and as output folder (i.e Release\...) drop there a protected version of your ``.dll``.
4+
If you're having trouble referencing your ``.dll`` file after protecting it with BitMono, follow these steps:
5+
6+
1. **Keep an Original Copy**: Always keep an original, unprotected copy of your ``.dll`` file. This will be used as a reference in your IDE or other tools.
7+
8+
2. **Protect the DLL**: Use BitMono to protect your ``.dll`` file.
9+
10+
3. **Set Up Output Folder**: In your output folder (e.g., ``Release\...``), place the protected version of your ``.dll`` file.
11+
12+
By following these steps, you can ensure that your project references the original ``.dll`` while deploying the protected version.

docs/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Table of Contents:
4343
developers/obfuscation-execution-order
4444
developers/which-base-protection-select
4545
developers/protection-runtime-moniker
46+
developers/native-code
4647
developers/do-not-resolve-members
4748
developers/configuration
4849

docs/source/protections/antide4dot.rst

+6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ AntiDe4dot
33

44
How it works?
55
-------------
6+
67
Protection adds multiple attributes of known obfuscators/protectors and as a result fools de4dot.
78

9+
Protection Type
10+
---------------
11+
12+
The protection type is `Protection`.
13+
814

915
.. warning::
1016

docs/source/protections/antidebugbreakpoints.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@ AntiDebugBreakpoints
33

44
How it works?
55
-------------
6-
Protection adds things in method bodies that check if from the last execution passed more than the const value, then as a result the program will be crashed.
6+
7+
Protection adds things in method bodies that check if from the last execution passed more than the const value, then as a result the program will be crashed.
8+
9+
Protection Type
10+
---------------
11+
12+
The protection type is `Protection`.

docs/source/protections/antidecompiler.rst

+6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ AntiDecompiler
33

44
How it works?
55
-------------
6+
67
Protection looks for a nested type in <Module> and sets non-public accessibility attributes, according to ECMA CIL standard nested types should always have one of them applied, but Mono doesn't care about this standard.
78

89
That means if someone will try to analyze the protected nested type, dnSpy will crash, however in a newer version, this exploit was fixed.
910

11+
Protection Type
12+
---------------
13+
14+
The protection type is `Packer`.
15+
1016

1117
.. warning::
1218

docs/source/protections/antiildasm.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@ AntiILdasm
33

44
How it works?
55
-------------
6-
Protection adds ``[SuppressIldasmAttribute]`` which prevents the Ildasm (IL Disassembler) from disassembling the protected file.
6+
7+
Protection adds ``[SuppressIldasmAttribute]`` which prevents the Ildasm (IL Disassembler) from disassembling the protected file.
8+
9+
Protection Type
10+
---------------
11+
12+
The protection type is `Protection`.

docs/source/protections/billionnops.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ As a result when someone will try to analyze this method will cause a crashed dn
1616
Cons
1717
----
1818

19-
Be careful because this protection will increase a file size a lot, and a bigger file size will cause more questions by users, most of us when see a big file size think that this file is obfuscated.
19+
Be careful because this protection will increase a file size a lot, and a bigger file size will cause more questions by users, most of us when see a big file size think that this file is obfuscated.
20+
21+
Protection Type
22+
---------------
23+
24+
The protection type is `Protection`.

docs/source/protections/bitdecompiler.rst

+6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ BitDecompiler
33

44
How it works?
55
-------------
6+
67
This protection works the same as BitDotnet protection, but with some fixes. However, since after Unity 2021 and higher it stopped working correctly and since many of users asked to figure something out we made this protection as a solution =)
78

9+
Protection Type
10+
---------------
11+
12+
The protection type is `Packer`.
13+
814

915
.. warning::
1016

docs/source/protections/bitdotnet.rst

+6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ BitDotNet
33

44
How it works?
55
-------------
6+
67
The protection uses dnlib exploit and modifies the file metadata (PE) to make it unrecognizable for dnSpy, as the result, at first sight, it will look like not a .NET file, for example, a C++ file.
78

89
Mono doesn't care about the thing which dnlib care about, and because of that it does what it does
910

11+
Protection Type
12+
---------------
13+
14+
The protection type is `Packer`.
15+
1016

1117
.. warning::
1218

docs/source/protections/bitmethoddotnet.rst

+6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ BitMethodDotnet
33

44
How it works?
55
-------------
6+
67
Protection adds invalid IL code in the file, as the result in the old dnSpy version it's going to be harder to see the C# code of the method body.
78

9+
Protection Type
10+
---------------
11+
12+
The protection type is `Protection`.
13+
814

915
.. warning::
1016

docs/source/protections/bitmono.rst

+6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ BitMono
33

44
How it works?
55
-------------
6+
67
Protection modifies the file metadata (PE) to make it unrecognizable for decompilers or other tools such as Detect It Easy, as the result most of the tools will be fooled to think that this is an MS-DOS Executable as Detect It Easy does, decompilers will just not be able to open it up.
78

89
Mono doesn't care about the things which decompilers/tools care about, and because of that it does what it does.
910

11+
Protection Type
12+
---------------
13+
14+
The protection type is `Packer`.
15+
1016

1117
.. warning::
1218

docs/source/protections/bittimedatestamp.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@ BitTimeDateStamp
33

44
How it works?
55
-------------
6-
Protection modifies the file metadata (PE) and erases the TimeDateStamp, as the result no one will be able to know when this file was compiled.
6+
7+
Protection modifies the file metadata (PE) and erases the TimeDateStamp, as the result no one will be able to know when this file was compiled.
8+
9+
Protection Type
10+
---------------
11+
12+
The protection type is `Packer`.

docs/source/protections/calltocalli.rst

+6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ CallToCalli
33

44
How it works?
55
-------------
6+
67
Protection replaces call opcode to calli and calls method by its function pointer.
78

9+
Protection Type
10+
---------------
11+
12+
The protection type is `Protection`.
13+
814

915
.. warning::
1016

docs/source/protections/dotnethook.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@ DotNetHook
33

44
How it works?
55
-------------
6-
Protection hooks methods, as a result, will call empty methods but, in fact, a completely different method will be called (the original one).
6+
7+
Protection hooks methods, as a result, will call empty methods but, in fact, a completely different method will be called (the original one).
8+
9+
Protection Type
10+
---------------
11+
12+
The protection type is `Protection`.

docs/source/protections/fullrenamer.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ FullRenamer
33

44
How it works?
55
-------------
6+
67
Protection renames types/methods/fields, however, ignores things such as reflection, Unity Methods (Update/FixedUpdate/LateUpdate, i.e all of them), overrides from Thanking (OV_methodName), and the most popular frameworks for plugin development in Unturned and Rust on GitHub - RocketMod, OpenMod, and rust-oxide-umod, you even could specify your methods/types to ignore.
78

89
If you want you can easily configure `criticals.json` to ignore strings and lot of stuff.
910

10-
Be careful, because renamer is tricky protection, not always useful, and does not always work properly. But, if you configure BitMono correctly Renamer can be a great protection (I'm about big projects, not crackmes).
11+
Be careful, because renamer is tricky protection, not always useful, and does not always work properly. But, if you configure BitMono correctly Renamer can be a great protection (I'm about big projects, not crackmes).
12+
13+
Protection Type
14+
---------------
15+
16+
The protection type is `Protection`.

docs/source/protections/nonamespaces.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@ NoNamespaces
33

44
How it works?
55
-------------
6-
Protection removes all namespaces.
6+
7+
Protection removes all namespaces.
8+
9+
Protection Type
10+
---------------
11+
12+
The protection type is `Protection`.

docs/source/protections/objectreturntype.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@ ObjectReturnType
33

44
How it works?
55
-------------
6-
Protection changes the nonvoid method return types to object return types.
6+
7+
Protection changes the nonvoid method return types to object return types.
8+
9+
Protection Type
10+
---------------
11+
12+
The protection type is `Protection`.

docs/source/protections/stringsencryption.rst

+6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ StringsEncryption
33

44
How it works?
55
-------------
6+
67
Protection encrypts strings using basic AES encryption, but not everyone like it because it makes the worse performance of application, but can be used with AntiDecompiler to crash dnSpy while analyzing the used class, also makes the RVA of the byte[] 0
78

9+
Protection Type
10+
---------------
11+
12+
The protection type is `Protection`.
13+
814

915
.. warning::
1016

0 commit comments

Comments
 (0)