├── .editorconfig
├── .gitattributes
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── dependabot.yml
└── workflows
│ ├── build.yml
│ └── codeql-analysis.yml
├── .gitignore
├── CHANGELOG.md
├── Images
├── Logo-Dark.png
└── Logo-Light.png
├── LICENSE
├── Libs
├── net35
│ └── de4dot.blocks.dll
└── netcoreapp3.1
│ └── de4dot.blocks.dll
├── NETReactorSlayer-x64.CLI
├── NETReactorSlayer-x64.CLI.csproj
└── Program.cs
├── NETReactorSlayer.CLI
├── NETReactorSlayer.CLI.csproj
└── Program.cs
├── NETReactorSlayer.Core
├── Abstractions
│ ├── IContext.cs
│ ├── IInfo.cs
│ ├── ILogger.cs
│ ├── IOptions.cs
│ └── IStage.cs
├── Context.cs
├── Helper
│ ├── ArrayFinder.cs
│ ├── AssemblyModule.cs
│ ├── CodeVirtualizationUtils.cs
│ ├── DeobUtils.cs
│ ├── DumpedMethodsRestorer.cs
│ ├── EncryptedResource.cs
│ ├── FieldTypes.cs
│ ├── InvalidMethodBody.cs
│ ├── LocalTypes.cs
│ ├── MethodBodyHeader.cs
│ ├── MethodBodyParser.cs
│ ├── MethodCallRemover.cs
│ ├── MyPEImage.cs
│ ├── NativeUnpacker.cs
│ ├── QuickLZ.cs
│ ├── QuickLZBase.cs
│ ├── SimpleDeobfuscator.cs
│ ├── StringCounts.cs
│ └── TheAssemblyResolver.cs
├── Info.cs
├── Logger.cs
├── NETReactorSlayer.Core.csproj
├── Options.cs
├── Program.cs
└── Stages
│ ├── AntiManipulationPatcher.cs
│ ├── AssemblyResolver.cs
│ ├── BooleanDecrypter.cs
│ ├── Cleaner.cs
│ ├── ControlFlowDeobfuscator.cs
│ ├── CosturaDumper.cs
│ ├── MethodDecrypter.cs
│ ├── MethodInliner.cs
│ ├── ProxyCallFixer.cs
│ ├── ResourceResolver.cs
│ ├── StringDecrypter.cs
│ ├── StrongNamePatcher.cs
│ ├── SymbolRenamer.cs
│ ├── TokenDeobfuscator.cs
│ └── TypeRestorer.cs
├── NETReactorSlayer.De4dot
├── Deobfuscator.cs
├── DeobfuscatorBase.cs
├── DeobfuscatorContext.cs
├── DeobfuscatorInfo.cs
├── DeobfuscatorInfoBase.cs
├── IDeobfuscator.cs
├── IDeobfuscatorContext.cs
├── IDeobfuscatorInfo.cs
├── IDeobfuscatorOptions.cs
├── IObfuscatedFile.cs
├── MethodStack.cs
├── NETReactorSlayer.De4dot.csproj
├── NameRegex.cs
├── NameRegexOption.cs
├── NameRegexes.cs
├── ObfuscatedFile.cs
├── Option.cs
├── PushedArgs.cs
├── RandomNameChecker.cs
├── Renamer
│ ├── AsmModules
│ │ ├── DictHelper.cs
│ │ ├── EventDefDict.cs
│ │ ├── FieldDefDict.cs
│ │ ├── IResolver.cs
│ │ ├── InterfaceMethodInfo.cs
│ │ ├── InterfaceMethodInfos.cs
│ │ ├── MEventDef.cs
│ │ ├── MFieldDef.cs
│ │ ├── MGenericParamDef.cs
│ │ ├── MMethodDef.cs
│ │ ├── MParamDef.cs
│ │ ├── MPropertyDef.cs
│ │ ├── MTypeDef.cs
│ │ ├── MethodDefDict.cs
│ │ ├── MethodDefKey.cs
│ │ ├── MethodInst.cs
│ │ ├── MethodInstances.cs
│ │ ├── MethodNameGroup.cs
│ │ ├── MethodNameGroups.cs
│ │ ├── Module.cs
│ │ ├── Modules.cs
│ │ ├── PropertyDefDict.cs
│ │ ├── Ref.cs
│ │ ├── TypeDefDict.cs
│ │ └── TypeInfo.cs
│ ├── DerivedFrom.cs
│ ├── EventInfo.cs
│ ├── ExistingNames.cs
│ ├── FieldInfo.cs
│ ├── GenericParamInfo.cs
│ ├── GenericParamNameCreator.cs
│ ├── GlobalTypeNameCreator.cs
│ ├── INameChecker.cs
│ ├── INameCreator.cs
│ ├── ITypeNameCreator.cs
│ ├── MemberInfo.cs
│ ├── MemberInfos.cs
│ ├── MethodInfo.cs
│ ├── NameCreator.cs
│ ├── NameCreator2.cs
│ ├── NameCreatorCounter.cs
│ ├── NameInfos.cs
│ ├── ParamInfo.cs
│ ├── PropertyInfo.cs
│ ├── PropertyNameCreator.cs
│ ├── Renamer.cs
│ ├── RenamerFlags.cs
│ ├── ResourceKeysRenamer.cs
│ ├── ResourceRenamer.cs
│ ├── TypeInfo.cs
│ ├── TypeNameCreator.cs
│ ├── TypeNames.cs
│ ├── TypeRenamerState.cs
│ ├── VariableNameCreator.cs
│ └── VariableNameState.cs
├── RenamingOptions.cs
├── Tuple.cs
├── TypesRestorer.cs
├── TypesRestorerBase.cs
└── Utils.cs
├── NETReactorSlayer.GUI
├── App.config
├── Dialogs
│ ├── MsgBox.cs
│ └── MsgBox.resx
├── Icon.ico
├── Logger.cs
├── MainWindow.Designer.cs
├── MainWindow.cs
├── MainWindow.resx
├── MenuColorTable.cs
├── NETReactorSlayer.GUI.csproj
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── Browse.png
│ ├── BrowseOver.png
│ ├── Close.png
│ ├── CloseOver.png
│ ├── Error.png
│ ├── Header.png
│ ├── Info.png
│ ├── Loading.gif
│ ├── Logo.png
│ ├── Menu.png
│ ├── MenuOver.png
│ ├── Minimize.png
│ ├── MinimizeOver.png
│ ├── Question.png
│ ├── Warning.png
│ ├── scrollbar_arrow_clicked.png
│ ├── scrollbar_arrow_hot.png
│ ├── scrollbar_arrow_standard.png
│ └── scrollbar_disabled.png
├── UserControls
│ ├── NRSButton.Designer.cs
│ ├── NRSButton.cs
│ ├── NRSButton.resx
│ ├── NRSCheckBox.cs
│ ├── NRSScrollBar.cs
│ ├── NRSTextBox.Designer.cs
│ └── NRSTextBox.cs
└── app.manifest
├── NETReactorSlayer.sln
├── NETReactorSlayerCommon.props
├── NuGet.Config
├── README.md
└── build.ps1
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.cs]
2 |
3 | # Default severity for all analyzer diagnostics
4 | dotnet_analyzer_diagnostic.severity = none
5 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **Target obfuscated file**
14 | If applicable, add target obfuscated file download link, otherwise if you want to keep it private, contact me on Telegram and send the target obfuscated file to me.
15 |
16 | **Screenshots**
17 | If applicable, add screenshots to help explain your problem.
18 |
19 | **OS Version:**
20 | Your machine OS version.
21 |
22 | **Additional context**
23 | Add any other context about the problem here.
24 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is.
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # Basic set up for three package managers
2 |
3 | version: 2
4 | updates:
5 |
6 | # Maintain dependencies for GitHub Actions
7 | - package-ecosystem: "github-actions"
8 | directory: "/"
9 | schedule:
10 | interval: "daily"
11 |
12 | # Maintain dependencies for nuget
13 | - package-ecosystem: "nuget"
14 | directory: "/"
15 | schedule:
16 | interval: "daily"
17 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | name: "CodeQL"
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - '**.md'
7 | - '**.yml'
8 | branches: [ "master" ]
9 | pull_request:
10 | branches: [ "master" ]
11 |
12 | workflow_dispatch:
13 |
14 | jobs:
15 | analyze:
16 | name: Analyze
17 | runs-on: ubuntu-latest
18 | permissions:
19 | actions: read
20 | contents: read
21 | security-events: write
22 |
23 | strategy:
24 | fail-fast: false
25 | matrix:
26 | language: [ 'csharp' ]
27 | dotnet-version: [ '6.0.x' ]
28 |
29 | steps:
30 | - name: Checkout repository
31 | uses: actions/checkout@v4
32 |
33 | - name: Initialize CodeQL
34 | uses: github/codeql-action/init@v2
35 | with:
36 | languages: ${{ matrix.language }}
37 |
38 | - name: Setup .NET
39 | uses: actions/setup-dotnet@v3
40 | with:
41 | dotnet-version: ${{ matrix.dotnet-version }}
42 |
43 | - name: Build
44 | run: dotnet build NETReactorSlayer.sln
45 |
46 | - name: Perform CodeQL Analysis
47 | uses: github/codeql-action/analyze@v2
48 | with:
49 | category: "/language:${{matrix.language}}"
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # CHANGELOG
2 | All releases are documented in this file.
3 |
4 | ## [v6.0.0.0](https://github.com/SychicBoy/NETReactorSlayer/compare/v6.0.0.0..v5.0.0.0)
5 | > October 6, 2022
6 | ### :wrench: Changes:
7 | Bug fixes and stability improvements.
8 | ### :sparkles: New:
9 | - Support .NET Reactor v6.9.
10 | - Multi-Platform support.
11 |
12 | ## [v5.0.0.0](https://github.com/SychicBoy/NETReactorSlayer/compare/v5.0.0.0-rc1..v5.0.0.0)
13 | > September 28, 2022
14 | ### :wrench: Changes:
15 | Bug fixes and stability improvements.
16 | ### :sparkles: New:
17 | - Rename obfuscated symbols name.
18 | - Restore the type of fields & parameters that have had their type turned into object.
19 | - Support both static & dynamic control flow deobfuscation.
20 | - Support both static & dynamic string decryption.
21 |
22 | ## [v5.0.0.0-rc1](https://github.com/SychicBoy/NETReactorSlayer/compare/v4.0.0.0...v5.0.0.0-rc1)
23 | > September 26, 2022
24 | ### :wrench: Changes:
25 | Bug fixes and stability improvements.
26 | ### :sparkles: New:
27 | - Rename obfuscated symbols name.
28 | - Restore the type of fields & parameters that have had their type turned into object.
29 | - Support both static & dynamic control flow deobfuscation.
30 | - Support both static & dynamic string decryption.
31 |
32 | ## [v4.0.0.0](https://github.com/SychicBoy/NETReactorSlayer/compare/v3.1.0.0-rc1...v4.0.0.0)
33 | > May 07, 2022
34 | ### :wrench: Changes:
35 | - Improve & Fix Control Flow Deobfuscator.
36 | - Improve & Fix Token Decrypter.
37 | - Improve & Fix Cleaner.
38 | - Fix Boolean Decrypter.
39 | ### :sparkles: New:
40 | - Remove strong name removal protection.
41 |
42 | ## [v3.1.0.0 RC1](https://github.com/SychicBoy/NETReactorSlayer/compare/v3.0.0.0...v3.1.0.0-rc1)
43 | > April 10, 2022
44 | ### :wrench: Changes:
45 | - Improve Control Flow Deobfuscator.
46 | - Improve & Fix Cleaner.
47 | ### :sparkles: New:
48 | - Added Boolean Decrypter.
49 |
50 | ## [v3.0.0.0](https://github.com/SychicBoy/NETReactorSlayer/compare/v2.1.0.0...v3.0.0.0)
51 | > April 06, 2022
52 | ### :wrench: Changes:
53 | - Updated to .NET Framework 4.8.
54 | - Improved Control Flow Deobfuscator (Now it's static and provides better results).
55 | - Improved Cleaner [`#6`](https://github.com/SychicBoy/NETReactorSlayer/issues/6).
56 | - Fix [`#5`](https://github.com/SychicBoy/NETReactorSlayer/issues/5) & [`#10`](https://github.com/SychicBoy/NETReactorSlayer/issues/10).
57 | - Some Bug Fixes & Improvements.
58 | ### :sparkles: New:
59 | - Unhide Assembly Actual Entry Point.
60 | - Added GUI.
61 | - Added Costura.Fody De-compressor.
62 | - Remove NOP Instructions.
63 |
64 | ## [v2.1.0.0](https://github.com/SychicBoy/NETReactorSlayer/compare/v2.0.0.0...v2.1.0.0)
65 | > November 22, 2021
66 | ### :wrench: Changes:
67 | - Fixed [`#4`](https://github.com/SychicBoy/NETReactorSlayer/issues/4).
68 | ### :sparkles: New:
69 | - Added token decrypter [`#3`](https://github.com/SychicBoy/NETReactorSlayer/issues/3).
70 |
71 | ## [v2.0.0.0](https://github.com/SychicBoy/NETReactorSlayer/compare/v1.2.0.0...v2.0.0.0)
72 | > November 21, 2021
73 | ### :wrench: Changes:
74 | - Fixed an issue with dumping embedded assemblies on .NET Reactor v6.8.0.0.
75 |
76 | ## [v1.2.0.0](https://github.com/SychicBoy/NETReactorSlayer/compare/v1.1.0.1...v1.2.0.0)
77 | > November 16, 2021
78 | ### :wrench: Changes:
79 | - Removed unnecessary metadata options on Save function.
80 |
81 | ## [v1.1.0.1](https://github.com/SychicBoy/NETReactorSlayer/compare/v1.1.0.0...v1.1.0.1)
82 | > October 10, 2021
83 | ### :wrench: Changes:
84 | - Fixed an issue where importing null methods while fixing proxies calls.
85 | - Fixed an issue where failed to find decryption method on some obfuscated assemblies.
86 |
87 |
88 | ## [v1.1.0.0](https://github.com/SychicBoy/NETReactorSlayer/compare/v1.0.0.0...v1.1.0.0)
89 | > October 09, 2021
90 | ### :wrench: Changes:
91 | - Fixed issues with DLL files.
92 |
93 | ## v1.0.0.0
94 | > October 04, 2021
95 |
--------------------------------------------------------------------------------
/Images/Logo-Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/Images/Logo-Dark.png
--------------------------------------------------------------------------------
/Images/Logo-Light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/Images/Logo-Light.png
--------------------------------------------------------------------------------
/Libs/net35/de4dot.blocks.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/Libs/net35/de4dot.blocks.dll
--------------------------------------------------------------------------------
/Libs/netcoreapp3.1/de4dot.blocks.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/Libs/netcoreapp3.1/de4dot.blocks.dll
--------------------------------------------------------------------------------
/NETReactorSlayer-x64.CLI/NETReactorSlayer-x64.CLI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | AnyCPU
8 | ..\bin\$(Configuration)\
9 | Exe
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/NETReactorSlayer-x64.CLI/Program.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 |
18 | namespace NETReactorSlayerr_x64.CLI
19 | {
20 | internal class Program
21 | {
22 | [STAThread] private static void Main(string[] args) => NETReactorSlayer.Core.Program.Main(args);
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.CLI/NETReactorSlayer.CLI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | AnyCPU
8 | ..\bin\$(Configuration)\
9 | Exe
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/NETReactorSlayer.CLI/Program.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 |
18 | namespace NETReactorSlayer.CLI
19 | {
20 | internal class Program
21 | {
22 | [STAThread] private static void Main(string[] args) => Core.Program.Main(args);
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Abstractions/IContext.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Reflection;
17 | using dnlib.DotNet;
18 | using NETReactorSlayer.Core.Helper;
19 |
20 | namespace NETReactorSlayer.Core.Abstractions
21 | {
22 | public interface IContext
23 | {
24 | bool Load();
25 | void Save();
26 | IOptions Options { get; }
27 | ILogger Logger { get; }
28 | IInfo Info { get; }
29 | Assembly Assembly { get; set; }
30 | AssemblyModule AssemblyModule { get; set; }
31 | ModuleDefMD Module { get; set; }
32 | ModuleContext ModuleContext { get; set; }
33 | MyPeImage PeImage { get; set; }
34 | byte[] ModuleBytes { get; set; }
35 | }
36 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Abstractions/IInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.Core.Abstractions
17 | {
18 | public interface IInfo
19 | {
20 | bool NativeStub { get; set; }
21 | bool NecroBit { get; set; }
22 | bool UsesReflection { get; set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Abstractions/ILogger.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.Core.Abstractions
17 | {
18 | public interface ILogger
19 | {
20 | void Info(string message);
21 | void Warn(string message);
22 | void Error(string message);
23 | void Debug(string message);
24 | void PrintUsage();
25 | void PrintLogo();
26 | }
27 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Abstractions/IOptions.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General License for more details.
12 | You should have received a copy of the GNU General License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using NETReactorSlayer.De4dot.Renamer;
18 |
19 | namespace NETReactorSlayer.Core.Abstractions
20 | {
21 | public interface IOptions
22 | {
23 | string SourceDir { get; set; }
24 | string SourceFileExt { get; set; }
25 | string SourceFileName { get; set; }
26 | string SourcePath { get; set; }
27 | string DestFileName { get; set; }
28 | string DestPath { get; set; }
29 | bool AntiManipulationPatcher { get; set; }
30 | bool AssemblyResolver { get; set; }
31 | bool BooleanDecrypter { get; set; }
32 | bool ProxyCallFixer { get; set; }
33 | bool ControlFlowDeobfuscator { get; set; }
34 | bool CosturaDumper { get; set; }
35 | bool MethodDecrypter { get; set; }
36 | bool MethodInliner { get; set; }
37 | bool RemoveCallsToObfuscatorTypes { get; set; }
38 | bool SymbolRenamer { get; set; }
39 | bool ResourceResolver { get; set; }
40 | bool StringDecrypter { get; set; }
41 | bool StrongNamePatcher { get; set; }
42 | bool TokenDeobfuscator { get; set; }
43 | bool RemoveJunks { get; set; }
44 | bool KeepObfuscatorTypes { get; set; }
45 | bool KeepOldMaxStackValue { get; set; }
46 | bool NoPause { get; set; }
47 | bool PreserveAllMdTokens { get; set; }
48 | bool RenameShort { get; set; }
49 | RenamerFlags RenamerFlags { get; set; }
50 | List Stages { get; }
51 | }
52 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Abstractions/IStage.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.Core.Abstractions
17 | {
18 | public interface IStage
19 | {
20 | void Run(IContext context);
21 | }
22 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/AssemblyModule.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.IO;
17 | using dnlib.DotNet;
18 |
19 | namespace NETReactorSlayer.Core.Helper
20 | {
21 | public class AssemblyModule
22 | {
23 | public AssemblyModule(string filename, ModuleContext moduleContext)
24 | {
25 | _filename = Path.GetFullPath(filename);
26 | _moduleContext = moduleContext;
27 | }
28 |
29 | public ModuleDefMD Load()
30 | {
31 | var options = new ModuleCreationOptions(_moduleContext) { TryToLoadPdbFromDisk = false };
32 | return SetModule(ModuleDefMD.Load(_filename, options));
33 | }
34 |
35 | public ModuleDefMD Load(byte[] fileData)
36 | {
37 | var options = new ModuleCreationOptions(_moduleContext) { TryToLoadPdbFromDisk = false };
38 | return SetModule(ModuleDefMD.Load(fileData, options));
39 | }
40 |
41 | private ModuleDefMD SetModule(ModuleDefMD newModule)
42 | {
43 | _module = newModule;
44 | TheAssemblyResolver.Instance.AddModule(_module);
45 | _module.EnableTypeDefFindCache = true;
46 | _module.Location = _filename;
47 | return _module;
48 | }
49 |
50 | public ModuleDefMD Reload(
51 | byte[] newModuleData, DumpedMethodsRestorer dumpedMethodsRestorer, IStringDecrypter stringDecrypter)
52 | {
53 | TheAssemblyResolver.Instance.Remove(_module);
54 | var options = new ModuleCreationOptions(_moduleContext) { TryToLoadPdbFromDisk = false };
55 | var mod = ModuleDefMD.Load(newModuleData, options);
56 | if (dumpedMethodsRestorer != null)
57 | dumpedMethodsRestorer.Module = mod;
58 | mod.StringDecrypter = stringDecrypter;
59 | mod.MethodDecrypter = dumpedMethodsRestorer;
60 | mod.TablesStream.ColumnReader = dumpedMethodsRestorer;
61 | mod.TablesStream.MethodRowReader = dumpedMethodsRestorer;
62 | return SetModule(mod);
63 | }
64 |
65 | public override string ToString() => _filename;
66 |
67 | private readonly string _filename;
68 | private ModuleDefMD _module;
69 | private readonly ModuleContext _moduleContext;
70 | }
71 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/CodeVirtualizationUtils.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Linq;
17 | using dnlib.DotNet.Emit;
18 | using NETReactorSlayer.Core.Abstractions;
19 |
20 | namespace NETReactorSlayer.Core.Helper
21 | {
22 | internal class CodeVirtualizationUtils
23 | {
24 | public static bool Detect(IContext context)
25 | {
26 | var array = new[]
27 | {
28 | "System.String",
29 | "System.Byte",
30 | "System.SByte",
31 | "System.Int16",
32 | "System.UInt16",
33 | "System.Int32",
34 | "System.UInt32",
35 | "System.Int64",
36 | "System.UInt64",
37 | "System.Single",
38 | "System.Double",
39 | "System.Boolean",
40 | "System.IntPtr",
41 | "System.UIntPtr",
42 | "System.Char"
43 | };
44 |
45 | foreach (var method in context.Module.GetTypes()
46 | .SelectMany(type => type.Methods.Where(x => x.HasBody && x.Body.HasInstructions)))
47 | try
48 | {
49 | if (method.Body.Instructions.Count(x => x.OpCode.Equals(OpCodes.Switch)) != 2)
50 | continue;
51 | if (method.Body.Instructions.Count(x => x.OpCode.Equals(OpCodes.Ldtoken)) < 15)
52 | continue;
53 | var operands = method.Body.Instructions
54 | .Where(x => x.OpCode.Equals(OpCodes.Ldtoken) && x.Operand != null)
55 | .Select(x => x.Operand.ToString()).ToList();
56 | if (array.Any(item => !operands.Contains(item)))
57 | continue;
58 |
59 | return true;
60 | }
61 | catch { }
62 |
63 | return false;
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/DeobUtils.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.IO;
18 | using System.Linq;
19 | using System.Security.Cryptography;
20 | using dnlib.DotNet;
21 | using ICSharpCode.SharpZipLib.Zip.Compression;
22 |
23 | namespace NETReactorSlayer.Core.Helper
24 | {
25 | public static class DeobUtils
26 | {
27 | public static void DecryptAndAddResources(ModuleDef module, Func decryptResource)
28 | {
29 | var decryptedResourceData = decryptResource();
30 | if (decryptedResourceData == null)
31 | throw new ApplicationException("decryptedResourceData is null");
32 | var resourceModule = ModuleDefMD.Load(decryptedResourceData);
33 |
34 | foreach (var rsrc in resourceModule.Resources)
35 | module.Resources.Add(rsrc);
36 | }
37 |
38 | public static byte[] ReadModule(ModuleDef module) => ReadFile(module.Location);
39 |
40 | public static bool IsCode(short[] nativeCode, byte[] code)
41 | {
42 | if (nativeCode.Length != code.Length)
43 | return false;
44 | return !nativeCode.Where((t, i) => t != -1 && (byte)t != code[i]).Any();
45 | }
46 |
47 | public static byte[] ReadFile(string filename)
48 | {
49 | const int maxBytesRead = 0x200000;
50 |
51 | using var fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
52 | var fileData = new byte[(int)fileStream.Length];
53 |
54 | int bytes, offset = 0, length = fileData.Length;
55 | while ((bytes = fileStream.Read(fileData, offset, Math.Min(maxBytesRead, length - offset))) > 0)
56 | offset += bytes;
57 | if (offset != length)
58 | throw new ApplicationException("Could not read all bytes");
59 |
60 | return fileData;
61 | }
62 |
63 | public static byte[] AesDecrypt(byte[] data, byte[] key, byte[] iv)
64 | {
65 | using var aes = Aes.Create();
66 | aes.Padding = PaddingMode.PKCS7;
67 | aes.Mode = CipherMode.CBC;
68 | using var transform = aes.CreateDecryptor(key, iv);
69 | return transform.TransformFinalBlock(data, 0, data.Length);
70 | }
71 |
72 | public static byte[] Inflate(byte[] data, bool noHeader) => Inflate(data, 0, data.Length, noHeader);
73 |
74 | public static byte[] Inflate(byte[] data, int start, int len, bool noHeader) =>
75 | Inflate(data, start, len, new Inflater(noHeader));
76 |
77 | public static byte[] Inflate(byte[] data, int start, int len, Inflater inflater)
78 | {
79 | var buffer = new byte[0x1000];
80 | var memStream = new MemoryStream();
81 | inflater.SetInput(data, start, len);
82 | while (true)
83 | {
84 | var count = inflater.Inflate(buffer, 0, buffer.Length);
85 | if (count == 0)
86 | break;
87 | memStream.Write(buffer, 0, count);
88 | }
89 |
90 | return memStream.ToArray();
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/DumpedMethodsRestorer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using de4dot.blocks;
18 | using dnlib.DotNet;
19 | using dnlib.DotNet.Emit;
20 | using dnlib.DotNet.MD;
21 | using dnlib.PE;
22 |
23 | namespace NETReactorSlayer.Core.Helper
24 | {
25 | public class DumpedMethodsRestorer : IRowReader, IColumnReader, IMethodDecrypter
26 | {
27 | public DumpedMethodsRestorer(DumpedMethods dumpedMethods) => _dumpedMethods = dumpedMethods;
28 |
29 | private DumpedMethod GetDumpedMethod(uint rid) => _dumpedMethods.Get(0x06000000 | rid);
30 |
31 | public bool ReadColumn(MDTable table, uint rid, ColumnInfo column, out uint value)
32 | {
33 | if (table.Table == Table.Method)
34 | if (TryReadRow(rid, out var row))
35 | {
36 | value = row[column.Index];
37 | return true;
38 | }
39 |
40 | value = 0;
41 | return false;
42 | }
43 |
44 | public bool GetMethodBody(
45 | uint rid, RVA rva, IList parameters, GenericParamContext gpContext, out MethodBody methodBody)
46 | {
47 | var dm = GetDumpedMethod(rid);
48 | if (dm == null)
49 | {
50 | methodBody = null;
51 | return false;
52 | }
53 |
54 | methodBody = MethodBodyReader.CreateCilBody(_module, dm.code, dm.extraSections, parameters, dm.mhFlags,
55 | dm.mhMaxStack, dm.mhCodeSize, dm.mhLocalVarSigTok, gpContext);
56 | return true;
57 | }
58 |
59 | public bool TryReadRow(uint rid, out RawMethodRow row)
60 | {
61 | var dm = GetDumpedMethod(rid);
62 | if (dm == null)
63 | {
64 | row = default;
65 | return false;
66 | }
67 |
68 | row = new RawMethodRow(dm.mdRVA, dm.mdImplFlags, dm.mdFlags, dm.mdName, dm.mdSignature, dm.mdParamList);
69 | return true;
70 | }
71 |
72 | private readonly DumpedMethods _dumpedMethods;
73 | private ModuleDefMD _module;
74 |
75 | public ModuleDefMD Module { set => _module = value; }
76 | }
77 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/FieldTypes.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using dnlib.DotNet;
19 |
20 | namespace NETReactorSlayer.Core.Helper
21 | {
22 | public class FieldTypes : StringCounts
23 | {
24 | public FieldTypes(IEnumerable fields) => Initialize(fields);
25 |
26 | private void Initialize(IEnumerable fields)
27 | {
28 | if (fields == null)
29 | return;
30 | foreach (var type in fields.Select(field => field.FieldSig.GetFieldType()).Where(type => type != null))
31 | Add(type.FullName);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/InvalidMethodBody.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 |
18 | namespace NETReactorSlayer.Core.Helper
19 | {
20 | [Serializable]
21 | public class InvalidMethodBody : Exception
22 | {
23 | public InvalidMethodBody() { }
24 |
25 | public InvalidMethodBody(string msg)
26 | : base(msg) { }
27 | }
28 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/LocalTypes.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using dnlib.DotNet;
18 | using dnlib.DotNet.Emit;
19 |
20 | namespace NETReactorSlayer.Core.Helper
21 | {
22 | public class LocalTypes : StringCounts
23 | {
24 | public LocalTypes(MethodDef method)
25 | {
26 | if (method.HasBody)
27 | Initialize(method.Body.Variables);
28 | }
29 |
30 | private void Initialize(IEnumerable locals)
31 | {
32 | if (locals == null)
33 | return;
34 | foreach (var local in locals)
35 | Add(local.Type.FullName);
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/MethodBodyHeader.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.Core.Helper
17 | {
18 | public class MethodBodyHeader
19 | {
20 | public uint CodeSize;
21 | public ushort Flags;
22 | public uint LocalVarSigTok;
23 | public ushort MaxStack;
24 | }
25 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/MethodCallRemover.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using de4dot.blocks;
19 | using dnlib.DotNet;
20 | using dnlib.DotNet.Emit;
21 | using NETReactorSlayer.Core.Abstractions;
22 |
23 | namespace NETReactorSlayer.Core.Helper
24 | {
25 | internal class MethodCallRemover
26 | {
27 | public static long RemoveCalls(IContext context, MethodDef methodToRem)
28 | {
29 | _methodRefInfos = new MethodDefAndDeclaringTypeDict>();
30 | foreach (var methodDef in context.Module.GetTypes()
31 | .SelectMany(type => type.Methods.Where(x => x.HasBody && x.Body.HasInstructions)))
32 | Add(methodDef, methodToRem);
33 |
34 | return context.Module.GetTypes()
35 | .Sum(type => type.Methods.Where(x => x.HasBody && x.Body.HasInstructions)
36 | .Sum(method => RemoveCalls(method, _methodRefInfos.Find(method))));
37 | }
38 |
39 | public static long RemoveCalls(IContext context, List methods)
40 | {
41 | _methodRefInfos = new MethodDefAndDeclaringTypeDict>();
42 | foreach (var type in context.Module.GetTypes())
43 | foreach (var method in type.Methods.Where(x => x.HasBody && x.Body.HasInstructions))
44 | foreach (var methodToRem in methods)
45 | Add(method, methodToRem);
46 |
47 | return context.Module.GetTypes().Sum(type =>
48 | type.Methods.Where(x => x.HasBody && x.Body.HasInstructions)
49 | .Sum(method => RemoveCalls(method, _methodRefInfos.Find(method))));
50 | }
51 |
52 | private static long RemoveCalls(MethodDef method, MethodDefDictBase info)
53 | {
54 | long count = 0;
55 | foreach (var instr in method.Body.Instructions)
56 | try
57 | {
58 | if (instr.OpCode != OpCodes.Call)
59 | continue;
60 | if (instr.Operand is not IMethod destMethod)
61 | continue;
62 | if (!info.Find(destMethod))
63 | continue;
64 | instr.OpCode = OpCodes.Nop;
65 | count++;
66 | }
67 | catch { }
68 |
69 | return count;
70 | }
71 |
72 | private static void Add(MethodDef method, MethodDef methodToBeRemoved)
73 | {
74 | if (method == null || methodToBeRemoved == null || !CheckMethod(methodToBeRemoved))
75 | return;
76 | var dict = _methodRefInfos.Find(method);
77 | if (dict == null)
78 | _methodRefInfos.Add(method, dict = new MethodDefAndDeclaringTypeDict());
79 | dict.Add(methodToBeRemoved, true);
80 | }
81 |
82 | private static bool CheckMethod(IMethod methodToBeRemoved) =>
83 | methodToBeRemoved.MethodSig.Params.Count == 0 &&
84 | methodToBeRemoved.MethodSig.RetType.ElementType ==
85 | ElementType.Void;
86 |
87 |
88 | private static MethodDefAndDeclaringTypeDict> _methodRefInfos;
89 | }
90 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/QuickLZ.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 |
18 | namespace NETReactorSlayer.Core.Helper
19 | {
20 | public class QuickLz : QuickLzBase
21 | {
22 | public static byte[] Decompress(byte[] inData) => Decompress(inData, DefaultQclzSig);
23 |
24 | public static byte[] Decompress(byte[] inData, int sig)
25 | {
26 | BitConverter.ToInt32(inData, 4);
27 | var compressedLength = BitConverter.ToInt32(inData, 8);
28 | var decompressedLength = BitConverter.ToInt32(inData, 12);
29 | var isDataCompressed = BitConverter.ToInt32(inData, 16) == 1;
30 | const int headerLength = 32;
31 | if (BitConverter.ToInt32(inData, 0) != sig || BitConverter.ToInt32(inData, compressedLength - 4) != sig)
32 | throw new ApplicationException("No QCLZ sig");
33 |
34 | var outData = new byte[decompressedLength];
35 |
36 | if (!isDataCompressed)
37 | {
38 | Copy(inData, headerLength, outData, 0, decompressedLength);
39 | return outData;
40 | }
41 |
42 | Decompress(inData, headerLength, outData);
43 | return outData;
44 | }
45 |
46 | private const int DefaultQclzSig = 0x5A4C4351;
47 | }
48 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Helper/StringCounts.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 | using System.Linq;
19 |
20 | namespace NETReactorSlayer.Core.Helper
21 | {
22 | public class StringCounts
23 | {
24 | public void Add(string s)
25 | {
26 | _strings.TryGetValue(s, out var count);
27 | _strings[s] = count + 1;
28 | }
29 |
30 | public bool Exists(string s) => s != null && _strings.ContainsKey(s);
31 |
32 | public bool All(IList list) => list.All(Exists);
33 |
34 | public int Count(string s)
35 | {
36 | _strings.TryGetValue(s, out var count);
37 | return count;
38 | }
39 |
40 | private readonly Dictionary _strings = new(StringComparer.Ordinal);
41 | }
42 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Info.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.Core.Abstractions;
17 |
18 | namespace NETReactorSlayer.Core
19 | {
20 | public class Info : IInfo
21 | {
22 | public bool NativeStub { get; set; }
23 | public bool NecroBit { get; set; }
24 | public bool UsesReflection { get; set; }
25 | }
26 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/NETReactorSlayer.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | ..\bin\$(Configuration)\
8 | Library
9 |
10 |
11 |
12 |
13 |
14 |
15 | ..\Libs\net35\de4dot.blocks.dll
16 |
17 |
18 | ..\Libs\netcoreapp3.1\de4dot.blocks.dll
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Program.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 | using System.Diagnostics;
19 | using System.IO;
20 | using System.Linq;
21 | using System.Text;
22 | using System.Threading;
23 | using NETReactorSlayer.Core.Abstractions;
24 | using NETReactorSlayer.Core.Helper;
25 | using NETReactorSlayer.Core.Stages;
26 |
27 | namespace NETReactorSlayer.Core
28 | {
29 | public class Program
30 | {
31 | public static void Main(string[] args)
32 | {
33 | if (!CheckArguments(args))
34 | return;
35 |
36 | Console.Title = ".NET Reactor Slayer";
37 | Console.OutputEncoding = Encoding.UTF8;
38 | Console.BackgroundColor = ConsoleColor.Black;
39 | Console.ForegroundColor = ConsoleColor.White;
40 |
41 | IOptions options = new Options(args);
42 | IContext context = new Context(options, new Logger());
43 |
44 | try
45 | {
46 | Console.Clear();
47 | context.Logger.PrintLogo();
48 | }
49 | catch { }
50 |
51 | if (context.Load())
52 | {
53 | DeobfuscateBegin(context);
54 | DeobfuscateEnd(context);
55 | }
56 |
57 | if (context.Options.NoPause)
58 | return;
59 |
60 | Console.WriteLine("\r\n Press any key to exit . . .");
61 | Console.ReadKey();
62 | }
63 |
64 | private static bool CheckArguments(IReadOnlyList args)
65 | {
66 | if (args.Count != 3 || args[0] != "--del-temp" ||
67 | !int.TryParse(args[1], out var id) || !File.Exists(args[2]))
68 | return true;
69 |
70 | try
71 | {
72 | if (Process.GetProcessById(id) is { } process)
73 | {
74 | process.WaitForExit();
75 | while (File.Exists(args[2]))
76 | {
77 | try { File.Delete(args[2]); }
78 | catch { }
79 |
80 | Thread.Sleep(1000);
81 | }
82 |
83 | Process.GetCurrentProcess().Kill();
84 | return false;
85 | }
86 | }
87 | catch { }
88 |
89 | return true;
90 | }
91 |
92 | private static void DeobfuscateBegin(IContext context)
93 | {
94 | const int maxStackSize = 1024 * 1024 * 64;
95 | foreach (var thread in context.Options.Stages.Select(deobfuscatorStage => new Thread(() =>
96 | {
97 | try { deobfuscatorStage.Run(context); }
98 | catch (Exception ex)
99 | {
100 | context.Logger.Error($"{deobfuscatorStage.GetType().Name}: {ex.Message}");
101 | }
102 | }, maxStackSize)))
103 | {
104 | thread.Start();
105 | thread.Join();
106 | }
107 | }
108 |
109 | private static void DeobfuscateEnd(IContext context)
110 | {
111 | if (context.Options.Stages.Any(x => x.GetType().Name.Equals(nameof(MethodInliner))))
112 | if (MethodInliner.InlinedMethods > 0)
113 | context.Logger.Info(MethodInliner.InlinedMethods + " Methods inlined.");
114 | else
115 | context.Logger.Warn("Couldn't find any outline method.");
116 |
117 | if (CodeVirtualizationUtils.Detect(context))
118 | context.Logger.Warn(
119 | "WARNING: CODE VIRTUALIZATION HAS BEEN DETECTED, INCOMPLETE DEOBFUSCATION OF THE ASSEMBLY MAY RESULT.");
120 |
121 | context.Save();
122 | }
123 | }
124 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Stages/AntiManipulationPatcher.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Linq;
17 | using de4dot.blocks;
18 | using dnlib.DotNet;
19 | using dnlib.DotNet.Emit;
20 | using NETReactorSlayer.Core.Abstractions;
21 |
22 | namespace NETReactorSlayer.Core.Stages
23 | {
24 | internal class AntiManipulationPatcher : IStage
25 | {
26 | public void Run(IContext context)
27 | {
28 | Context = context;
29 | bool antiTamper = false,
30 | antiDebugger = false;
31 | foreach (var method in Context.Module.GetTypes()
32 | .SelectMany(type => type.Methods.Where(x => x.HasBody && x.Body.HasInstructions)))
33 | {
34 | if (RemoveAntiTamper(method))
35 | antiTamper = true;
36 | else if (RemoveAntiDebugger(method))
37 | antiDebugger = true;
38 | else
39 | continue;
40 | Cleaner.AddCallToBeRemoved(method);
41 | }
42 |
43 | if (!antiTamper)
44 | Context.Logger.Warn("Couldn't find anti tamper method.");
45 | if (!antiDebugger)
46 | Context.Logger.Warn("Couldn't find anti debugger method.");
47 | }
48 |
49 | private bool RemoveAntiTamper(MethodDef method)
50 | {
51 | if (!method.IsStatic)
52 | return false;
53 | if (!DotNetUtils.GetCodeStrings(method).Any(x => x.Contains("is tampered")))
54 | return false;
55 |
56 | var ins = Instruction.Create(OpCodes.Ret);
57 | var cli = new CilBody();
58 | cli.Instructions.Add(ins);
59 | method.Body = cli;
60 | Context.Logger.Info("Anti tamper removed.");
61 | return true;
62 | }
63 |
64 | private bool RemoveAntiDebugger(MethodDef method)
65 | {
66 | if (!method.IsStatic)
67 | return false;
68 | if (!DotNetUtils.GetCodeStrings(method).Any(x => x.Contains("Debugger Detected")))
69 | return false;
70 |
71 | var ins = Instruction.Create(OpCodes.Ret);
72 | var cli = new CilBody();
73 | cli.Instructions.Add(ins);
74 | method.Body = cli;
75 | Context.Logger.Info("Anti debugger removed.");
76 | return true;
77 | }
78 |
79 |
80 | private IContext Context { get; set; }
81 | }
82 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Stages/CosturaDumper.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.IO;
17 | using System.IO.Compression;
18 | using System.Linq;
19 | using dnlib.DotNet;
20 | using NETReactorSlayer.Core.Abstractions;
21 |
22 | namespace NETReactorSlayer.Core.Stages
23 | {
24 | internal class CosturaDumper : IStage
25 | {
26 | public void Run(IContext context)
27 | {
28 | long count = 0;
29 | foreach (var resource in context.Module.Resources)
30 | {
31 | if (resource is not EmbeddedResource embeddedResource)
32 | continue;
33 | if (embeddedResource.Name == "costura.metadata")
34 | {
35 | Cleaner.AddResourceToBeRemoved(embeddedResource);
36 | continue;
37 | }
38 |
39 | if (!embeddedResource.Name.EndsWith(".compressed"))
40 | continue;
41 | Cleaner.AddResourceToBeRemoved(embeddedResource);
42 | count++;
43 | try
44 | {
45 | using var resourceStream = embeddedResource.CreateReader().AsStream();
46 | using var deflateStream = new DeflateStream(resourceStream, CompressionMode.Decompress);
47 | using var memoryStream = new MemoryStream();
48 | deflateStream.CopyTo(memoryStream);
49 | try
50 | {
51 | memoryStream.Position = 0L;
52 | File.WriteAllBytes(
53 | $"{context.Options.SourceDir}\\{GetAssemblyName(memoryStream.ToArray(), false)}.dll",
54 | memoryStream.ToArray());
55 | }
56 | catch
57 | {
58 | File.WriteAllBytes(
59 | $"{context.Options.SourceDir}\\{embeddedResource.Name.Replace(".compressed", "").Replace("costura.", "")}",
60 | memoryStream.ToArray());
61 | }
62 |
63 | memoryStream.Close();
64 | deflateStream.Close();
65 | }
66 | catch { }
67 | }
68 |
69 | try
70 | {
71 | var cctor = context.Module.GlobalType.FindStaticConstructor();
72 | if (cctor.HasBody && cctor.Body.HasInstructions)
73 | for (var i = 0; i < cctor.Body.Instructions.ToList().Count; i++)
74 | {
75 | if (cctor.Body.Instructions[i].Operand == null || !cctor.Body.Instructions[i].Operand
76 | .ToString()!.Contains("Costura.AssemblyLoader::Attach()"))
77 | continue;
78 | cctor.Body.Instructions.RemoveAt(i);
79 | break;
80 | }
81 | }
82 | catch { }
83 |
84 | if (count > 0)
85 | context.Logger.Info(count + " Embedded assemblies dumped (Costura.Fody).");
86 | }
87 |
88 | private static string GetAssemblyName(byte[] data, bool fullName)
89 | {
90 | try
91 | {
92 | using var module = ModuleDefMD.Load(data);
93 | if (fullName)
94 | return module.Assembly.FullName;
95 | return module.Assembly.Name;
96 | }
97 | catch { return null; }
98 | }
99 | }
100 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Stages/SymbolRenamer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.Core.Abstractions;
17 | using NETReactorSlayer.De4dot;
18 | using NETReactorSlayer.De4dot.Renamer;
19 |
20 | namespace NETReactorSlayer.Core.Stages
21 | {
22 | internal class SymbolRenamer : IStage
23 | {
24 | public void Run(IContext context)
25 | {
26 | context.Logger.Info("Renaming obfuscated symbols...");
27 | var deobfuscator =
28 | new DeobfuscatorInfo(context.Module, context.Options.RenameShort).CreateDeobfuscator();
29 | var obfuscatedFile = new ObfuscatedFile(context.Module, deobfuscator);
30 | obfuscatedFile.DeobfuscatorOptions.RenamerFlags = context.Options.RenamerFlags;
31 | new Renamer(obfuscatedFile).Rename();
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.Core/Stages/TypeRestorer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.Core.Abstractions;
17 | using NETReactorSlayer.De4dot;
18 |
19 | namespace NETReactorSlayer.Core.Stages
20 | {
21 | internal class TypeRestorer : IStage
22 | {
23 | public void Run(IContext context) => new TypesRestorer(context.Module).Deobfuscate();
24 | }
25 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Deobfuscator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Text.RegularExpressions;
17 | using dnlib.DotNet;
18 |
19 | namespace NETReactorSlayer.De4dot
20 | {
21 | internal sealed class Deobfuscator : DeobfuscatorBase
22 | {
23 | public Deobfuscator(ModuleDefMD module, Options options)
24 | : base(module, options)
25 | {
26 | if (options.RemoveNamespaces)
27 | RenamingOptions |= RenamingOptions.RemoveNamespaceIfOneType;
28 | else
29 | RenamingOptions &= ~RenamingOptions.RemoveNamespaceIfOneType;
30 | if (options.RenameShort)
31 | options.ValidNameRegex.Regexes.Insert(0, new NameRegex(DeobfuscatorInfo.ShortNameRegex));
32 | }
33 |
34 | private bool CheckValidName(string name, Regex regex)
35 | {
36 | if (IsRandomName.IsMatch(name))
37 | return false;
38 | if (!regex.IsMatch(name))
39 | return CheckValidName(name);
40 | if (RandomNameChecker.IsRandom(name))
41 | return false;
42 | return RandomNameChecker.IsNonRandom(name) && CheckValidName(name);
43 | }
44 |
45 | public override bool IsValidNamespaceName(string ns)
46 | {
47 | if (ns == null)
48 | return false;
49 | return ns.Contains(".") ? base.IsValidNamespaceName(ns) : CheckValidName(ns, IsRandomNameTypes);
50 | }
51 |
52 | public override bool IsValidTypeName(string name) => name != null && CheckValidName(name, IsRandomNameTypes);
53 |
54 | public override bool IsValidMethodName(string name) =>
55 | name != null && CheckValidName(name, IsRandomNameMembers);
56 |
57 | public override bool IsValidPropertyName(string name) =>
58 | name != null && CheckValidName(name, IsRandomNameMembers);
59 |
60 | public override bool IsValidEventName(string name) => name != null && CheckValidName(name, IsRandomNameMembers);
61 |
62 | public override bool IsValidFieldName(string name) => name != null && CheckValidName(name, IsRandomNameMembers);
63 |
64 | public override bool IsValidGenericParamName(string name) =>
65 | name != null && CheckValidName(name, IsRandomNameMembers);
66 |
67 | public override bool IsValidMethodArgName(string name) =>
68 | name != null && CheckValidName(name, IsRandomNameMembers);
69 |
70 | public override bool IsValidMethodReturnArgName(string name) =>
71 | string.IsNullOrEmpty(name) || CheckValidName(name, IsRandomNameMembers);
72 |
73 | public override bool IsValidResourceKeyName(string name) =>
74 | name != null && CheckValidName(name, IsRandomNameMembers);
75 |
76 | private static readonly Regex IsRandomName = new(@"^[A-Z]{30,40}$");
77 | private static readonly Regex IsRandomNameMembers = new(@"^(?:[a-zA-Z0-9]{9,11}|[a-zA-Z0-9]{18,20})$");
78 | private static readonly Regex IsRandomNameTypes = new(@"^[a-zA-Z0-9]{18,20}(?:`\d+)?$");
79 |
80 | public override string Name => DeobfuscatorInfo.TheName;
81 |
82 | internal class Options : OptionsBase
83 | {
84 | public bool RemoveNamespaces { get; set; }
85 | public bool RenameShort { get; set; }
86 | public bool RestoreTypes { get; set; }
87 | }
88 | }
89 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/DeobfuscatorBase.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Linq;
18 | using dnlib.DotNet;
19 |
20 | namespace NETReactorSlayer.De4dot
21 | {
22 | public abstract class DeobfuscatorBase : IDeobfuscator
23 | {
24 | protected DeobfuscatorBase(ModuleDefMD module, OptionsBase optionsBase)
25 | {
26 | _optionsBase = optionsBase;
27 | Module = module;
28 | }
29 |
30 | protected virtual bool CheckValidName(string name) => _optionsBase.ValidNameRegex.IsMatch(name);
31 |
32 | public override string ToString() => Name;
33 |
34 | protected virtual void Dispose(bool disposing) { }
35 |
36 | public virtual bool IsValidNamespaceName(string ns) => ns != null && ns.Split('.').All(CheckValidName);
37 |
38 | public virtual bool IsValidTypeName(string name) => name != null && CheckValidName(name);
39 |
40 | public virtual bool IsValidMethodName(string name) => name != null && CheckValidName(name);
41 |
42 | public virtual bool IsValidPropertyName(string name) => name != null && CheckValidName(name);
43 |
44 | public virtual bool IsValidEventName(string name) => name != null && CheckValidName(name);
45 |
46 | public virtual bool IsValidFieldName(string name) => name != null && CheckValidName(name);
47 |
48 | public virtual bool IsValidGenericParamName(string name) => name != null && CheckValidName(name);
49 |
50 | public virtual bool IsValidMethodArgName(string name) => name != null && CheckValidName(name);
51 |
52 | public virtual bool IsValidMethodReturnArgName(string name) =>
53 | string.IsNullOrEmpty(name) || CheckValidName(name);
54 |
55 | public virtual bool IsValidResourceKeyName(string name) => name != null && CheckValidName(name);
56 |
57 | public void Dispose()
58 | {
59 | Dispose(true);
60 | GC.SuppressFinalize(this);
61 | }
62 |
63 | private readonly OptionsBase _optionsBase;
64 | protected ModuleDefMD Module;
65 |
66 | public const string DefaultAsianValidNameRegex =
67 | @"^[\u2E80-\u9FFFa-zA-Z_<{$][\u2E80-\u9FFFa-zA-Z_0-9<>{}$.`-]*$";
68 |
69 | public const string DefaultValidNameRegex = @"^[a-zA-Z_<{$][a-zA-Z_0-9<>{}$.`-]*$";
70 | public abstract string Name { get; }
71 | public virtual RenamingOptions RenamingOptions { get; set; }
72 |
73 | public IDeobfuscatorOptions TheOptions => _optionsBase;
74 |
75 | public class OptionsBase : IDeobfuscatorOptions
76 | {
77 | public OptionsBase() => RenameResourcesInCode = true;
78 |
79 | public bool RenameResourcesInCode { get; set; }
80 |
81 | public NameRegexes ValidNameRegex { get; set; }
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/DeobfuscatorContext.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot
19 | {
20 | public class DeobfuscatorContext : IDeobfuscatorContext
21 | {
22 | private static ITypeDefOrRef GetNonGenericTypeRef(ITypeDefOrRef typeRef)
23 | {
24 | if (typeRef is not TypeSpec ts)
25 | return typeRef;
26 | var gis = ts.TryGetGenericInstSig();
27 | return gis?.GenericType == null ? typeRef : gis.GenericType.TypeDefOrRef;
28 | }
29 |
30 | public TypeDef ResolveType(ITypeDefOrRef type)
31 | {
32 | if (type == null)
33 | return null;
34 | type = GetNonGenericTypeRef(type);
35 |
36 | return type switch
37 | {
38 | TypeDef typeDef => typeDef,
39 | TypeRef tr => tr.Resolve(),
40 | _ => null
41 | };
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/DeobfuscatorInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot
19 | {
20 | public class DeobfuscatorInfo : DeobfuscatorInfoBase
21 | {
22 | public DeobfuscatorInfo(ModuleDefMD moduleDefMd, bool renameShort)
23 | : base(DefaultRegex)
24 | {
25 | _module = moduleDefMd;
26 | _renameShort = renameShort;
27 | }
28 |
29 | public virtual IDeobfuscator CreateDeobfuscator() =>
30 | new Deobfuscator(_module, new Deobfuscator.Options
31 | {
32 | ValidNameRegex = ValidNameRegex.Get(),
33 | RestoreTypes = true,
34 | RemoveNamespaces = true,
35 | RenameShort = _renameShort
36 | });
37 |
38 | private readonly ModuleDefMD _module;
39 | private readonly bool _renameShort;
40 |
41 | private const string DefaultRegex = DeobfuscatorBase.DefaultAsianValidNameRegex;
42 | public const string ShortNameRegex = @"!^[A-Za-z0-9]{2,3}$";
43 |
44 | public const string TheName = ".NET Reactor";
45 |
46 | public override string Name => TheName;
47 | }
48 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/DeobfuscatorInfoBase.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot
17 | {
18 | public abstract class DeobfuscatorInfoBase : IDeobfuscatorInfo
19 | {
20 | protected DeobfuscatorInfoBase(string nameRegex) =>
21 | ValidNameRegex = new NameRegexOption(null, MakeArgName("name"), "Valid name regex pattern",
22 | nameRegex ?? DeobfuscatorBase.DefaultValidNameRegex);
23 |
24 | protected string MakeArgName(string name) => name;
25 |
26 | protected NameRegexOption ValidNameRegex;
27 |
28 | public abstract string Name { get; }
29 | }
30 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/IDeobfuscator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using NETReactorSlayer.De4dot.Renamer;
18 |
19 | namespace NETReactorSlayer.De4dot
20 | {
21 | public interface IDeobfuscator : INameChecker, IDisposable
22 | {
23 | string Name { get; }
24 | RenamingOptions RenamingOptions { get; }
25 | IDeobfuscatorOptions TheOptions { get; }
26 | }
27 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/IDeobfuscatorContext.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot
19 | {
20 | public interface IDeobfuscatorContext
21 | {
22 | TypeDef ResolveType(ITypeDefOrRef type);
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/IDeobfuscatorInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot
17 | {
18 | public interface IDeobfuscatorInfo
19 | {
20 | string Name { get; }
21 | }
22 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/IDeobfuscatorOptions.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot
17 | {
18 | public interface IDeobfuscatorOptions
19 | {
20 | bool RenameResourcesInCode { get; }
21 | }
22 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/IObfuscatedFile.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using dnlib.DotNet;
18 | using NETReactorSlayer.De4dot.Renamer;
19 |
20 | namespace NETReactorSlayer.De4dot
21 | {
22 | public interface IObfuscatedFile : IDisposable
23 | {
24 | IDeobfuscatorContext DeobfuscatorContext { get; }
25 | ObfuscatedFile.Options DeobfuscatorOptions { get; }
26 | ModuleDefMD ModuleDefMd { get; }
27 | INameChecker NameChecker { get; }
28 | bool RemoveNamespaceWithOneType { get; }
29 | bool RenameResourceKeys { get; }
30 | bool RenameResourcesInCode { get; }
31 | }
32 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/NETReactorSlayer.De4dot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | ..\bin\$(Configuration)\
8 | Library
9 |
10 |
11 |
12 |
13 |
14 |
15 | ..\Libs\net35\de4dot.blocks.dll
16 |
17 |
18 | ..\Libs\netcoreapp3.1\de4dot.blocks.dll
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/NameRegex.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Text.RegularExpressions;
17 |
18 | namespace NETReactorSlayer.De4dot
19 | {
20 | public class NameRegex
21 | {
22 | public NameRegex(string regex)
23 | {
24 | if (regex.Length > 0 && regex[0] == InvertChar)
25 | {
26 | regex = regex.Substring(1);
27 | MatchValue = false;
28 | }
29 | else
30 | MatchValue = true;
31 |
32 | _regex = new Regex(regex);
33 | }
34 |
35 | public bool IsMatch(string s) => _regex.IsMatch(s);
36 |
37 | public override string ToString()
38 | {
39 | if (!MatchValue)
40 | return InvertChar + _regex.ToString();
41 | return _regex.ToString();
42 | }
43 |
44 | private readonly Regex _regex;
45 |
46 | public const char InvertChar = '!';
47 |
48 | public bool MatchValue { get; }
49 | }
50 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/NameRegexOption.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 |
18 | namespace NETReactorSlayer.De4dot
19 | {
20 | public class NameRegexOption : Option
21 | {
22 | public NameRegexOption(string shortName, string longName, string description, string val)
23 | : base(shortName, longName, description) =>
24 | Default = _val = new NameRegexes(val);
25 |
26 | public override bool Set(string newVal, out string error)
27 | {
28 | try
29 | {
30 | var regexes = new NameRegexes();
31 | regexes.Set(newVal);
32 | _val = regexes;
33 | }
34 | catch (ArgumentException)
35 | {
36 | error = $"Could not parse regex '{newVal}'";
37 | return false;
38 | }
39 |
40 | error = "";
41 | return true;
42 | }
43 |
44 | public NameRegexes Get() => _val;
45 |
46 | private NameRegexes _val;
47 | }
48 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/NameRegexes.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using System.Linq;
18 |
19 | namespace NETReactorSlayer.De4dot
20 | {
21 | public class NameRegexes
22 | {
23 | public NameRegexes() : this("") { }
24 |
25 | public NameRegexes(string regex) => Set(regex);
26 |
27 | public void Set(string regexesString)
28 | {
29 | Regexes = new List();
30 | if (regexesString == "")
31 | return;
32 | foreach (var regex in regexesString.Split(RegexSeparatorChar))
33 | Regexes.Add(new NameRegex(regex));
34 | }
35 |
36 | public bool IsMatch(string s)
37 | {
38 | foreach (var regex in Regexes.Where(regex => regex.IsMatch(s)))
39 | return regex.MatchValue;
40 |
41 | return DefaultValue;
42 | }
43 |
44 | public override string ToString()
45 | {
46 | var s = "";
47 | for (var i = 0; i < Regexes.Count; i++)
48 | {
49 | if (i > 0)
50 | s += RegexSeparatorChar;
51 | s += Regexes[i].ToString();
52 | }
53 |
54 | return s;
55 | }
56 |
57 | public const char RegexSeparatorChar = '&';
58 |
59 | public bool DefaultValue { get; set; }
60 | public IList Regexes { get; private set; }
61 | }
62 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/ObfuscatedFile.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 | using NETReactorSlayer.De4dot.Renamer;
18 |
19 | namespace NETReactorSlayer.De4dot
20 | {
21 | public class ObfuscatedFile : IObfuscatedFile
22 | {
23 | public ObfuscatedFile(ModuleDefMD module, IDeobfuscator deobfuscator)
24 | {
25 | Deobfuscator = deobfuscator;
26 | ModuleDefMd = module;
27 | DeobfuscatorOptions = new Options();
28 | }
29 |
30 | public void Dispose()
31 | {
32 | ModuleDefMd?.Dispose();
33 | Deobfuscator?.Dispose();
34 | ModuleDefMd = null;
35 | Deobfuscator = null;
36 | }
37 |
38 | public IDeobfuscator Deobfuscator { get; private set; }
39 | public IDeobfuscatorContext DeobfuscatorContext => new DeobfuscatorContext();
40 | public Options DeobfuscatorOptions { get; }
41 |
42 | public ModuleDefMD ModuleDefMd { get; private set; }
43 | public INameChecker NameChecker => Deobfuscator;
44 |
45 | public bool RemoveNamespaceWithOneType =>
46 | (Deobfuscator.RenamingOptions & RenamingOptions.RemoveNamespaceIfOneType) != 0;
47 |
48 | public bool RenameResourceKeys => (Deobfuscator.RenamingOptions & RenamingOptions.RenameResourceKeys) != 0;
49 | public bool RenameResourcesInCode => Deobfuscator.TheOptions.RenameResourcesInCode;
50 |
51 | public class Options
52 | {
53 | public RenamerFlags RenamerFlags =
54 | RenamerFlags.RenameNamespaces |
55 | RenamerFlags.RenameTypes |
56 | RenamerFlags.RenameEvents |
57 | RenamerFlags.RenameFields |
58 | RenamerFlags.RenameMethods |
59 | RenamerFlags.RenameMethodArgs |
60 | RenamerFlags.RenameGenericParams |
61 | RenamerFlags.RestoreEventsFromNames |
62 | RenamerFlags.RestoreEvents;
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Option.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot
17 | {
18 | public abstract class Option
19 | {
20 | protected Option(string shortName, string longName, string description)
21 | {
22 | if (shortName != null)
23 | ShortName = ShortnamePrefix + shortName;
24 | if (longName != null)
25 | LongName = LongnamePrefix + longName;
26 | Description = description;
27 | }
28 |
29 | public abstract bool Set(string val, out string error);
30 | private const string LongnamePrefix = "--";
31 | private const string ShortnamePrefix = "-";
32 | public object Default { get; protected set; }
33 | public string Description { get; }
34 | public string LongName { get; }
35 |
36 | public string ShortName { get; }
37 | }
38 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/PushedArgs.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using dnlib.DotNet.Emit;
18 |
19 | namespace NETReactorSlayer.De4dot
20 | {
21 | public class PushedArgs
22 | {
23 | public PushedArgs(int numArgs)
24 | {
25 | _nextIndex = numArgs - 1;
26 | _args = new List(numArgs);
27 | for (var i = 0; i < numArgs; i++)
28 | _args.Add(null);
29 | }
30 |
31 | public void Add(Instruction instr) => _args[_nextIndex--] = instr;
32 |
33 | public void Set(int i, Instruction instr) => _args[i] = instr;
34 |
35 | internal void Pop() => _args[++_nextIndex] = null;
36 |
37 | public Instruction Get(int i)
38 | {
39 | if (0 <= i && i < _args.Count)
40 | return _args[i];
41 | return null;
42 | }
43 |
44 | public Instruction GetEnd(int i) => Get(_args.Count - 1 - i);
45 |
46 | private readonly List _args;
47 | private int _nextIndex;
48 |
49 | public bool CanAddMore => _nextIndex >= 0;
50 | public int NumValidArgs => _args.Count - (_nextIndex + 1);
51 | }
52 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/DictHelper.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
19 | {
20 | public static class DictHelper
21 | {
22 | public static IEnumerable GetSorted(IEnumerable values) where T : Ref
23 | {
24 | var list = new List(values);
25 | list.Sort((a, b) => a.Index.CompareTo(b.Index));
26 | return list;
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/EventDefDict.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using de4dot.blocks;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
20 | {
21 | public class EventDefDict : EventDefDict
22 | {
23 | public IEnumerable GetSorted() => DictHelper.GetSorted(GetValues());
24 |
25 | public void Add(MEventDef eventDef) => Add(eventDef.EventDef, eventDef);
26 | }
27 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/FieldDefDict.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using de4dot.blocks;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
20 | {
21 | public class FieldDefDict : FieldDefDict
22 | {
23 | public IEnumerable GetSorted() => DictHelper.GetSorted(GetValues());
24 |
25 | public void Add(MFieldDef fieldDef) => Add(fieldDef.FieldDef, fieldDef);
26 | }
27 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/IResolver.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
19 | {
20 | public interface IResolver
21 | {
22 | MTypeDef ResolveType(ITypeDefOrRef typeRef);
23 | MMethodDef ResolveMethod(IMethodDefOrRef methodRef);
24 | MFieldDef ResolveField(MemberRef fieldRef);
25 | }
26 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/InterfaceMethodInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 | using System.Linq;
19 |
20 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
21 | {
22 | public class InterfaceMethodInfo
23 | {
24 | public InterfaceMethodInfo(TypeInfo iface)
25 | {
26 | Face = iface;
27 | foreach (var methodDef in iface.TypeDef.AllMethods)
28 | IfaceMethodToClassMethod[new MethodDefKey(methodDef)] = null;
29 | }
30 |
31 | public InterfaceMethodInfo(TypeInfo iface, InterfaceMethodInfo other)
32 | {
33 | Face = iface;
34 | foreach (var key in other.IfaceMethodToClassMethod.Keys)
35 | IfaceMethodToClassMethod[key] = other.IfaceMethodToClassMethod[key];
36 | }
37 |
38 | public void Merge(InterfaceMethodInfo other)
39 | {
40 | foreach (var key in other.IfaceMethodToClassMethod.Keys.Where(
41 | key => other.IfaceMethodToClassMethod[key] != null))
42 | {
43 | if (IfaceMethodToClassMethod[key] != null)
44 | throw new ApplicationException("Interface method already initialized");
45 | IfaceMethodToClassMethod[key] = other.IfaceMethodToClassMethod[key];
46 | }
47 | }
48 |
49 | public MMethodDef AddMethod(MMethodDef ifaceMethod, MMethodDef classMethod)
50 | {
51 | var ifaceKey = new MethodDefKey(ifaceMethod);
52 | if (!IfaceMethodToClassMethod.ContainsKey(ifaceKey))
53 | throw new ApplicationException("Could not find interface method");
54 |
55 | IfaceMethodToClassMethod.TryGetValue(ifaceKey, out var oldMethod);
56 | IfaceMethodToClassMethod[ifaceKey] = classMethod;
57 | return oldMethod;
58 | }
59 |
60 | public void AddMethodIfEmpty(MMethodDef ifaceMethod, MMethodDef classMethod)
61 | {
62 | if (IfaceMethodToClassMethod[new MethodDefKey(ifaceMethod)] == null)
63 | AddMethod(ifaceMethod, classMethod);
64 | }
65 |
66 | public override string ToString() => Face.ToString();
67 |
68 | public TypeInfo Face { get; }
69 |
70 | public Dictionary IfaceMethodToClassMethod { get; } = new();
71 | }
72 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/InterfaceMethodInfos.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 | using dnlib.DotNet;
19 |
20 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
21 | {
22 | public class InterfaceMethodInfos
23 | {
24 | public void InitializeFrom(InterfaceMethodInfos other, GenericInstSig git)
25 | {
26 | foreach (var pair in other._interfaceMethods)
27 | {
28 | var oldTypeInfo = pair.Value.Face;
29 | var newTypeInfo = new TypeInfo(oldTypeInfo, git);
30 | var oldKey = oldTypeInfo.TypeRef;
31 | var newKey = newTypeInfo.TypeRef;
32 |
33 | var newMethodsInfo = new InterfaceMethodInfo(newTypeInfo, other._interfaceMethods[oldKey]);
34 | if (_interfaceMethods.ContainsKey(newKey))
35 | newMethodsInfo.Merge(_interfaceMethods[newKey]);
36 | _interfaceMethods[newKey] = newMethodsInfo;
37 | }
38 | }
39 |
40 | public void AddInterface(TypeInfo iface)
41 | {
42 | var key = iface.TypeRef;
43 | if (!_interfaceMethods.ContainsKey(key))
44 | _interfaceMethods[key] = new InterfaceMethodInfo(iface);
45 | }
46 |
47 | public MMethodDef AddMethod(TypeInfo iface, MMethodDef ifaceMethod, MMethodDef classMethod) =>
48 | AddMethod(iface.TypeRef, ifaceMethod, classMethod);
49 |
50 | public MMethodDef AddMethod(ITypeDefOrRef iface, MMethodDef ifaceMethod, MMethodDef classMethod)
51 | {
52 | if (!_interfaceMethods.TryGetValue(iface, out var info))
53 | throw new ApplicationException("Could not find interface");
54 | return info.AddMethod(ifaceMethod, classMethod);
55 | }
56 |
57 | public void AddMethodIfEmpty(TypeInfo iface, MMethodDef ifaceMethod, MMethodDef classMethod)
58 | {
59 | if (!_interfaceMethods.TryGetValue(iface.TypeRef, out var info))
60 | throw new ApplicationException("Could not find interface");
61 | info.AddMethodIfEmpty(ifaceMethod, classMethod);
62 | }
63 |
64 | private readonly Dictionary _interfaceMethods =
65 | new(TypeEqualityComparer.Instance);
66 |
67 | public IEnumerable AllInfos => _interfaceMethods.Values;
68 | }
69 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MEventDef.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using dnlib.DotNet;
19 |
20 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
21 | {
22 | public class MEventDef : Ref
23 | {
24 | public MEventDef(IMemberRef memberRef, MTypeDef owner, int index)
25 | : base(memberRef, owner, index) { }
26 |
27 | public IEnumerable MethodDefs()
28 | {
29 | if (EventDef.AddMethod != null)
30 | yield return EventDef.AddMethod;
31 | if (EventDef.RemoveMethod != null)
32 | yield return EventDef.RemoveMethod;
33 | if (EventDef.InvokeMethod != null)
34 | yield return EventDef.InvokeMethod;
35 | if (EventDef.OtherMethods == null)
36 | yield break;
37 | foreach (var m in EventDef.OtherMethods)
38 | yield return m;
39 | }
40 |
41 | public bool IsVirtual() => MethodDefs().Any(method => method.IsVirtual);
42 |
43 | public MMethodDef AddMethod { get; set; }
44 | public EventDef EventDef => (EventDef)MemberRef;
45 | public MMethodDef RaiseMethod { get; set; }
46 | public MMethodDef RemoveMethod { get; set; }
47 | }
48 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MFieldDef.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
19 | {
20 | public class MFieldDef : Ref
21 | {
22 | public MFieldDef(IMemberRef fieldDef, MTypeDef owner, int index) : base(fieldDef, owner, index) { }
23 |
24 | public FieldDef FieldDef => (FieldDef)MemberRef;
25 | }
26 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MGenericParamDef.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using dnlib.DotNet;
19 |
20 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
21 | {
22 | public class MGenericParamDef : Ref
23 | {
24 | public MGenericParamDef(IMemberRef memberRef, int index)
25 | : base(memberRef, null, index) { }
26 |
27 | public static List CreateGenericParamDefList(IEnumerable parameters)
28 | {
29 | var list = new List();
30 | if (parameters == null)
31 | return list;
32 | var i = 0;
33 | list.AddRange(parameters.Select(param => new MGenericParamDef(param, i++)));
34 | return list;
35 | }
36 |
37 | public GenericParam GenericParam => (GenericParam)MemberRef;
38 | }
39 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MMethodDef.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using dnlib.DotNet;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
20 | {
21 | public class MMethodDef : Ref
22 | {
23 | public MMethodDef(MethodDef methodDef, MTypeDef owner, int index)
24 | : base(methodDef, owner, index)
25 | {
26 | GenericParams = MGenericParamDef.CreateGenericParamDefList(MethodDef.GenericParameters);
27 | VisibleParameterBaseIndex = methodDef.MethodSig is { HasThis: true } ? 1 : 0;
28 | for (var i = 0; i < methodDef.Parameters.Count; i++)
29 | {
30 | var param = methodDef.Parameters[i];
31 | if (param.IsNormalMethodParameter)
32 | VisibleParameterCount++;
33 | ParamDefs.Add(new MParamDef(param, i));
34 | }
35 |
36 | ReturnParamDef = new MParamDef(methodDef.Parameters.ReturnParameter, -1);
37 | }
38 |
39 | public bool IsPublic() => MethodDef.IsPublic;
40 |
41 | public bool IsVirtual() => MethodDef.IsVirtual;
42 |
43 | public bool IsNewSlot() => MethodDef.IsNewSlot;
44 |
45 | public bool IsStatic() => MethodDef.IsStatic;
46 |
47 | public IEnumerable AllParamDefs
48 | {
49 | get
50 | {
51 | yield return ReturnParamDef;
52 | foreach (var paramDef in ParamDefs)
53 | yield return paramDef;
54 | }
55 | }
56 |
57 | public MEventDef Event { get; set; }
58 |
59 | public IList GenericParams { get; }
60 |
61 | public MethodDef MethodDef => (MethodDef)MemberRef;
62 |
63 | public IList ParamDefs { get; } = new List();
64 |
65 | public MPropertyDef Property { get; set; }
66 |
67 | public MParamDef ReturnParamDef { get; }
68 |
69 | public int VisibleParameterBaseIndex { get; }
70 | public int VisibleParameterCount { get; }
71 | }
72 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MParamDef.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
19 | {
20 | public class MParamDef
21 | {
22 | public MParamDef(Parameter parameterDef, int index)
23 | {
24 | ParameterDef = parameterDef;
25 | Index = index;
26 | }
27 |
28 | public int Index { get; }
29 | public bool IsHiddenThisParameter => ParameterDef.IsHiddenThisParameter;
30 | public Parameter ParameterDef { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MPropertyDef.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using dnlib.DotNet;
19 |
20 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
21 | {
22 | public class MPropertyDef : Ref
23 | {
24 | public MPropertyDef(IMemberRef memberRef, MTypeDef owner, int index)
25 | : base(memberRef, owner, index) { }
26 |
27 | public IEnumerable MethodDefs()
28 | {
29 | if (PropertyDef.GetMethod != null)
30 | yield return PropertyDef.GetMethod;
31 | if (PropertyDef.SetMethod != null)
32 | yield return PropertyDef.SetMethod;
33 | if (PropertyDef.OtherMethods == null)
34 | yield break;
35 | foreach (var m in PropertyDef.OtherMethods)
36 | yield return m;
37 | }
38 |
39 | public bool IsVirtual() => MethodDefs().Any(method => method.IsVirtual);
40 |
41 | public bool IsItemProperty()
42 | {
43 | if (GetMethod is { VisibleParameterCount: >= 1 })
44 | return true;
45 | return SetMethod is { VisibleParameterCount: >= 2 };
46 | }
47 |
48 | public MMethodDef GetMethod { get; set; }
49 | public PropertyDef PropertyDef => (PropertyDef)MemberRef;
50 | public MMethodDef SetMethod { get; set; }
51 | }
52 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MethodDefDict.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using de4dot.blocks;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
20 | {
21 | public class MethodDefDict : MethodDefDict
22 | {
23 | public IEnumerable GetSorted() => DictHelper.GetSorted(GetValues());
24 |
25 | public void Add(MMethodDef methodDef) => Add(methodDef.MethodDef, methodDef);
26 | }
27 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MethodDefKey.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
19 | {
20 | public class MethodDefKey
21 | {
22 | public MethodDefKey(MMethodDef methodDef) => MethodDef = methodDef;
23 |
24 | public override int GetHashCode() =>
25 | MethodEqualityComparer.CompareDeclaringTypes.GetHashCode(MethodDef.MethodDef);
26 |
27 | public override bool Equals(object obj) => obj is MethodDefKey other &&
28 | MethodEqualityComparer.CompareDeclaringTypes.Equals(
29 | MethodDef.MethodDef, other.MethodDef.MethodDef);
30 |
31 | public readonly MMethodDef MethodDef;
32 | }
33 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MethodInst.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
19 | {
20 | public class MethodInst
21 | {
22 | public MethodInst(MMethodDef origMethodDef, IMethodDefOrRef methodRef)
23 | {
24 | OrigMethodDef = origMethodDef;
25 | MethodRef = methodRef;
26 | }
27 |
28 | public override string ToString() => MethodRef.ToString();
29 |
30 | public IMethodDefOrRef MethodRef;
31 | public MMethodDef OrigMethodDef;
32 | }
33 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MethodInstances.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using de4dot.blocks;
18 | using dnlib.DotNet;
19 |
20 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
21 | {
22 | public class MethodInstances
23 | {
24 | public void InitializeFrom(MethodInstances other, GenericInstSig git)
25 | {
26 | foreach (var list in other._methodInstances.Values)
27 | foreach (var methodInst in list)
28 | {
29 | var newMethod = GenericArgsSubstitutor.Create(methodInst.MethodRef, git);
30 | Add(new MethodInst(methodInst.OrigMethodDef, newMethod));
31 | }
32 | }
33 |
34 | public void Add(MethodInst methodInst)
35 | {
36 | var key = methodInst.MethodRef;
37 | if (methodInst.OrigMethodDef.IsNewSlot() || !_methodInstances.TryGetValue(key, out var list))
38 | _methodInstances[key] = list = new List();
39 | list.Add(methodInst);
40 | }
41 |
42 | public List Lookup(IMethodDefOrRef methodRef)
43 | {
44 | _methodInstances.TryGetValue(methodRef, out var list);
45 | return list;
46 | }
47 |
48 | public IEnumerable> GetMethods() => _methodInstances.Values;
49 |
50 | private readonly Dictionary> _methodInstances =
51 | new(MethodEqualityComparer.DontCompareDeclaringTypes);
52 | }
53 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MethodNameGroup.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using System.Linq;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
20 | {
21 | public class MethodNameGroup
22 | {
23 | public void Add(MMethodDef method) => Methods.Add(method);
24 |
25 | public void Merge(MethodNameGroup other)
26 | {
27 | if (this == other)
28 | return;
29 | Methods.AddRange(other.Methods);
30 | }
31 |
32 | public bool HasNonRenamableMethod() => Methods.Any(method => !method.Owner.HasModule);
33 |
34 | public bool HasInterfaceMethod() => Methods.Any(method => method.Owner.TypeDef.IsInterface);
35 |
36 | public bool HasGetterOrSetterPropertyMethod() => (from method in Methods
37 | where method.Property != null
38 | let prop = method.Property
39 | where method == prop.GetMethod || method == prop.SetMethod
40 | select method).Any();
41 |
42 | public bool HasAddRemoveOrRaiseEventMethod() => (from method in Methods
43 | where method.Event != null
44 | let evt = method.Event
45 | where method == evt.AddMethod || method == evt.RemoveMethod || method == evt.RaiseMethod
46 | select method).Any();
47 |
48 | public bool HasProperty() => Methods.Any(method => method.Property != null);
49 |
50 | public bool HasEvent() => Methods.Any(method => method.Event != null);
51 |
52 | public override string ToString() => $"{Methods.Count} -- {(Methods.Count > 0 ? Methods[0].ToString() : "")}";
53 |
54 | public int Count => Methods.Count;
55 |
56 | public List Methods { get; } = new();
57 | }
58 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/MethodNameGroups.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
20 | {
21 | public class MethodNameGroups
22 | {
23 | public void Same(MMethodDef a, MMethodDef b) => Merge(Get(a), Get(b));
24 |
25 | public void Add(MMethodDef methodDef) => Get(methodDef);
26 |
27 | public MethodNameGroup Get(MMethodDef method)
28 | {
29 | if (!method.IsVirtual())
30 | throw new ApplicationException("Not a virtual method");
31 | if (_methodGroups.TryGetValue(method, out var group))
32 | return group;
33 | _methodGroups[method] = group = new MethodNameGroup();
34 | group.Add(method);
35 |
36 | return group;
37 | }
38 |
39 | private void Merge(MethodNameGroup a, MethodNameGroup b)
40 | {
41 | if (a == b)
42 | return;
43 |
44 | if (a.Count < b.Count)
45 | (a, b) = (b, a);
46 |
47 | a.Merge(b);
48 | foreach (var methodDef in b.Methods)
49 | _methodGroups[methodDef] = a;
50 | }
51 |
52 | public IEnumerable GetAllGroups() => Utils.Unique(_methodGroups.Values);
53 |
54 | private readonly Dictionary _methodGroups = new();
55 | }
56 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/PropertyDefDict.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using de4dot.blocks;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
20 | {
21 | public class PropertyDefDict : PropertyDefDict
22 | {
23 | public IEnumerable GetSorted() => DictHelper.GetSorted(GetValues());
24 |
25 | public void Add(MPropertyDef propDef) => Add(propDef.PropertyDef, propDef);
26 | }
27 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/Ref.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
19 | {
20 | public abstract class Ref
21 | {
22 | protected Ref(IMemberRef memberRef, MTypeDef owner, int index)
23 | {
24 | MemberRef = memberRef;
25 | Owner = owner;
26 | Index = index;
27 | }
28 |
29 | public override string ToString() => MemberRef?.ToString() ?? string.Empty;
30 |
31 | public readonly IMemberRef MemberRef;
32 |
33 | public int Index { get; set; }
34 | public MTypeDef Owner { get; set; }
35 | }
36 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/TypeDefDict.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using de4dot.blocks;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
20 | {
21 | public class TypeDefDict : TypeDefDict
22 | {
23 | public IEnumerable GetSorted() => DictHelper.GetSorted(GetValues());
24 |
25 | public void Add(MTypeDef typeDef) => Add(typeDef.TypeDef, typeDef);
26 | }
27 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/AsmModules/TypeInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using de4dot.blocks;
17 | using dnlib.DotNet;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer.AsmModules
20 | {
21 | public class TypeInfo
22 | {
23 | public TypeInfo(ITypeDefOrRef typeRef, MTypeDef typeDef)
24 | {
25 | TypeRef = typeRef;
26 | TypeDef = typeDef;
27 | }
28 |
29 | public TypeInfo(TypeInfo other, GenericInstSig git)
30 | {
31 | TypeRef = GenericArgsSubstitutor.Create(other.TypeRef, git);
32 | TypeDef = other.TypeDef;
33 | }
34 |
35 | public override int GetHashCode() => TypeDef.GetHashCode() + new SigComparer().GetHashCode(TypeRef);
36 |
37 | public override bool Equals(object obj)
38 | {
39 | if (obj is not TypeInfo other)
40 | return false;
41 | return TypeDef == other.TypeDef &&
42 | new SigComparer().Equals(TypeRef, other.TypeRef);
43 | }
44 |
45 | public override string ToString() => TypeRef.ToString();
46 |
47 | public readonly MTypeDef TypeDef;
48 | public readonly ITypeDefOrRef TypeRef;
49 | }
50 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/DerivedFrom.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 | using NETReactorSlayer.De4dot.Renamer.AsmModules;
19 |
20 | namespace NETReactorSlayer.De4dot.Renamer
21 | {
22 | public class DerivedFrom
23 | {
24 | public DerivedFrom(IEnumerable classNames)
25 | {
26 | foreach (var className in classNames)
27 | AddName(className);
28 | }
29 |
30 | private void AddName(string className) => _classNames[className] = true;
31 |
32 | public bool Check(MTypeDef type) => Check(type, 0);
33 |
34 | public bool Check(MTypeDef type, int recurseCount)
35 | {
36 | if (recurseCount >= 100)
37 | return false;
38 | if (_results.ContainsKey(type))
39 | return _results[type];
40 |
41 | bool val;
42 | if (_classNames.ContainsKey(type.TypeDef.FullName))
43 | val = true;
44 | else if (type.BaseType == null)
45 | val = type.TypeDef.BaseType != null && _classNames.ContainsKey(type.TypeDef.BaseType.FullName);
46 | else
47 | val = Check(type.BaseType.TypeDef, recurseCount + 1);
48 |
49 | _results[type] = val;
50 | return val;
51 | }
52 |
53 | private readonly Dictionary _classNames = new(StringComparer.Ordinal);
54 | private readonly Dictionary _results = new();
55 | }
56 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/EventInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.De4dot.Renamer.AsmModules;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | public class EventInfo : MemberInfo
21 | {
22 | public EventInfo(Ref @ref) : base(@ref) { }
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/ExistingNames.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 | using dnlib.DotNet;
19 |
20 | namespace NETReactorSlayer.De4dot.Renamer
21 | {
22 | public class ExistingNames
23 | {
24 | public void Add(string name) => _allNames[name] = true;
25 |
26 | public bool Exists(string name) => _allNames.ContainsKey(name);
27 |
28 | public string GetName(UTF8String oldName, INameCreator nameCreator) =>
29 | GetName(UTF8String.ToSystemStringOrEmpty(oldName), nameCreator);
30 |
31 | public string GetName(string oldName, INameCreator nameCreator) => GetName(oldName, nameCreator.Create);
32 |
33 | public string GetName(UTF8String oldName, Func createNewName) =>
34 | GetName(UTF8String.ToSystemStringOrEmpty(oldName), createNewName);
35 |
36 | public string GetName(string oldName, Func createNewName)
37 | {
38 | string prevName = null;
39 | while (true)
40 | {
41 | var name = createNewName();
42 | if (name == prevName)
43 | throw new ApplicationException($"Could not rename symbol to {Utils.ToCsharpString(name)}");
44 |
45 | if (!Exists(name) || name == oldName)
46 | {
47 | _allNames[name] = true;
48 | return name;
49 | }
50 |
51 | prevName = name;
52 | }
53 | }
54 |
55 | public void Merge(ExistingNames other)
56 | {
57 | if (this == other)
58 | return;
59 | foreach (var key in other._allNames.Keys)
60 | _allNames[key] = true;
61 | }
62 |
63 | private readonly Dictionary _allNames = new(StringComparer.Ordinal);
64 | }
65 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/FieldInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.De4dot.Renamer.AsmModules;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | public class FieldInfo : MemberInfo
21 | {
22 | public FieldInfo(Ref @ref) : base(@ref) { }
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/GenericParamInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.De4dot.Renamer.AsmModules;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | public class GenericParamInfo : MemberInfo
21 | {
22 | public GenericParamInfo(Ref @ref) : base(@ref) { }
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/GenericParamNameCreator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot.Renamer
17 | {
18 | public class GenericParamNameCreator : NameCreatorCounter
19 | {
20 | public override string Create() => Num < Names.Length ? Names[Num++] : $"T{Num++}";
21 |
22 | private static readonly string[] Names = { "T", "U", "V", "W", "X", "Y", "Z" };
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/GlobalTypeNameCreator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot.Renamer
17 | {
18 | public class GlobalTypeNameCreator : TypeNameCreator
19 | {
20 | public GlobalTypeNameCreator(ExistingNames existingNames) : base(existingNames) { }
21 |
22 | public override NameCreator CreateNameCreator(string prefix) => base.CreateNameCreator("G" + prefix);
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/INameChecker.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot.Renamer
17 | {
18 | public interface INameChecker
19 | {
20 | bool IsValidNamespaceName(string ns);
21 | bool IsValidTypeName(string name);
22 | bool IsValidMethodName(string name);
23 | bool IsValidPropertyName(string name);
24 | bool IsValidEventName(string name);
25 | bool IsValidFieldName(string name);
26 | bool IsValidGenericParamName(string name);
27 | bool IsValidMethodArgName(string name);
28 | bool IsValidMethodReturnArgName(string name);
29 | bool IsValidResourceKeyName(string name);
30 | }
31 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/INameCreator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot.Renamer
17 | {
18 | public interface INameCreator
19 | {
20 | string Create();
21 | }
22 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/ITypeNameCreator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | public interface ITypeNameCreator
21 | {
22 | string Create(TypeDef typeDef, string newBaseTypeName);
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/MemberInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.De4dot.Renamer.AsmModules;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | public class MemberInfo
21 | {
22 | public MemberInfo(Ref memberRef)
23 | {
24 | MemberRef = memberRef;
25 | OldFullName = memberRef.MemberRef.FullName;
26 | OldName = memberRef.MemberRef.Name.String;
27 | NewName = memberRef.MemberRef.Name.String;
28 | }
29 |
30 | public void Rename(string newTypeName)
31 | {
32 | Renamed = true;
33 | NewName = newTypeName;
34 | }
35 |
36 | public bool GotNewName() => OldName != NewName;
37 |
38 | public override string ToString() => $"O:{OldFullName} -- N:{NewName}";
39 |
40 | protected Ref MemberRef;
41 | public string NewName;
42 | public string OldFullName;
43 | public string OldName;
44 | public bool Renamed;
45 | public string SuggestedName;
46 | }
47 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/MethodInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.De4dot.Renamer.AsmModules;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | public class MethodInfo : MemberInfo
21 | {
22 | public MethodInfo(Ref @ref) : base(@ref) { }
23 |
24 | public MMethodDef MethodDef => (MMethodDef)MemberRef;
25 | }
26 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/NameCreator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot.Renamer
17 | {
18 | public class NameCreator : NameCreatorCounter
19 | {
20 | public NameCreator(string prefix) : this(prefix, 0) { }
21 |
22 | public NameCreator(string prefix, int num)
23 | {
24 | _prefix = prefix;
25 | Num = num;
26 | }
27 |
28 | public NameCreator Clone() => new(_prefix, Num);
29 |
30 | public override string Create() => _prefix + Num++;
31 |
32 | private readonly string _prefix;
33 | }
34 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/NameCreator2.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot.Renamer
17 | {
18 | public class NameCreator2 : NameCreatorCounter
19 | {
20 | public NameCreator2(string prefix)
21 | : this(prefix, 0) { }
22 |
23 | public NameCreator2(string prefix, int num)
24 | {
25 | _prefix = prefix;
26 | Num = num;
27 | }
28 |
29 | public override string Create()
30 | {
31 | string rv;
32 | if (Num == 0)
33 | rv = _prefix;
34 | else
35 | rv = _prefix + Separator + Num;
36 | Num++;
37 | return rv;
38 | }
39 |
40 | private readonly string _prefix;
41 |
42 | private const string Separator = "_";
43 | }
44 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/NameCreatorCounter.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot.Renamer
17 | {
18 | public abstract class NameCreatorCounter : INameCreator
19 | {
20 | public NameCreatorCounter Merge(NameCreatorCounter other)
21 | {
22 | if (Num < other.Num)
23 | Num = other.Num;
24 | return this;
25 | }
26 |
27 | public abstract string Create();
28 |
29 | protected int Num;
30 | }
31 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/NameInfos.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Collections.Generic;
17 | using System.Linq;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer
20 | {
21 | public class NameInfos
22 | {
23 | public void Add(string name, NameCreator nameCreator) => _nameInfos.Add(new NameInfo(name, nameCreator));
24 |
25 | public NameCreator Find(string typeName) =>
26 | (from nameInfo in _nameInfos where typeName.Contains(nameInfo.Name) select nameInfo.NameCreator)
27 | .FirstOrDefault();
28 |
29 | private readonly IList _nameInfos = new List();
30 |
31 | private class NameInfo
32 | {
33 | public NameInfo(string name, NameCreator nameCreator)
34 | {
35 | Name = name;
36 | NameCreator = nameCreator;
37 | }
38 |
39 | public readonly string Name;
40 | public readonly NameCreator NameCreator;
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/ParamInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.De4dot.Renamer.AsmModules;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | public class ParamInfo
21 | {
22 | public ParamInfo(MParamDef paramDef)
23 | {
24 | OldName = paramDef.ParameterDef.Name;
25 | NewName = paramDef.ParameterDef.Name;
26 | }
27 |
28 | public bool GotNewName() => OldName != NewName;
29 |
30 | public string NewName;
31 | public string OldName;
32 | }
33 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/PropertyInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using NETReactorSlayer.De4dot.Renamer.AsmModules;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | public class PropertyInfo : MemberInfo
21 | {
22 | public PropertyInfo(Ref @ref) : base(@ref) { }
23 | }
24 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/PropertyNameCreator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer
20 | {
21 | public class PropertyNameCreator : TypeNames
22 | {
23 | public PropertyNameCreator()
24 | {
25 | FullNameToShortName = OurFullNameToShortName;
26 | FullNameToShortNamePrefix = OurFullNameToShortNamePrefix;
27 | }
28 |
29 | protected override string FixName(string prefix, string name) => prefix.ToUpperInvariant() + UpperFirst(name);
30 |
31 | private static readonly Dictionary OurFullNameToShortName = new(StringComparer.Ordinal);
32 |
33 | private static readonly Dictionary OurFullNameToShortNamePrefix = new(StringComparer.Ordinal);
34 | }
35 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/RenamerFlags.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | [Flags]
21 | public enum RenamerFlags
22 | {
23 | RenameNamespaces = 1,
24 | RenameTypes = 2,
25 | RenameProperties = 4,
26 | RenameEvents = 8,
27 | RenameFields = 0x10,
28 | RenameMethods = 0x20,
29 | RenameMethodArgs = 0x40,
30 | RenameGenericParams = 0x80,
31 | RestoreProperties = 0x100,
32 | RestorePropertiesFromNames = 0x200,
33 | RestoreEvents = 0x400,
34 | RestoreEventsFromNames = 0x800,
35 | DontCreateNewParamDefs = 0x1000,
36 | DontRenameDelegateFields = 0x2000
37 | }
38 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/TypeNameCreator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using dnlib.DotNet;
17 |
18 | namespace NETReactorSlayer.De4dot.Renamer
19 | {
20 | public class TypeNameCreator : ITypeNameCreator
21 | {
22 | // ReSharper disable VirtualMemberCallInConstructor
23 | public TypeNameCreator(ExistingNames existingNames)
24 | {
25 | _existingNames = existingNames;
26 | _createUnknownTypeName = CreateNameCreator("Type");
27 | _createEnumName = CreateNameCreator("Enum");
28 | _createStructName = CreateNameCreator("Struct");
29 | _createDelegateName = CreateNameCreator("Delegate");
30 | _createClassName = CreateNameCreator("Class");
31 | _createInterfaceName = CreateNameCreator("Interface");
32 |
33 | var names = new[]
34 | {
35 | "Exception",
36 | "EventArgs",
37 | "Attribute",
38 | "Form",
39 | "Dialog",
40 | "Control",
41 | "Stream"
42 | };
43 | foreach (var name in names)
44 | _nameInfos.Add(name, CreateNameCreator(name));
45 | }
46 |
47 | public virtual NameCreator CreateNameCreator(string prefix) => new(prefix);
48 |
49 | private NameCreator GetNameCreator(TypeDef typeDef, string newBaseTypeName)
50 | {
51 | var nameCreator = _createUnknownTypeName;
52 | if (typeDef.IsEnum)
53 | nameCreator = _createEnumName;
54 | else if (typeDef.IsValueType)
55 | nameCreator = _createStructName;
56 | else if (typeDef.IsClass)
57 | {
58 | if (typeDef.BaseType != null)
59 | {
60 | var fullName = typeDef.BaseType.FullName;
61 | switch (fullName)
62 | {
63 | case "System.Delegate":
64 | case "System.MulticastDelegate":
65 | nameCreator = _createDelegateName;
66 | break;
67 | default:
68 | nameCreator = _nameInfos.Find(newBaseTypeName ?? typeDef.BaseType.Name.String) ??
69 | _createClassName;
70 | break;
71 | }
72 | }
73 | else
74 | nameCreator = _createClassName;
75 | }
76 | else if (typeDef.IsInterface)
77 | nameCreator = _createInterfaceName;
78 |
79 | return nameCreator;
80 | }
81 |
82 | public string Create(TypeDef typeDef, string newBaseTypeName)
83 | {
84 | var nameCreator = GetNameCreator(typeDef, newBaseTypeName);
85 | return _existingNames.GetName(typeDef.Name.String, nameCreator);
86 | }
87 |
88 | private readonly NameCreator _createClassName;
89 | private readonly NameCreator _createDelegateName;
90 | private readonly NameCreator _createEnumName;
91 | private readonly NameCreator _createInterfaceName;
92 | private readonly NameCreator _createStructName;
93 | private readonly NameCreator _createUnknownTypeName;
94 | private readonly ExistingNames _existingNames;
95 | private readonly NameInfos _nameInfos = new();
96 | }
97 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/TypeRenamerState.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 | using dnlib.DotNet;
19 |
20 | namespace NETReactorSlayer.De4dot.Renamer
21 | {
22 | public class TypeRenamerState
23 | {
24 | public TypeRenamerState()
25 | {
26 | _existingNames = new ExistingNames();
27 | _namespaceToNewName = new Dictionary(StringComparer.Ordinal);
28 | _createNamespaceName = new NameCreator("ns");
29 | GlobalTypeNameCreator = new GlobalTypeNameCreator(_existingNames);
30 | InternalTypeNameCreator = new TypeNameCreator(_existingNames);
31 | }
32 |
33 | public void AddTypeName(string name) => _existingNames.Add(name);
34 |
35 | public string GetTypeName(string oldName, string newName) =>
36 | _existingNames.GetName(oldName, new NameCreator2(newName));
37 |
38 | public string CreateNamespace(TypeDef type, string ns)
39 | {
40 | var asmFullName = type.Module.Assembly != null ? type.Module.Assembly.FullName : "";
41 |
42 | var key = $" [{type.Module.Location}] [{asmFullName}] [{type.Module.Name}] [{ns}] ";
43 | if (_namespaceToNewName.TryGetValue(key, out var newName))
44 | return newName;
45 | return _namespaceToNewName[key] = _createNamespaceName.Create();
46 | }
47 |
48 | private readonly NameCreator _createNamespaceName;
49 | private readonly ExistingNames _existingNames;
50 | private readonly Dictionary _namespaceToNewName;
51 | public ITypeNameCreator GlobalTypeNameCreator;
52 | public ITypeNameCreator InternalTypeNameCreator;
53 | }
54 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Renamer/VariableNameCreator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 |
19 | namespace NETReactorSlayer.De4dot.Renamer
20 | {
21 | public class VariableNameCreator : TypeNames
22 | {
23 | static VariableNameCreator()
24 | {
25 | OurFullNameToShortName = new Dictionary(StringComparer.Ordinal)
26 | {
27 | { "System.Boolean", "bool" },
28 | { "System.Byte", "byte" },
29 | { "System.Char", "char" },
30 | { "System.Double", "double" },
31 | { "System.Int16", "short" },
32 | { "System.Int32", "int" },
33 | { "System.Int64", "long" },
34 | { "System.IntPtr", "intptr" },
35 | { "System.SByte", "sbyte" },
36 | { "System.Single", "float" },
37 | { "System.String", "string" },
38 | { "System.UInt16", "ushort" },
39 | { "System.UInt32", "uint" },
40 | { "System.UInt64", "ulong" },
41 | { "System.UIntPtr", "uintptr" },
42 | { "System.Decimal", "decimal" }
43 | };
44 | OurFullNameToShortNamePrefix = new Dictionary(StringComparer.Ordinal)
45 | {
46 | { "System.Boolean", "Bool" },
47 | { "System.Byte", "Byte" },
48 | { "System.Char", "Char" },
49 | { "System.Double", "Double" },
50 | { "System.Int16", "Short" },
51 | { "System.Int32", "Int" },
52 | { "System.Int64", "Long" },
53 | { "System.IntPtr", "IntPtr" },
54 | { "System.SByte", "SByte" },
55 | { "System.Single", "Float" },
56 | { "System.String", "String" },
57 | { "System.UInt16", "UShort" },
58 | { "System.UInt32", "UInt" },
59 | { "System.UInt64", "ULong" },
60 | { "System.UIntPtr", "UIntPtr" },
61 | { "System.Decimal", "Decimal" }
62 | };
63 | }
64 |
65 | public VariableNameCreator()
66 | {
67 | FullNameToShortName = OurFullNameToShortName;
68 | FullNameToShortNamePrefix = OurFullNameToShortNamePrefix;
69 | }
70 |
71 | private static string LowerLeadingChars(string name)
72 | {
73 | var s = "";
74 | for (var i = 0; i < name.Length; i++)
75 | {
76 | var c = char.ToLowerInvariant(name[i]);
77 | if (c == name[i])
78 | return s + name.Substring(i);
79 | s += c;
80 | }
81 |
82 | return s;
83 | }
84 |
85 | protected override string FixName(string prefix, string name)
86 | {
87 | name = LowerLeadingChars(name);
88 | if (prefix == "")
89 | return name;
90 | return prefix + UpperFirst(name);
91 | }
92 |
93 | private static readonly Dictionary OurFullNameToShortName;
94 | private static readonly Dictionary OurFullNameToShortNamePrefix;
95 | }
96 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/RenamingOptions.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 |
18 | namespace NETReactorSlayer.De4dot
19 | {
20 | [Flags] public enum RenamingOptions { RemoveNamespaceIfOneType = 1, RenameResourceKeys = 2 }
21 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Tuple.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | namespace NETReactorSlayer.De4dot
17 | {
18 | public class Tuple
19 | {
20 | public Tuple(T1 item1, T2 item2)
21 | {
22 | Item1 = item1;
23 | Item2 = item2;
24 | }
25 |
26 | public override bool Equals(object obj)
27 | {
28 | if (obj is not Tuple other)
29 | return false;
30 | return Item1.Equals(other.Item1) && Item2.Equals(other.Item2);
31 | }
32 |
33 | public override int GetHashCode() => Item1.GetHashCode() + Item2.GetHashCode();
34 |
35 | public override string ToString() => "<" + Item1 + "," + Item2 + ">";
36 |
37 | public T1 Item1 { get; }
38 | public T2 Item2 { get; }
39 | }
40 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/TypesRestorer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using dnlib.DotNet;
18 |
19 | namespace NETReactorSlayer.De4dot
20 | {
21 | public class TypesRestorer : TypesRestorerBase
22 | {
23 | public TypesRestorer(ModuleDef module)
24 | : base(module) { }
25 |
26 | protected override bool IsValidType(IGenericParameterProvider gpp, TypeSig type)
27 | {
28 | if (type == null)
29 | return false;
30 | if (type.IsValueType)
31 | return false;
32 | return type.ElementType != ElementType.Object && base.IsValidType(gpp, type);
33 | }
34 |
35 | protected override bool IsUnknownType(object o) =>
36 | o switch
37 | {
38 | Parameter arg => arg.Type.GetElementType() == ElementType.Object,
39 | FieldDef field => field.FieldSig.GetFieldType().GetElementType() == ElementType.Object,
40 | TypeSig sig => sig.ElementType == ElementType.Object,
41 | _ => throw new ApplicationException($"Unknown type: {o.GetType()}")
42 | };
43 | }
44 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.De4dot/Utils.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Collections.Generic;
18 | using System.IO;
19 | using System.Linq;
20 | using System.Text;
21 |
22 | namespace NETReactorSlayer.De4dot
23 | {
24 | public static class Utils
25 | {
26 | public static IEnumerable Unique(IEnumerable values)
27 | {
28 | var dict = new Dictionary();
29 | foreach (var val in values)
30 | dict[val] = true;
31 | return dict.Keys;
32 | }
33 |
34 | public static string ToCsharpString(string s)
35 | {
36 | var sb = new StringBuilder(s.Length + 2);
37 | sb.Append('"');
38 | foreach (var c in s)
39 | if (c < 0x20)
40 | switch (c)
41 | {
42 | case '\a':
43 | AppendEscape(sb, 'a');
44 | break;
45 | case '\b':
46 | AppendEscape(sb, 'b');
47 | break;
48 | case '\f':
49 | AppendEscape(sb, 'f');
50 | break;
51 | case '\n':
52 | AppendEscape(sb, 'n');
53 | break;
54 | case '\r':
55 | AppendEscape(sb, 'r');
56 | break;
57 | case '\t':
58 | AppendEscape(sb, 't');
59 | break;
60 | case '\v':
61 | AppendEscape(sb, 'v');
62 | break;
63 | default:
64 | sb.Append($@"\u{(int)c:X4}");
65 | break;
66 | }
67 | else if (c is '\\' or '"')
68 | AppendEscape(sb, c);
69 | else
70 | sb.Append(c);
71 |
72 | sb.Append('"');
73 | return sb.ToString();
74 | }
75 |
76 | private static void AppendEscape(StringBuilder sb, char c)
77 | {
78 | sb.Append('\\');
79 | sb.Append(c);
80 | }
81 |
82 | public static string GetBaseName(string name)
83 | {
84 | var index = name.LastIndexOf(Path.DirectorySeparatorChar);
85 | return index < 0 ? name : name.Substring(index + 1);
86 | }
87 |
88 | public static bool StartsWith(string left, string right, StringComparison stringComparison) =>
89 | left.Length >= right.Length && left.Substring(0, right.Length).Equals(right, stringComparison);
90 |
91 | public static bool Compare(byte[] a, byte[] b)
92 | {
93 | if (a.Length != b.Length)
94 | return false;
95 | return !a.Where((t, i) => t != b[i]).Any();
96 | }
97 | }
98 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Icon.ico
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Logger.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Drawing;
18 | using System.Windows.Forms;
19 |
20 | namespace NETReactorSlayer.GUI
21 | {
22 | internal class Logger
23 | {
24 | public Logger(RichTextBox richTextBox) => _richTextBox = richTextBox;
25 |
26 | public void Write(string text, Color? color = null)
27 | {
28 | if (_richTextBox.InvokeRequired)
29 | {
30 | _richTextBox.Invoke(new MethodInvoker(() => { Write(text, color); }));
31 | return;
32 | }
33 |
34 | _richTextBox.SelectionStart = _richTextBox.TextLength;
35 | _richTextBox.SelectionLength = 0;
36 | _richTextBox.SelectionColor = color ?? Color.Gray;
37 | _richTextBox.AppendText(text);
38 | _richTextBox.SelectionColor = _richTextBox.ForeColor;
39 | Application.DoEvents();
40 | }
41 |
42 | public void WriteLine(string text, Color? color = null)
43 | {
44 | Write($"{text}", color);
45 | if (_richTextBox.InvokeRequired)
46 | {
47 | _richTextBox.Invoke(new MethodInvoker(() => { _richTextBox.AppendText(Environment.NewLine); }));
48 | return;
49 | }
50 |
51 | _richTextBox.AppendText(Environment.NewLine);
52 | }
53 |
54 | public void Clear() => _richTextBox.Clear();
55 |
56 | private readonly RichTextBox _richTextBox;
57 | }
58 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/MenuColorTable.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.Drawing;
17 | using System.Windows.Forms;
18 |
19 | namespace NETReactorSlayer.GUI
20 | {
21 | public class MenuColorTable : ProfessionalColorTable
22 | {
23 | public MenuColorTable() => UseSystemColors = false;
24 |
25 | public override Color MenuBorder => Color.Black;
26 |
27 | public override Color MenuItemBorder => Color.Black;
28 |
29 | public override Color MenuItemSelected => Color.FromArgb(18, 18, 18);
30 | }
31 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/NETReactorSlayer.GUI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | net48
8 | ..\bin\$(Configuration)\
9 | WinExe
10 | NETReactorSlayer
11 | Icon.ico
12 | app.manifest
13 | false
14 | true
15 | true
16 | true
17 | true
18 | True
19 |
20 |
21 |
22 |
23 |
24 |
25 | Component
26 |
27 |
28 | Component
29 |
30 |
31 | Component
32 |
33 |
34 | Component
35 |
36 |
37 |
38 | False
39 | Microsoft .NET Framework 4.8 %28x86 and x64%29
40 | true
41 |
42 |
43 | False
44 | .NET Framework 3.5 SP1
45 | false
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Program.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Runtime.InteropServices;
18 | using System.Windows.Forms;
19 |
20 | namespace NETReactorSlayer.GUI
21 | {
22 | internal static class Program
23 | {
24 | ///
25 | /// The main entry point for the application.
26 | ///
27 | [STAThread]
28 | private static void Main(string[] args)
29 | {
30 | try { SetProcessDPIAware(); } catch { }
31 |
32 | Application.EnableVisualStyles();
33 | Application.SetCompatibleTextRenderingDefault(false);
34 | Application.Run(new MainWindow());
35 | }
36 |
37 | [DllImport("user32.dll")] private static extern void SetProcessDPIAware();
38 | }
39 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle(".NET Reactor Slayer")]
5 | [assembly: AssemblyDescription("A deobfuscator and unpacker for Eziriz .NET Reactor.")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("CodeStrikers.org")]
8 | [assembly: AssemblyProduct("NETReactorSlayer.GUI")]
9 | [assembly: AssemblyCopyright("Copyright (C) 2021 CodeStrikers.org")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 | [assembly: ComVisible(false)]
13 | [assembly: Guid("cb061de1-00f8-46fb-9bfc-d05b8d0f59ba")]
14 | [assembly: AssemblyVersion("6.4.0.0")]
15 | [assembly: AssemblyFileVersion("6.4.0.0")]
16 | [assembly: AssemblyInformationalVersion("v6.4.0")]
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System.CodeDom.Compiler;
12 | using System.Configuration;
13 | using System.Runtime.CompilerServices;
14 |
15 | namespace NETReactorSlayer.GUI.Properties {
16 |
17 |
18 | [CompilerGenerated()]
19 | [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
20 | internal sealed partial class Settings : ApplicationSettingsBase {
21 |
22 | private static Settings defaultInstance = ((Settings)(Synchronized(new Settings())));
23 |
24 | public static Settings Default {
25 | get {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Browse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Browse.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/BrowseOver.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/BrowseOver.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Close.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/CloseOver.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/CloseOver.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Error.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Header.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Info.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Loading.gif
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Logo.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Menu.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/MenuOver.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/MenuOver.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Minimize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Minimize.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/MinimizeOver.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/MinimizeOver.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Question.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Question.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/Warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/Warning.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/scrollbar_arrow_clicked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/scrollbar_arrow_clicked.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/scrollbar_arrow_hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/scrollbar_arrow_hot.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/scrollbar_arrow_standard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/scrollbar_arrow_standard.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/Resources/scrollbar_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SychicBoy/NETReactorSlayer/0d0a631124e8871f1e69c68be342db6fa45cf37d/NETReactorSlayer.GUI/Resources/scrollbar_disabled.png
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/UserControls/NRSButton.Designer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.ComponentModel;
17 |
18 | namespace NETReactorSlayer.GUI.UserControls
19 | {
20 | partial class NrsButton
21 | {
22 | ///
23 | /// Required designer variable.
24 | ///
25 | private IContainer components = null;
26 |
27 | ///
28 | /// Clean up any resources being used.
29 | ///
30 | /// true if managed resources should be disposed; otherwise, false.
31 | protected override void Dispose(bool disposing)
32 | {
33 | if (disposing && (components != null))
34 | {
35 | components.Dispose();
36 | }
37 | base.Dispose(disposing);
38 | }
39 |
40 | #region Component Designer generated code
41 |
42 | ///
43 | /// Required method for Designer support - do not modify
44 | /// the contents of this method with the code editor.
45 | ///
46 | private void InitializeComponent()
47 | {
48 | components = new System.ComponentModel.Container();
49 | this.SuspendLayout();
50 | this.Cursor = System.Windows.Forms.Cursors.Hand;
51 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
52 | this.Name = "RoundedButton";
53 | this.Size = new System.Drawing.Size(262, 86);
54 | this.BackColor = System.Drawing.Color.FromArgb(32,32,32);
55 | this.ForeColor = System.Drawing.Color.Silver;
56 | this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
57 | this.FlatAppearance.BorderColor = this.BackColor;
58 | this.FlatAppearance.BorderSize = 0;
59 | this.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(18,18,18);
60 | this.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(34, 34, 34);
61 | this.SizeChanged += new System.EventHandler(this.SizeChange);
62 | this.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
63 | this.ResumeLayout(false);
64 | }
65 |
66 | #endregion
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/UserControls/NRSButton.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System;
17 | using System.Drawing;
18 | using System.Runtime.InteropServices;
19 | using System.Windows.Forms;
20 |
21 | namespace NETReactorSlayer.GUI.UserControls
22 | {
23 | public partial class NrsButton : Button
24 | {
25 | public NrsButton() => InitializeComponent();
26 |
27 | [DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
28 | public static extern IntPtr CreateRoundRectRgn(
29 | int nLeftRect, int nTopRect, int nRightRect, int nBottomRect,
30 | int nWidthEllipse, int nHeightEllipse);
31 |
32 | private void SizeChange(object sender, EventArgs e) =>
33 | Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, _borderRadius, 20));
34 |
35 | private int _borderRadius;
36 | private string _text;
37 | private TextTransformEnum _transform;
38 |
39 | public int BorderRadius
40 | {
41 | get => _borderRadius;
42 | set
43 | {
44 | _borderRadius = value;
45 | Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, _borderRadius, 20));
46 | }
47 | }
48 |
49 | public new string Text
50 | {
51 | get => _text;
52 | set
53 | {
54 | _text = value;
55 | base.Text = TextTransform switch
56 | {
57 | TextTransformEnum.Upper => Text.ToUpper(),
58 | TextTransformEnum.Lower => Text.ToLower(),
59 | _ => Text
60 | };
61 | }
62 | }
63 |
64 | public TextTransformEnum TextTransform
65 | {
66 | get => _transform;
67 | set
68 | {
69 | _transform = value;
70 | base.Text = value switch
71 | {
72 | TextTransformEnum.Upper => Text.ToUpper(),
73 | TextTransformEnum.Lower => Text.ToLower(),
74 | _ => Text
75 | };
76 | }
77 | }
78 |
79 | public enum TextTransformEnum { None, Upper, Lower }
80 | }
81 | }
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/UserControls/NRSTextBox.Designer.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2021 CodeStrikers.org
3 | This file is part of NETReactorSlayer.
4 | NETReactorSlayer is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 3 of the License, or
7 | (at your option) any later version.
8 | NETReactorSlayer is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 | You should have received a copy of the GNU General Public License
13 | along with NETReactorSlayer. If not, see .
14 | */
15 |
16 | using System.ComponentModel;
17 |
18 | namespace NETReactorSlayer.GUI.UserControls
19 | {
20 | sealed partial class NrsTextBox
21 | {
22 | ///
23 | /// Required designer variable.
24 | ///
25 | private IContainer components = null;
26 |
27 | ///
28 | /// Clean up any resources being used.
29 | ///
30 | /// true if managed resources should be disposed; otherwise, false.
31 | protected override void Dispose(bool disposing)
32 | {
33 | if (disposing && (components != null))
34 | {
35 | components.Dispose();
36 | }
37 | base.Dispose(disposing);
38 | }
39 |
40 | #region Component Designer generated code
41 |
42 | ///
43 | /// Required method for Designer support - do not modify
44 | /// the contents of this method with the code editor.
45 | ///
46 | private void InitializeComponent()
47 | {
48 | components = new System.ComponentModel.Container();
49 | this.SuspendLayout();
50 | this.Cursor = System.Windows.Forms.Cursors.IBeam;
51 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32)))));
52 | this.Name = "RoundedButton";
53 | this.Size = new System.Drawing.Size(262, 86);
54 | this.BackColor = System.Drawing.Color.FromArgb(32, 32, 32);
55 | this.ForeColor = System.Drawing.Color.Silver;
56 | this.BorderStyle = System.Windows.Forms.BorderStyle.None;
57 | this.SizeChanged += new System.EventHandler(SizeChange);
58 | this.ResumeLayout(false);
59 | }
60 |
61 | #endregion
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/NETReactorSlayer.GUI/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/NETReactorSlayer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.1.32328.378
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NETReactorSlayer.CLI", "NETReactorSlayer.CLI\NETReactorSlayer.CLI.csproj", "{91F328FB-CEEC-4869-8DAD-0F9A3EEFAB48}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NETReactorSlayer.Core", "NETReactorSlayer.Core\NETReactorSlayer.Core.csproj", "{11E508F0-7AA3-46BD-9891-766DEB293830}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NETReactorSlayer-x64.CLI", "NETReactorSlayer-x64.CLI\NETReactorSlayer-x64.CLI.csproj", "{4363303C-AF4C-4C1B-8284-FC468514C15D}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NETReactorSlayer.GUI", "NETReactorSlayer.GUI\NETReactorSlayer.GUI.csproj", "{CB061DE1-00F8-46FB-9BFC-D05B8D0F59BA}"
13 | EndProject
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NETReactorSlayer.De4dot", "NETReactorSlayer.De4dot\NETReactorSlayer.De4dot.csproj", "{AC8D9E60-5E24-4FE1-8D3C-D100571D5944}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Multi-Platform = Debug|Multi-Platform
19 | Release|Multi-Platform = Release|Multi-Platform
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {91F328FB-CEEC-4869-8DAD-0F9A3EEFAB48}.Debug|Multi-Platform.ActiveCfg = Debug|Any CPU
23 | {91F328FB-CEEC-4869-8DAD-0F9A3EEFAB48}.Debug|Multi-Platform.Build.0 = Debug|Any CPU
24 | {91F328FB-CEEC-4869-8DAD-0F9A3EEFAB48}.Release|Multi-Platform.ActiveCfg = Release|Any CPU
25 | {91F328FB-CEEC-4869-8DAD-0F9A3EEFAB48}.Release|Multi-Platform.Build.0 = Release|Any CPU
26 | {11E508F0-7AA3-46BD-9891-766DEB293830}.Debug|Multi-Platform.ActiveCfg = Debug|Any CPU
27 | {11E508F0-7AA3-46BD-9891-766DEB293830}.Debug|Multi-Platform.Build.0 = Debug|Any CPU
28 | {11E508F0-7AA3-46BD-9891-766DEB293830}.Release|Multi-Platform.ActiveCfg = Release|Any CPU
29 | {11E508F0-7AA3-46BD-9891-766DEB293830}.Release|Multi-Platform.Build.0 = Release|Any CPU
30 | {4363303C-AF4C-4C1B-8284-FC468514C15D}.Debug|Multi-Platform.ActiveCfg = Debug|Any CPU
31 | {4363303C-AF4C-4C1B-8284-FC468514C15D}.Debug|Multi-Platform.Build.0 = Debug|Any CPU
32 | {4363303C-AF4C-4C1B-8284-FC468514C15D}.Release|Multi-Platform.ActiveCfg = Release|Any CPU
33 | {4363303C-AF4C-4C1B-8284-FC468514C15D}.Release|Multi-Platform.Build.0 = Release|Any CPU
34 | {CB061DE1-00F8-46FB-9BFC-D05B8D0F59BA}.Debug|Multi-Platform.ActiveCfg = Debug|Any CPU
35 | {CB061DE1-00F8-46FB-9BFC-D05B8D0F59BA}.Debug|Multi-Platform.Build.0 = Debug|Any CPU
36 | {CB061DE1-00F8-46FB-9BFC-D05B8D0F59BA}.Release|Multi-Platform.ActiveCfg = Release|Any CPU
37 | {CB061DE1-00F8-46FB-9BFC-D05B8D0F59BA}.Release|Multi-Platform.Build.0 = Release|Any CPU
38 | {AC8D9E60-5E24-4FE1-8D3C-D100571D5944}.Debug|Multi-Platform.ActiveCfg = Debug|Any CPU
39 | {AC8D9E60-5E24-4FE1-8D3C-D100571D5944}.Debug|Multi-Platform.Build.0 = Debug|Any CPU
40 | {AC8D9E60-5E24-4FE1-8D3C-D100571D5944}.Release|Multi-Platform.ActiveCfg = Release|Any CPU
41 | {AC8D9E60-5E24-4FE1-8D3C-D100571D5944}.Release|Multi-Platform.Build.0 = Release|Any CPU
42 | EndGlobalSection
43 | GlobalSection(SolutionProperties) = preSolution
44 | HideSolutionNode = FALSE
45 | EndGlobalSection
46 | GlobalSection(ExtensibilityGlobals) = postSolution
47 | SolutionGuid = {D66B7617-0D26-456C-8639-71BB0CCEA94A}
48 | EndGlobalSection
49 | EndGlobal
50 |
--------------------------------------------------------------------------------
/NETReactorSlayerCommon.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net48;netcoreapp3.1;net6.0
6 | net6.0
7 | false
8 | false
9 | false
10 | true
11 | true
12 | latest
13 | en
14 | 6.4.0.0
15 | v6.4.0
16 | Copyright (C) 2021-2022 CodeStrikers.org
17 | A deobfuscator and unpacker for Eziriz .NET Reactor
18 | CodeStrikers.org
19 | embedded
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | # .NETReactorSlayer
7 |
8 | NETReactorSlayer is an open source (GPLv3) deobfuscator and unpacker for [Eziriz .NET Reactor](https://www.eziriz.com/reactor_download.htm).
9 |
10 | Preview
11 |
12 | GUI | CLI
13 | :-------------------------:|:-------------------------:
14 |
|
15 |
16 |
17 |
18 | ### Binaries:
19 | Get the latest stable version from [GitHub releases](https://github.com/SychicBoy/NETReactorSlayer/releases/latest).
20 |
21 | ### Documentation:
22 | Check out the [Wiki](https://github.com/SychicBoy/NETReactorSlayer/wiki) for guides and information on how to use it.
23 |
24 | ### Contribution:
25 | Want to contribute to this project? Feel free to open a [pull request](https://github.com/SychicBoy/NETReactorSlayer/pulls).
26 |
27 | ### Donation:
28 |
29 |
30 | ### License:
31 | NETReactorSlayer is licensed under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).
32 |
33 | ### Credits:
34 | - [dnlib](https://github.com/0xd4d/dnlib)
35 | - [de4dot.blocks](https://github.com/de4dot/de4dot/tree/master/de4dot.blocks)
36 | - [Harmony](https://github.com/pardeike/Harmony)
37 |
--------------------------------------------------------------------------------