├── Unity3DObfuscator.sln
└── Unity3DObfuscator
├── AntiILDasmClass.cs
├── AntiTamperingClass.cs
├── App.config
├── ExcludeStringsForm.Designer.cs
├── ExcludeStringsForm.cs
├── ExcludeStringsForm.resx
├── ExcludeTypesForm.Designer.cs
├── ExcludeTypesForm.cs
├── ExcludeTypesForm.resx
├── Exclusion.cs
├── GlobalStrings.cs
├── HelpForm.Designer.cs
├── HelpForm.cs
├── HelpForm.resx
├── InjectHelper.cs
├── MainClass.cs
├── MainForm.Designer.cs
├── MainForm.cs
├── MainForm.resx
├── ObfuscationSettings.cs
├── ObfuscatorHelp.cs
├── Program.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── RenamingClass.cs
├── StringDecryptionHelper.cs
├── StringEncoding.cs
├── StringEncryptionClass.cs
├── Unity3DObfuscator.csproj
├── Watermarking.cs
├── bin
└── Debug
│ ├── Unity3DObfuscator.exe
│ ├── Unity3DObfuscator.exe.config
│ ├── Unity3DObfuscator.pdb
│ └── dnlib.dll
├── clsNeoBuxTheme.cs
├── dnlib.dll
└── obj
└── Debug
├── CoreCompileInputs.cache
├── DesignTimeResolveAssemblyReferences.cache
├── DesignTimeResolveAssemblyReferencesInput.cache
├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
├── Unity3DObfuscator.ExcludeStringsForm.resources
├── Unity3DObfuscator.ExcludeTypesForm.resources
├── Unity3DObfuscator.HelpForm.resources
├── Unity3DObfuscator.MainForm.resources
├── Unity3DObfuscator.Properties.Resources.resources
├── Unity3DObfuscator.csproj.FileListAbsolute.txt
├── Unity3DObfuscator.csproj.GenerateResource.Cache
├── Unity3DObfuscator.csprojResolveAssemblyReference.cache
├── Unity3DObfuscator.exe
└── Unity3DObfuscator.pdb
/Unity3DObfuscator.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26228.9
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity3DObfuscator", "Unity3DObfuscator\Unity3DObfuscator.csproj", "{65485E2B-FA14-4F59-BDE7-F4F3E7909321}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {65485E2B-FA14-4F59-BDE7-F4F3E7909321}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {65485E2B-FA14-4F59-BDE7-F4F3E7909321}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {65485E2B-FA14-4F59-BDE7-F4F3E7909321}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {65485E2B-FA14-4F59-BDE7-F4F3E7909321}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/AntiILDasmClass.cs:
--------------------------------------------------------------------------------
1 | using dnlib.DotNet;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Unity3DObfuscator
9 | {
10 | public class AntiILDasmClass
11 | {
12 | // AntiILDasm class.
13 | // Credit: The original function is from the ConfuserEx project.
14 | public void Execute()
15 | {
16 | if(!MainClass.Settings.AntiILDasm)
17 | {
18 | return;
19 | }
20 | TypeRef tRef = MainClass.MainModule.CorLibTypes.GetTypeRef("System.Runtime.CompilerServices", "SuppressIldasmAttribute");
21 | MemberRefUser ctor = new MemberRefUser(MainClass.MainModule, ".ctor", MethodSig.CreateInstance(MainClass.MainModule.CorLibTypes.Void), tRef);
22 | CustomAttribute attribute = new CustomAttribute(ctor);
23 | if(MainClass.MainModule.CustomAttributes.Contains(attribute))
24 | {
25 | return;
26 | }
27 | MainClass.MainModule.CustomAttributes.Add(attribute);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/AntiTamperingClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Unity3DObfuscator
8 | {
9 | public class AntiTamperingClass
10 | {
11 | //Anti tampering class.
12 | public void ExecuteAntiTampering()
13 | {
14 | if(!MainClass.Settings.AntiTampering)
15 | {
16 | return;
17 | }
18 | string typeName = "╬.☻♥♦♣♠•◘○";
19 | string value = GlobalStrings.RandomString;
20 | Watermarking.AddCustomAttributeToAssembly(string.Empty, typeName, value);
21 | Watermarking.RemoveAttributeType(typeName);
22 | //The way the anti tampering works is by adding a custom attribute and removing its type directly from the assembly instead of deleting the attribute from the assembly first.
23 | //WARNING! Anti tampering may not work in some assemblies.
24 | //I figured this method by accident, lol!
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/ExcludeStringsForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Unity3DObfuscator
2 | {
3 | partial class ExcludeStringsForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.StringsList = new System.Windows.Forms.ListBox();
32 | this.MainTheme = new FormSkin.clsNeoBuxTheme();
33 | this.label4 = new System.Windows.Forms.Label();
34 | this.label3 = new System.Windows.Forms.Label();
35 | this.SearchExcludedStringsTxt = new System.Windows.Forms.TextBox();
36 | this.label2 = new System.Windows.Forms.Label();
37 | this.ExcludedStringsList = new System.Windows.Forms.ListBox();
38 | this.SearchStringsTxt = new System.Windows.Forms.TextBox();
39 | this.label1 = new System.Windows.Forms.Label();
40 | this.CloseBtn = new FormSkin.clsButtonPurple();
41 | this.RemoveBtn = new FormSkin.clsButtonOrange();
42 | this.AddBtn = new FormSkin.clsButtonGreen();
43 | this.MainTheme.SuspendLayout();
44 | this.SuspendLayout();
45 | //
46 | // StringsList
47 | //
48 | this.StringsList.FormattingEnabled = true;
49 | this.StringsList.ItemHeight = 15;
50 | this.StringsList.Location = new System.Drawing.Point(3, 65);
51 | this.StringsList.Name = "StringsList";
52 | this.StringsList.Size = new System.Drawing.Size(370, 334);
53 | this.StringsList.TabIndex = 5;
54 | //
55 | // MainTheme
56 | //
57 | this.MainTheme.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(239)))), ((int)(((byte)(242)))));
58 | this.MainTheme.BorderStyle = System.Windows.Forms.FormBorderStyle.None;
59 | this.MainTheme.Controls.Add(this.label4);
60 | this.MainTheme.Controls.Add(this.label3);
61 | this.MainTheme.Controls.Add(this.SearchExcludedStringsTxt);
62 | this.MainTheme.Controls.Add(this.label2);
63 | this.MainTheme.Controls.Add(this.ExcludedStringsList);
64 | this.MainTheme.Controls.Add(this.SearchStringsTxt);
65 | this.MainTheme.Controls.Add(this.label1);
66 | this.MainTheme.Controls.Add(this.StringsList);
67 | this.MainTheme.Controls.Add(this.CloseBtn);
68 | this.MainTheme.Controls.Add(this.RemoveBtn);
69 | this.MainTheme.Controls.Add(this.AddBtn);
70 | this.MainTheme.Customization = "AAAA/w==";
71 | this.MainTheme.Dock = System.Windows.Forms.DockStyle.Fill;
72 | this.MainTheme.Font = new System.Drawing.Font("Segoe UI", 9F);
73 | this.MainTheme.Image = null;
74 | this.MainTheme.Location = new System.Drawing.Point(0, 0);
75 | this.MainTheme.Movable = true;
76 | this.MainTheme.Name = "MainTheme";
77 | this.MainTheme.NoRounding = false;
78 | this.MainTheme.Sizable = false;
79 | this.MainTheme.Size = new System.Drawing.Size(754, 478);
80 | this.MainTheme.SmartBounds = true;
81 | this.MainTheme.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
82 | this.MainTheme.TabIndex = 1;
83 | this.MainTheme.Text = "Exclude Strings";
84 | this.MainTheme.TransparencyKey = System.Drawing.Color.Fuchsia;
85 | this.MainTheme.Transparent = false;
86 | //
87 | // label4
88 | //
89 | this.label4.AutoSize = true;
90 | this.label4.Location = new System.Drawing.Point(379, 49);
91 | this.label4.Name = "label4";
92 | this.label4.Size = new System.Drawing.Size(96, 15);
93 | this.label4.TabIndex = 12;
94 | this.label4.Text = "Excluded Strings:";
95 | //
96 | // label3
97 | //
98 | this.label3.AutoSize = true;
99 | this.label3.Location = new System.Drawing.Point(3, 47);
100 | this.label3.Name = "label3";
101 | this.label3.Size = new System.Drawing.Size(46, 15);
102 | this.label3.TabIndex = 11;
103 | this.label3.Text = "Strings:";
104 | //
105 | // SearchExcludedStringsTxt
106 | //
107 | this.SearchExcludedStringsTxt.Location = new System.Drawing.Point(607, 41);
108 | this.SearchExcludedStringsTxt.Name = "SearchExcludedStringsTxt";
109 | this.SearchExcludedStringsTxt.Size = new System.Drawing.Size(144, 23);
110 | this.SearchExcludedStringsTxt.TabIndex = 10;
111 | this.SearchExcludedStringsTxt.TextChanged += new System.EventHandler(this.SearchExcludedStringsTxt_TextChanged);
112 | //
113 | // label2
114 | //
115 | this.label2.AutoSize = true;
116 | this.label2.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
117 | this.label2.Location = new System.Drawing.Point(545, 42);
118 | this.label2.Name = "label2";
119 | this.label2.Size = new System.Drawing.Size(60, 21);
120 | this.label2.TabIndex = 9;
121 | this.label2.Text = "Search:";
122 | //
123 | // ExcludedStringsList
124 | //
125 | this.ExcludedStringsList.FormattingEnabled = true;
126 | this.ExcludedStringsList.ItemHeight = 15;
127 | this.ExcludedStringsList.Location = new System.Drawing.Point(381, 65);
128 | this.ExcludedStringsList.Name = "ExcludedStringsList";
129 | this.ExcludedStringsList.Size = new System.Drawing.Size(370, 334);
130 | this.ExcludedStringsList.TabIndex = 8;
131 | //
132 | // SearchStringsTxt
133 | //
134 | this.SearchStringsTxt.Location = new System.Drawing.Point(229, 41);
135 | this.SearchStringsTxt.Name = "SearchStringsTxt";
136 | this.SearchStringsTxt.Size = new System.Drawing.Size(144, 23);
137 | this.SearchStringsTxt.TabIndex = 7;
138 | this.SearchStringsTxt.TextChanged += new System.EventHandler(this.SearchStringsTxt_TextChanged);
139 | //
140 | // label1
141 | //
142 | this.label1.AutoSize = true;
143 | this.label1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
144 | this.label1.Location = new System.Drawing.Point(167, 42);
145 | this.label1.Name = "label1";
146 | this.label1.Size = new System.Drawing.Size(60, 21);
147 | this.label1.TabIndex = 6;
148 | this.label1.Text = "Search:";
149 | //
150 | // CloseBtn
151 | //
152 | this.CloseBtn.Customization = "9fX1/6mpqf8=";
153 | this.CloseBtn.Font = new System.Drawing.Font("Verdana", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
154 | this.CloseBtn.Image = null;
155 | this.CloseBtn.Location = new System.Drawing.Point(3, 443);
156 | this.CloseBtn.Name = "CloseBtn";
157 | this.CloseBtn.NoRounding = false;
158 | this.CloseBtn.Size = new System.Drawing.Size(747, 31);
159 | this.CloseBtn.TabIndex = 4;
160 | this.CloseBtn.Text = "Close";
161 | this.CloseBtn.Transparent = false;
162 | this.CloseBtn.Click += new System.EventHandler(this.CloseBtn_Click);
163 | //
164 | // RemoveBtn
165 | //
166 | this.RemoveBtn.Customization = "9fX1/6mpqf8=";
167 | this.RemoveBtn.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
168 | this.RemoveBtn.Image = null;
169 | this.RemoveBtn.Location = new System.Drawing.Point(381, 405);
170 | this.RemoveBtn.Name = "RemoveBtn";
171 | this.RemoveBtn.NoRounding = false;
172 | this.RemoveBtn.Size = new System.Drawing.Size(369, 32);
173 | this.RemoveBtn.TabIndex = 2;
174 | this.RemoveBtn.Text = "Remove";
175 | this.RemoveBtn.Transparent = false;
176 | this.RemoveBtn.Click += new System.EventHandler(this.RemoveBtn_Click);
177 | //
178 | // AddBtn
179 | //
180 | this.AddBtn.Customization = "9fX1/6mpqf8=";
181 | this.AddBtn.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
182 | this.AddBtn.Image = null;
183 | this.AddBtn.Location = new System.Drawing.Point(3, 405);
184 | this.AddBtn.Name = "AddBtn";
185 | this.AddBtn.NoRounding = false;
186 | this.AddBtn.Size = new System.Drawing.Size(370, 32);
187 | this.AddBtn.TabIndex = 1;
188 | this.AddBtn.Text = "Add";
189 | this.AddBtn.Transparent = false;
190 | this.AddBtn.Click += new System.EventHandler(this.AddBtn_Click);
191 | //
192 | // ExcludeStringsForm
193 | //
194 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
195 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
196 | this.ClientSize = new System.Drawing.Size(754, 478);
197 | this.Controls.Add(this.MainTheme);
198 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
199 | this.Name = "ExcludeStringsForm";
200 | this.ShowInTaskbar = false;
201 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
202 | this.Text = "Exclude Strings";
203 | this.TransparencyKey = System.Drawing.Color.Fuchsia;
204 | this.MainTheme.ResumeLayout(false);
205 | this.MainTheme.PerformLayout();
206 | this.ResumeLayout(false);
207 |
208 | }
209 |
210 | #endregion
211 |
212 | private System.Windows.Forms.ListBox StringsList;
213 | private FormSkin.clsNeoBuxTheme MainTheme;
214 | private System.Windows.Forms.Label label4;
215 | private System.Windows.Forms.Label label3;
216 | private System.Windows.Forms.TextBox SearchExcludedStringsTxt;
217 | private System.Windows.Forms.Label label2;
218 | private System.Windows.Forms.ListBox ExcludedStringsList;
219 | private System.Windows.Forms.TextBox SearchStringsTxt;
220 | private System.Windows.Forms.Label label1;
221 | private FormSkin.clsButtonPurple CloseBtn;
222 | private FormSkin.clsButtonOrange RemoveBtn;
223 | private FormSkin.clsButtonGreen AddBtn;
224 | }
225 | }
--------------------------------------------------------------------------------
/Unity3DObfuscator/ExcludeStringsForm.cs:
--------------------------------------------------------------------------------
1 | using dnlib.DotNet;
2 | using dnlib.DotNet.Emit;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.ComponentModel;
6 | using System.Data;
7 | using System.Drawing;
8 | using System.Linq;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 | using System.Windows.Forms;
12 |
13 | namespace Unity3DObfuscator
14 | {
15 | public partial class ExcludeStringsForm : Form
16 | {
17 | public ExcludeStringsForm()
18 | {
19 | InitializeComponent();
20 | StringsList.Items.Clear();
21 | ExcludedStringsList.Items.Clear();
22 | try
23 | {
24 | UpdateStrings();
25 | UpdateExludedStrings();
26 | }
27 | catch
28 | {
29 |
30 | }
31 | StringsList.ScrollAlwaysVisible = true; //Sets the vertical scroll bar to be visible.
32 | StringsList.HorizontalScrollbar = true; // Sets the horizontal scroll bar to be visible.
33 | ExcludedStringsList.ScrollAlwaysVisible = true; //...
34 | ExcludedStringsList.HorizontalScrollbar = true; //...
35 | }
36 |
37 | void UpdateStrings() //Updates the strings on the current assembly.
38 | {
39 | if (MainClass.MainModule == null)
40 | {
41 | return;
42 | }
43 | if (!MainClass.MainModule.HasTypes)
44 | {
45 | return;
46 | }
47 | StringsList.Sorted = true;
48 | foreach (TypeDef type in MainClass.MainModule.GetTypes())
49 | {
50 | foreach (MethodDef method in type.Methods)
51 | {
52 | if (!method.HasBody) continue;
53 | var instr = method.Body.Instructions;
54 | for (int i = 0; i < instr.Count; i++)
55 | {
56 | if (instr[i].OpCode == OpCodes.Ldstr)
57 | {
58 | var originalStr = instr[i].Operand as string;
59 | if (Exclusion.ExcludedStrings.Contains(originalStr) || Exclusion.ExcludedStrings.Contains(originalStr))
60 | {
61 | StringsList.Items.Remove(originalStr);
62 | }
63 | if (!Exclusion.ExcludedStrings.Contains(originalStr))
64 | {
65 | if (!StringsList.Items.Contains(originalStr))
66 | {
67 | if (!Exclusion.Strings.Contains(originalStr))
68 | {
69 | Exclusion.Strings.Add(originalStr);
70 | }
71 | }
72 | }
73 | }
74 | }
75 | }
76 | }
77 | foreach (string str in Exclusion.Strings)
78 | {
79 | if (!StringsList.Items.Contains(str))
80 | {
81 | StringsList.Items.Add(str);
82 | }
83 | }
84 | }
85 | void ShowSearchedMatchStrings() //Shows only the strings that the user searches for.
86 | {
87 | foreach (TypeDef type in MainClass.MainModule.GetTypes())
88 | {
89 | foreach (MethodDef method in type.Methods)
90 | {
91 | if (!method.HasBody) continue;
92 | var instr = method.Body.Instructions;
93 | for (int i = 0; i < instr.Count - 3; i++)
94 | {
95 | if (instr[i].OpCode == OpCodes.Ldstr)
96 | {
97 | var originalStr = instr[i].Operand as string;
98 | if (Exclusion.ExcludedStrings.Contains(originalStr))
99 | {
100 | StringsList.Items.Remove(originalStr);
101 | }
102 | if (!StringsList.Items.Contains(originalStr))
103 | {
104 | if (!Exclusion.ExcludedStrings.Contains(originalStr))
105 | {
106 | if (originalStr.ToLower().Contains(SearchStringsTxt.Text.ToLower()) || originalStr.ToLower().Contains(SearchStringsTxt.Text.ToLower()))
107 | {
108 | StringsList.Items.Add(originalStr);
109 | }
110 | }
111 | }
112 | }
113 | }
114 | }
115 | }
116 | }
117 | void UpdateExludedStrings() //Updates the excluded strings that are currently on the exclusion list.
118 | {
119 | if (MainClass.MainModule == null)
120 | {
121 | return;
122 | }
123 | if (Exclusion.ExcludedStrings.Count <= 0)
124 | {
125 | return;
126 | }
127 | ExcludedStringsList.Sorted = true;
128 | foreach (string str in Exclusion.ExcludedStrings)
129 | {
130 | if (!ExcludedStringsList.Items.Contains(str))
131 | {
132 | if (Exclusion.ExcludedStrings.Contains(str))
133 | {
134 | ExcludedStringsList.Items.Add(str);
135 | }
136 | else
137 | {
138 | ExcludedStringsList.Items.Remove(str);
139 | }
140 | }
141 | }
142 | }
143 | void ShowSearchedMatchExcludedStings() ////Shows only the excluded strings that the user searches for.
144 | {
145 | foreach (string type in Exclusion.ExcludedStrings)
146 | {
147 | if (!ExcludedStringsList.Items.Contains(type))
148 | {
149 | if (type.ToLower().Contains(SearchExcludedStringsTxt.Text.ToLower()))
150 | {
151 | ExcludedStringsList.Items.Add(type);
152 | }
153 | }
154 | }
155 | }
156 | private void CloseBtn_Click(object sender, EventArgs e) //Closes the form.
157 | {
158 | Close();
159 | }
160 |
161 | private void AddBtn_Click(object sender, EventArgs e) //Adds the selected type to the exclusion list.
162 | {
163 | if (StringsList.SelectedIndex < 0)
164 | {
165 | return;
166 | }
167 | string item = StringsList.SelectedItem.ToString();
168 | if (!Exclusion.ExcludedStrings.Contains(item))
169 | {
170 | Exclusion.ExcludedStrings.Add(item);
171 |
172 | }
173 | if (!ExcludedStringsList.Items.Contains(item))
174 | {
175 | ExcludedStringsList.Items.Add(item);
176 | }
177 | if (ExcludedStringsList.Items.Contains(item))
178 | {
179 | Exclusion.Strings.Remove(item);
180 | UpdateStrings();
181 | StringsList.Items.Remove(item);
182 | }
183 | }
184 |
185 | private void SearchStringsTxt_TextChanged(object sender, EventArgs e) //The function when the 'search string' text box changes text.
186 | {
187 | if (SearchStringsTxt.Text == string.Empty)
188 | {
189 | StringsList.Items.Clear();
190 | try
191 | {
192 | UpdateStrings();
193 | }
194 | catch
195 | {
196 | }
197 | }
198 | else
199 | {
200 | StringsList.Items.Clear();
201 | try
202 | {
203 | ShowSearchedMatchStrings();
204 | }
205 | catch
206 | {
207 | }
208 | }
209 | }
210 |
211 | private void RemoveBtn_Click(object sender, EventArgs e) //Removes the selected type from the exclusion list.
212 | {
213 | if (ExcludedStringsList.SelectedIndex < 0)
214 | {
215 | return;
216 | }
217 | string item = ExcludedStringsList.SelectedItem.ToString();
218 | if (Exclusion.ExcludedStrings.Contains(item))
219 | {
220 | Exclusion.ExcludedStrings.Remove(item);
221 | }
222 | StringsList.Items.Add(item);
223 | if (ExcludedStringsList.Items.Contains(item))
224 | {
225 | ExcludedStringsList.Items.Remove(item);
226 | }
227 | Exclusion.Strings.Add(item);
228 | StringsList.Items.Clear();
229 | UpdateStrings();
230 | }
231 |
232 | private void SearchExcludedStringsTxt_TextChanged(object sender, EventArgs e) //The function when the 'search excluded string' text box changes text.
233 | {
234 | if (SearchExcludedStringsTxt.Text == string.Empty)
235 | {
236 | ExcludedStringsList.Items.Clear();
237 | try
238 | {
239 | UpdateExludedStrings();
240 | }
241 | catch { }
242 | }
243 | else
244 | {
245 | ExcludedStringsList.Items.Clear();
246 | try
247 | {
248 | ShowSearchedMatchExcludedStings();
249 | }
250 | catch { }
251 | }
252 | }
253 | }
254 | }
255 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/ExcludeStringsForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/ExcludeTypesForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Unity3DObfuscator
2 | {
3 | partial class ExcludeTypesForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.MainTheme = new FormSkin.clsNeoBuxTheme();
32 | this.label4 = new System.Windows.Forms.Label();
33 | this.label3 = new System.Windows.Forms.Label();
34 | this.SearchExcludedTypes = new System.Windows.Forms.TextBox();
35 | this.label2 = new System.Windows.Forms.Label();
36 | this.ExcludedTypesList = new System.Windows.Forms.ListBox();
37 | this.SearchTypesTxt = new System.Windows.Forms.TextBox();
38 | this.label1 = new System.Windows.Forms.Label();
39 | this.TypesList = new System.Windows.Forms.ListBox();
40 | this.CloseBtn = new FormSkin.clsButtonPurple();
41 | this.RemoveBtn = new FormSkin.clsButtonOrange();
42 | this.AddBtn = new FormSkin.clsButtonGreen();
43 | this.MainTheme.SuspendLayout();
44 | this.SuspendLayout();
45 | //
46 | // MainTheme
47 | //
48 | this.MainTheme.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(239)))), ((int)(((byte)(242)))));
49 | this.MainTheme.BorderStyle = System.Windows.Forms.FormBorderStyle.None;
50 | this.MainTheme.Controls.Add(this.label4);
51 | this.MainTheme.Controls.Add(this.label3);
52 | this.MainTheme.Controls.Add(this.SearchExcludedTypes);
53 | this.MainTheme.Controls.Add(this.label2);
54 | this.MainTheme.Controls.Add(this.ExcludedTypesList);
55 | this.MainTheme.Controls.Add(this.SearchTypesTxt);
56 | this.MainTheme.Controls.Add(this.label1);
57 | this.MainTheme.Controls.Add(this.TypesList);
58 | this.MainTheme.Controls.Add(this.CloseBtn);
59 | this.MainTheme.Controls.Add(this.RemoveBtn);
60 | this.MainTheme.Controls.Add(this.AddBtn);
61 | this.MainTheme.Customization = "AAAA/w==";
62 | this.MainTheme.Dock = System.Windows.Forms.DockStyle.Fill;
63 | this.MainTheme.Font = new System.Drawing.Font("Segoe UI", 9F);
64 | this.MainTheme.Image = null;
65 | this.MainTheme.Location = new System.Drawing.Point(0, 0);
66 | this.MainTheme.Movable = true;
67 | this.MainTheme.Name = "MainTheme";
68 | this.MainTheme.NoRounding = false;
69 | this.MainTheme.Sizable = false;
70 | this.MainTheme.Size = new System.Drawing.Size(755, 478);
71 | this.MainTheme.SmartBounds = true;
72 | this.MainTheme.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
73 | this.MainTheme.TabIndex = 0;
74 | this.MainTheme.Text = "Exlude Types";
75 | this.MainTheme.TransparencyKey = System.Drawing.Color.Fuchsia;
76 | this.MainTheme.Transparent = false;
77 | //
78 | // label4
79 | //
80 | this.label4.AutoSize = true;
81 | this.label4.Location = new System.Drawing.Point(379, 49);
82 | this.label4.Name = "label4";
83 | this.label4.Size = new System.Drawing.Size(90, 15);
84 | this.label4.TabIndex = 12;
85 | this.label4.Text = "Excluded Types:";
86 | //
87 | // label3
88 | //
89 | this.label3.AutoSize = true;
90 | this.label3.Location = new System.Drawing.Point(3, 47);
91 | this.label3.Name = "label3";
92 | this.label3.Size = new System.Drawing.Size(40, 15);
93 | this.label3.TabIndex = 11;
94 | this.label3.Text = "Types:";
95 | //
96 | // SearchExcludedTypes
97 | //
98 | this.SearchExcludedTypes.Location = new System.Drawing.Point(607, 41);
99 | this.SearchExcludedTypes.Name = "SearchExcludedTypes";
100 | this.SearchExcludedTypes.Size = new System.Drawing.Size(144, 23);
101 | this.SearchExcludedTypes.TabIndex = 10;
102 | this.SearchExcludedTypes.TextChanged += new System.EventHandler(this.SearchExcludedTypes_TextChanged);
103 | //
104 | // label2
105 | //
106 | this.label2.AutoSize = true;
107 | this.label2.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
108 | this.label2.Location = new System.Drawing.Point(545, 42);
109 | this.label2.Name = "label2";
110 | this.label2.Size = new System.Drawing.Size(60, 21);
111 | this.label2.TabIndex = 9;
112 | this.label2.Text = "Search:";
113 | //
114 | // ExcludedTypesList
115 | //
116 | this.ExcludedTypesList.FormattingEnabled = true;
117 | this.ExcludedTypesList.ItemHeight = 15;
118 | this.ExcludedTypesList.Location = new System.Drawing.Point(381, 65);
119 | this.ExcludedTypesList.Name = "ExcludedTypesList";
120 | this.ExcludedTypesList.Size = new System.Drawing.Size(370, 334);
121 | this.ExcludedTypesList.TabIndex = 8;
122 | //
123 | // SearchTypesTxt
124 | //
125 | this.SearchTypesTxt.Location = new System.Drawing.Point(229, 41);
126 | this.SearchTypesTxt.Name = "SearchTypesTxt";
127 | this.SearchTypesTxt.Size = new System.Drawing.Size(144, 23);
128 | this.SearchTypesTxt.TabIndex = 7;
129 | this.SearchTypesTxt.TextChanged += new System.EventHandler(this.SearchTypesTxt_TextChanged);
130 | //
131 | // label1
132 | //
133 | this.label1.AutoSize = true;
134 | this.label1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
135 | this.label1.Location = new System.Drawing.Point(167, 42);
136 | this.label1.Name = "label1";
137 | this.label1.Size = new System.Drawing.Size(60, 21);
138 | this.label1.TabIndex = 6;
139 | this.label1.Text = "Search:";
140 | //
141 | // TypesList
142 | //
143 | this.TypesList.FormattingEnabled = true;
144 | this.TypesList.ItemHeight = 15;
145 | this.TypesList.Location = new System.Drawing.Point(3, 65);
146 | this.TypesList.Name = "TypesList";
147 | this.TypesList.Size = new System.Drawing.Size(370, 334);
148 | this.TypesList.TabIndex = 5;
149 | this.TypesList.SelectedIndexChanged += new System.EventHandler(this.TypesList_SelectedIndexChanged);
150 | //
151 | // CloseBtn
152 | //
153 | this.CloseBtn.Customization = "9fX1/6mpqf8=";
154 | this.CloseBtn.Font = new System.Drawing.Font("Verdana", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
155 | this.CloseBtn.Image = null;
156 | this.CloseBtn.Location = new System.Drawing.Point(3, 443);
157 | this.CloseBtn.Name = "CloseBtn";
158 | this.CloseBtn.NoRounding = false;
159 | this.CloseBtn.Size = new System.Drawing.Size(747, 31);
160 | this.CloseBtn.TabIndex = 4;
161 | this.CloseBtn.Text = "Close";
162 | this.CloseBtn.Transparent = false;
163 | this.CloseBtn.Click += new System.EventHandler(this.CloseBtn_Click);
164 | //
165 | // RemoveBtn
166 | //
167 | this.RemoveBtn.Customization = "9fX1/6mpqf8=";
168 | this.RemoveBtn.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
169 | this.RemoveBtn.Image = null;
170 | this.RemoveBtn.Location = new System.Drawing.Point(381, 405);
171 | this.RemoveBtn.Name = "RemoveBtn";
172 | this.RemoveBtn.NoRounding = false;
173 | this.RemoveBtn.Size = new System.Drawing.Size(369, 32);
174 | this.RemoveBtn.TabIndex = 2;
175 | this.RemoveBtn.Text = "Remove";
176 | this.RemoveBtn.Transparent = false;
177 | this.RemoveBtn.Click += new System.EventHandler(this.RemoveBtn_Click);
178 | //
179 | // AddBtn
180 | //
181 | this.AddBtn.Customization = "9fX1/6mpqf8=";
182 | this.AddBtn.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
183 | this.AddBtn.Image = null;
184 | this.AddBtn.Location = new System.Drawing.Point(3, 405);
185 | this.AddBtn.Name = "AddBtn";
186 | this.AddBtn.NoRounding = false;
187 | this.AddBtn.Size = new System.Drawing.Size(370, 32);
188 | this.AddBtn.TabIndex = 1;
189 | this.AddBtn.Text = "Add";
190 | this.AddBtn.Transparent = false;
191 | this.AddBtn.Click += new System.EventHandler(this.AddBtn_Click);
192 | //
193 | // ExcludeTypesForm
194 | //
195 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
196 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
197 | this.ClientSize = new System.Drawing.Size(755, 478);
198 | this.Controls.Add(this.MainTheme);
199 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
200 | this.Name = "ExcludeTypesForm";
201 | this.ShowIcon = false;
202 | this.ShowInTaskbar = false;
203 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
204 | this.Text = "Exclude Types";
205 | this.TransparencyKey = System.Drawing.Color.Fuchsia;
206 | this.MainTheme.ResumeLayout(false);
207 | this.MainTheme.PerformLayout();
208 | this.ResumeLayout(false);
209 |
210 | }
211 |
212 | #endregion
213 |
214 | private FormSkin.clsNeoBuxTheme MainTheme;
215 | private FormSkin.clsButtonPurple CloseBtn;
216 | private FormSkin.clsButtonOrange RemoveBtn;
217 | private FormSkin.clsButtonGreen AddBtn;
218 | private System.Windows.Forms.ListBox TypesList;
219 | private System.Windows.Forms.TextBox SearchTypesTxt;
220 | private System.Windows.Forms.Label label1;
221 | private System.Windows.Forms.TextBox SearchExcludedTypes;
222 | private System.Windows.Forms.Label label2;
223 | private System.Windows.Forms.ListBox ExcludedTypesList;
224 | private System.Windows.Forms.Label label4;
225 | private System.Windows.Forms.Label label3;
226 | }
227 | }
--------------------------------------------------------------------------------
/Unity3DObfuscator/ExcludeTypesForm.cs:
--------------------------------------------------------------------------------
1 | using dnlib.DotNet;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 |
12 | namespace Unity3DObfuscator
13 | {
14 | public partial class ExcludeTypesForm : Form
15 | {
16 | public ExcludeTypesForm()
17 | {
18 | InitializeComponent();
19 | TypesList.Items.Clear();
20 | ExcludedTypesList.Items.Clear();
21 | try
22 | {
23 | UpdateTypes();
24 | UpdateExcludedTypes();
25 | }
26 | catch
27 | {
28 |
29 | }
30 | TypesList.ScrollAlwaysVisible = true; //Sets the vertical scroll bar to be visible.
31 | ExcludedTypesList.ScrollAlwaysVisible = true; //...
32 | TypesList.HorizontalScrollbar = true; // Sets the horizontal scroll bar to be visible.
33 | ExcludedTypesList.HorizontalScrollbar = true; //...
34 | }
35 | void UpdateTypes() //Updates the types on the current assembly.
36 | {
37 | if (MainClass.MainModule == null)
38 | {
39 | return;
40 | }
41 | if (!MainClass.MainModule.HasTypes)
42 | {
43 | return;
44 | }
45 | TypesList.Sorted = true;
46 | foreach (TypeDef type in MainClass.MainModule.Types)
47 | {
48 | if (Exclusion.ExludedTypes.Contains(type.FullName))
49 | {
50 | TypesList.Items.Remove(type.FullName);
51 | }
52 | if (!Exclusion.ExludedTypes.Contains(type.FullName))
53 | {
54 | if (!TypesList.Items.Contains(type.FullName))
55 | {
56 | if (!type.Name.StartsWith("<") && !type.Name.EndsWith(">"))
57 | {
58 | if (!Exclusion.Types.Contains(type.FullName))
59 | {
60 | Exclusion.Types.Add(type.FullName);
61 | }
62 | }
63 | }
64 | }
65 | }
66 | foreach (string type in Exclusion.Types)
67 | {
68 | if (!TypesList.Items.Contains(type))
69 | {
70 | TypesList.Items.Add(type);
71 | }
72 | }
73 | }
74 | void ShowSearchedMatchTypes() //Shows only the types that the user searches for.
75 | {
76 | foreach (TypeDef type in MainClass.MainModule.Types)
77 | {
78 | if (Exclusion.ExludedTypes.Contains(type.FullName))
79 | {
80 | TypesList.Items.Remove(type.FullName);
81 | }
82 | if (!TypesList.Items.Contains(type.FullName))
83 | {
84 | if (!Exclusion.ExludedTypes.Contains(type.FullName))
85 | {
86 | if (!type.Name.StartsWith("<") && !type.Name.EndsWith(">"))
87 | {
88 | if (type.Name.ToLower().Contains(SearchTypesTxt.Text.ToLower()) || type.FullName.ToLower().Contains(SearchTypesTxt.Text.ToLower()))
89 | {
90 | TypesList.Items.Add(type.FullName);
91 | }
92 | }
93 | }
94 | }
95 | }
96 | }
97 | void UpdateExcludedTypes() //Updates the excluded types that are currently on the exclusion list.
98 | {
99 | if (MainClass.MainModule == null)
100 | {
101 | return;
102 | }
103 | if (Exclusion.ExludedTypes.Count <= 0)
104 | {
105 | return;
106 | }
107 | ExcludedTypesList.Sorted = true;
108 | foreach (string type in Exclusion.ExludedTypes)
109 | {
110 | if (!ExcludedTypesList.Items.Contains(type))
111 | {
112 | if (Exclusion.ExludedTypes.Contains(type))
113 | {
114 | ExcludedTypesList.Items.Add(type);
115 | }
116 | else
117 | {
118 | ExcludedTypesList.Items.Remove(type);
119 | }
120 | }
121 | }
122 | }
123 | void ShowSearchedMatchExcludedTypes() //Shows only the excluded types that the user searches for.
124 | {
125 | foreach (string type in Exclusion.ExludedTypes)
126 | {
127 | if (!ExcludedTypesList.Items.Contains(type))
128 | {
129 | if (type.ToLower().Contains(SearchExcludedTypes.Text.ToLower()))
130 | {
131 | ExcludedTypesList.Items.Add(type);
132 | }
133 | }
134 | }
135 | }
136 | private void SearchTypesTxt_TextChanged(object sender, EventArgs e) //The function when the 'search type' text box changes text.
137 | {
138 | if (SearchTypesTxt.Text == string.Empty)
139 | {
140 | TypesList.Items.Clear();
141 | try
142 | {
143 | UpdateTypes();
144 | }
145 | catch
146 | {
147 | }
148 | }
149 | else
150 | {
151 | TypesList.Items.Clear();
152 | try
153 | {
154 | ShowSearchedMatchTypes();
155 | }
156 | catch
157 | {
158 | }
159 | }
160 | }
161 | private void SearchExcludedTypes_TextChanged(object sender, EventArgs e) //The function when the 'search excluded type' text box changes text.
162 | {
163 | if (SearchExcludedTypes.Text == string.Empty)
164 | {
165 | ExcludedTypesList.Items.Clear();
166 | try
167 | {
168 | UpdateExcludedTypes();
169 | }
170 | catch
171 | {
172 | }
173 | }
174 | else
175 | {
176 | ExcludedTypesList.Items.Clear();
177 | try
178 | {
179 | ShowSearchedMatchExcludedTypes();
180 | }
181 | catch
182 | {
183 | }
184 | }
185 | }
186 | private void TypesList_SelectedIndexChanged(object sender, EventArgs e) //Ignore this.
187 | {
188 |
189 | }
190 | private void AddBtn_Click(object sender, EventArgs e) //Adds the selected type to the exclusion list.
191 | {
192 | if (TypesList.SelectedIndex < 0)
193 | {
194 | return;
195 | }
196 | string item = TypesList.SelectedItem.ToString();
197 | if (!Exclusion.ExludedTypes.Contains(item))
198 | {
199 | Exclusion.ExludedTypes.Add(item);
200 |
201 | }
202 | if (!ExcludedTypesList.Items.Contains(item))
203 | {
204 | ExcludedTypesList.Items.Add(item);
205 | }
206 | if (ExcludedTypesList.Items.Contains(item))
207 | {
208 | Exclusion.Types.Remove(item);
209 | UpdateTypes();
210 | TypesList.Items.Remove(item);
211 | }
212 | }
213 |
214 | private void RemoveBtn_Click(object sender, EventArgs e) //Removes the selected type from the exclusion list.
215 | {
216 | if (ExcludedTypesList.SelectedIndex < 0)
217 | {
218 | return;
219 | }
220 | string item = ExcludedTypesList.SelectedItem.ToString();
221 | if (Exclusion.ExludedTypes.Contains(item))
222 | {
223 | Exclusion.ExludedTypes.Remove(item);
224 | }
225 | TypesList.Items.Add(item);
226 | if (ExcludedTypesList.Items.Contains(item))
227 | {
228 | ExcludedTypesList.Items.Remove(item);
229 | }
230 | Exclusion.Types.Add(item);
231 | TypesList.Items.Clear();
232 | UpdateTypes();
233 | }
234 |
235 | private void CloseBtn_Click(object sender, EventArgs e) //Closes the form.
236 | {
237 | Close();
238 | }
239 | }
240 | }
241 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/ExcludeTypesForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/Exclusion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Unity3DObfuscator
8 | {
9 | public class Exclusion
10 | {
11 | //Execution Order of Event Functions in Unity. Feel free to add functions that you think they are missing.
12 | private static readonly List unityFunctions = new List(new string[] { "Awake", "OnEnable", "OnDisable", "OnLevelWasLoaded", "OnApplicationPause", "Start", "Update", "FixedUpdate", "LateUpdate", "OnPreCull", "OnBecameVisible", "OnBecameInvisible", "OnWillRenderObject", "OnPreRender", "OnRenderObject", "OnPostRender", "OnRenderImage", "OnGUI", "OnDrawGizmos", "OnDestroy", "OnApplicationQuit", "OnTriggerEnter", "OnTriggerExit", "OnCollisionEnter", "OnCollisionExit", "OnMouseClick", "OnMouseDown", "OnMouseUp" });
13 |
14 | private static readonly List types = new List(new string[0]);
15 |
16 | //Excluded types.
17 | private static readonly List exludedTypes = new List(new string[0]);
18 |
19 | //Excluded strings.
20 | private static readonly List excludedStrings = new List(new string[0]);
21 |
22 | //List of strings in the assembly
23 | private static readonly List strings = new List(new string[0]);
24 |
25 | //The properties are just return functions of every list.
26 | public static List UnityFunctions => unityFunctions;
27 |
28 | public static List Types => types;
29 |
30 | public static List ExludedTypes => exludedTypes;
31 |
32 | public static List ExcludedStrings => excludedStrings;
33 |
34 | public static List Strings => strings;
35 | }
36 | }
--------------------------------------------------------------------------------
/Unity3DObfuscator/GlobalStrings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Unity3DObfuscator
8 | {
9 | //The strings for the renaming function.
10 | public struct GlobalStrings
11 | {
12 | private static Random random = new Random();
13 |
14 | public static string RenamingString => GetRenamingString();
15 | public static string RandomString => GetRandomString();
16 | private static string GetRandomString() //Generates a radmom string.
17 | {
18 | var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
19 | var stringChars = new char[19];
20 | for (int i = 0; i < stringChars.Length; i++)
21 | {
22 | stringChars[i] = chars[random.Next(chars.Length)];
23 | }
24 | var finalString = new String(stringChars);
25 | return string.Concat("=", finalString);
26 | }
27 | private static string GetEmpty() //Returns an empty string.
28 | {
29 | return string.Empty;
30 | }
31 | private static string GetRenamingString() //Gets the renaming type of the 'Renaming Obfuscation'. Radmm name or empty.
32 | {
33 | if (MainClass.Settings.RandomName && !MainClass.Settings.EmptyName)
34 | {
35 | return GetRandomString();
36 | }
37 | if (MainClass.Settings.EmptyName && !MainClass.Settings.RandomName)
38 | {
39 | return GetEmpty();
40 | }
41 | return "xxx";
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/HelpForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Unity3DObfuscator
2 | {
3 | partial class HelpForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.MainTheme = new FormSkin.clsNeoBuxTheme();
32 | this.HelpTabControl = new System.Windows.Forms.TabControl();
33 | this.RenamingPage = new System.Windows.Forms.TabPage();
34 | this.StringEncryptionPage = new System.Windows.Forms.TabPage();
35 | this.AntiTamperingPage = new System.Windows.Forms.TabPage();
36 | this.textBox1 = new System.Windows.Forms.TextBox();
37 | this.StringEncryptionTxt = new System.Windows.Forms.TextBox();
38 | this.AntiTamperingTxt = new System.Windows.Forms.TextBox();
39 | this.RenamingTxt = new System.Windows.Forms.TextBox();
40 | this.CloseBtn = new FormSkin.clsButtonBlue();
41 | this.MainTheme.SuspendLayout();
42 | this.HelpTabControl.SuspendLayout();
43 | this.RenamingPage.SuspendLayout();
44 | this.StringEncryptionPage.SuspendLayout();
45 | this.AntiTamperingPage.SuspendLayout();
46 | this.SuspendLayout();
47 | //
48 | // MainTheme
49 | //
50 | this.MainTheme.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(239)))), ((int)(((byte)(242)))));
51 | this.MainTheme.BorderStyle = System.Windows.Forms.FormBorderStyle.None;
52 | this.MainTheme.Controls.Add(this.CloseBtn);
53 | this.MainTheme.Controls.Add(this.HelpTabControl);
54 | this.MainTheme.Customization = "AAAA/w==";
55 | this.MainTheme.Dock = System.Windows.Forms.DockStyle.Fill;
56 | this.MainTheme.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
57 | this.MainTheme.Image = null;
58 | this.MainTheme.Location = new System.Drawing.Point(0, 0);
59 | this.MainTheme.Movable = false;
60 | this.MainTheme.Name = "MainTheme";
61 | this.MainTheme.NoRounding = false;
62 | this.MainTheme.Sizable = false;
63 | this.MainTheme.Size = new System.Drawing.Size(346, 518);
64 | this.MainTheme.SmartBounds = true;
65 | this.MainTheme.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultLocation;
66 | this.MainTheme.TabIndex = 0;
67 | this.MainTheme.Text = "Help";
68 | this.MainTheme.TransparencyKey = System.Drawing.Color.Fuchsia;
69 | this.MainTheme.Transparent = false;
70 | //
71 | // HelpTabControl
72 | //
73 | this.HelpTabControl.Controls.Add(this.RenamingPage);
74 | this.HelpTabControl.Controls.Add(this.StringEncryptionPage);
75 | this.HelpTabControl.Controls.Add(this.AntiTamperingPage);
76 | this.HelpTabControl.Location = new System.Drawing.Point(3, 40);
77 | this.HelpTabControl.Name = "HelpTabControl";
78 | this.HelpTabControl.SelectedIndex = 0;
79 | this.HelpTabControl.Size = new System.Drawing.Size(341, 431);
80 | this.HelpTabControl.TabIndex = 0;
81 | //
82 | // RenamingPage
83 | //
84 | this.RenamingPage.Controls.Add(this.RenamingTxt);
85 | this.RenamingPage.ForeColor = System.Drawing.Color.Blue;
86 | this.RenamingPage.Location = new System.Drawing.Point(4, 30);
87 | this.RenamingPage.Name = "RenamingPage";
88 | this.RenamingPage.Padding = new System.Windows.Forms.Padding(3);
89 | this.RenamingPage.Size = new System.Drawing.Size(333, 397);
90 | this.RenamingPage.TabIndex = 0;
91 | this.RenamingPage.Text = "Renaming";
92 | this.RenamingPage.UseVisualStyleBackColor = true;
93 | //
94 | // StringEncryptionPage
95 | //
96 | this.StringEncryptionPage.Controls.Add(this.StringEncryptionTxt);
97 | this.StringEncryptionPage.Controls.Add(this.textBox1);
98 | this.StringEncryptionPage.ForeColor = System.Drawing.Color.Blue;
99 | this.StringEncryptionPage.Location = new System.Drawing.Point(4, 30);
100 | this.StringEncryptionPage.Name = "StringEncryptionPage";
101 | this.StringEncryptionPage.Padding = new System.Windows.Forms.Padding(3);
102 | this.StringEncryptionPage.Size = new System.Drawing.Size(333, 397);
103 | this.StringEncryptionPage.TabIndex = 1;
104 | this.StringEncryptionPage.Text = "String Encryption";
105 | this.StringEncryptionPage.UseVisualStyleBackColor = true;
106 | //
107 | // AntiTamperingPage
108 | //
109 | this.AntiTamperingPage.Controls.Add(this.AntiTamperingTxt);
110 | this.AntiTamperingPage.ForeColor = System.Drawing.Color.Blue;
111 | this.AntiTamperingPage.Location = new System.Drawing.Point(4, 30);
112 | this.AntiTamperingPage.Name = "AntiTamperingPage";
113 | this.AntiTamperingPage.Size = new System.Drawing.Size(333, 397);
114 | this.AntiTamperingPage.TabIndex = 2;
115 | this.AntiTamperingPage.Text = "Anti Tampering";
116 | this.AntiTamperingPage.UseVisualStyleBackColor = true;
117 | //
118 | // textBox1
119 | //
120 | this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
121 | this.textBox1.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
122 | this.textBox1.ForeColor = System.Drawing.Color.Blue;
123 | this.textBox1.Location = new System.Drawing.Point(-6, -2);
124 | this.textBox1.Multiline = true;
125 | this.textBox1.Name = "textBox1";
126 | this.textBox1.Size = new System.Drawing.Size(344, 368);
127 | this.textBox1.TabIndex = 1;
128 | //
129 | // StringEncryptionTxt
130 | //
131 | this.StringEncryptionTxt.BorderStyle = System.Windows.Forms.BorderStyle.None;
132 | this.StringEncryptionTxt.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
133 | this.StringEncryptionTxt.ForeColor = System.Drawing.Color.Blue;
134 | this.StringEncryptionTxt.Location = new System.Drawing.Point(-4, 0);
135 | this.StringEncryptionTxt.Multiline = true;
136 | this.StringEncryptionTxt.Name = "StringEncryptionTxt";
137 | this.StringEncryptionTxt.ReadOnly = true;
138 | this.StringEncryptionTxt.Size = new System.Drawing.Size(344, 401);
139 | this.StringEncryptionTxt.TabIndex = 2;
140 | //
141 | // AntiTamperingTxt
142 | //
143 | this.AntiTamperingTxt.BorderStyle = System.Windows.Forms.BorderStyle.None;
144 | this.AntiTamperingTxt.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
145 | this.AntiTamperingTxt.ForeColor = System.Drawing.Color.Blue;
146 | this.AntiTamperingTxt.Location = new System.Drawing.Point(-6, -2);
147 | this.AntiTamperingTxt.Multiline = true;
148 | this.AntiTamperingTxt.Name = "AntiTamperingTxt";
149 | this.AntiTamperingTxt.ReadOnly = true;
150 | this.AntiTamperingTxt.Size = new System.Drawing.Size(344, 403);
151 | this.AntiTamperingTxt.TabIndex = 1;
152 | //
153 | // RenamingTxt
154 | //
155 | this.RenamingTxt.BorderStyle = System.Windows.Forms.BorderStyle.None;
156 | this.RenamingTxt.Font = new System.Drawing.Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
157 | this.RenamingTxt.ForeColor = System.Drawing.Color.Blue;
158 | this.RenamingTxt.ImeMode = System.Windows.Forms.ImeMode.NoControl;
159 | this.RenamingTxt.Location = new System.Drawing.Point(-7, 0);
160 | this.RenamingTxt.Multiline = true;
161 | this.RenamingTxt.Name = "RenamingTxt";
162 | this.RenamingTxt.ReadOnly = true;
163 | this.RenamingTxt.Size = new System.Drawing.Size(344, 401);
164 | this.RenamingTxt.TabIndex = 0;
165 | //
166 | // CloseBtn
167 | //
168 | this.CloseBtn.Customization = "9fX1/6mpqf8=";
169 | this.CloseBtn.Font = new System.Drawing.Font("Verdana", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
170 | this.CloseBtn.Image = null;
171 | this.CloseBtn.Location = new System.Drawing.Point(4, 473);
172 | this.CloseBtn.Name = "CloseBtn";
173 | this.CloseBtn.NoRounding = false;
174 | this.CloseBtn.Size = new System.Drawing.Size(337, 42);
175 | this.CloseBtn.TabIndex = 1;
176 | this.CloseBtn.Text = "Close";
177 | this.CloseBtn.Transparent = false;
178 | this.CloseBtn.Click += new System.EventHandler(this.CloseBtn_Click);
179 | //
180 | // HelpForm
181 | //
182 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
183 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
184 | this.ClientSize = new System.Drawing.Size(346, 518);
185 | this.Controls.Add(this.MainTheme);
186 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
187 | this.Name = "HelpForm";
188 | this.ShowInTaskbar = false;
189 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
190 | this.Text = "Help";
191 | this.TransparencyKey = System.Drawing.Color.Fuchsia;
192 | this.MainTheme.ResumeLayout(false);
193 | this.HelpTabControl.ResumeLayout(false);
194 | this.RenamingPage.ResumeLayout(false);
195 | this.RenamingPage.PerformLayout();
196 | this.StringEncryptionPage.ResumeLayout(false);
197 | this.StringEncryptionPage.PerformLayout();
198 | this.AntiTamperingPage.ResumeLayout(false);
199 | this.AntiTamperingPage.PerformLayout();
200 | this.ResumeLayout(false);
201 |
202 | }
203 |
204 | #endregion
205 |
206 | private FormSkin.clsNeoBuxTheme MainTheme;
207 | private System.Windows.Forms.TabControl HelpTabControl;
208 | private System.Windows.Forms.TabPage RenamingPage;
209 | private System.Windows.Forms.TabPage StringEncryptionPage;
210 | private System.Windows.Forms.TabPage AntiTamperingPage;
211 | private System.Windows.Forms.TextBox StringEncryptionTxt;
212 | private System.Windows.Forms.TextBox textBox1;
213 | private System.Windows.Forms.TextBox AntiTamperingTxt;
214 | private System.Windows.Forms.TextBox RenamingTxt;
215 | private FormSkin.clsButtonBlue CloseBtn;
216 | }
217 | }
--------------------------------------------------------------------------------
/Unity3DObfuscator/HelpForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Unity3DObfuscator
12 | {
13 | public partial class HelpForm : Form
14 | {
15 | public HelpForm()
16 | {
17 | InitializeComponent();
18 | RenamingTxt.Text = ObfuscatorHelp.Renaming;
19 | StringEncryptionTxt.Text = ObfuscatorHelp.StringEncryption;
20 | AntiTamperingTxt.Text = ObfuscatorHelp.AntiTampering;
21 | }
22 |
23 | private void CloseBtn_Click(object sender, EventArgs e)
24 | {
25 | Close();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/HelpForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Unity3DObfuscator/InjectHelper.cs:
--------------------------------------------------------------------------------
1 | using dnlib.DotNet;
2 | using dnlib.DotNet.Emit;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | namespace Unity3DObfuscator
7 | {
8 | // Credit: The original InjectHelper class is from the ConfuserEx project.
9 |
10 | ///
11 | /// Provides methods to inject a into another module.
12 | ///
13 | public static class InjectHelper
14 | {
15 | ///
16 | /// Clones the specified origin TypeDef.
17 | ///
18 | /// The origin TypeDef.
19 | /// The cloned TypeDef.
20 | private static TypeDefUser Clone(TypeDef origin)
21 | {
22 | var ret = new TypeDefUser(origin.Namespace, origin.Name) {Attributes = origin.Attributes};
23 |
24 | if (origin.ClassLayout != null)
25 | ret.ClassLayout = new ClassLayoutUser(origin.ClassLayout.PackingSize, origin.ClassSize);
26 |
27 | foreach (GenericParam genericParam in origin.GenericParameters)
28 | ret.GenericParameters.Add(new GenericParamUser(genericParam.Number, genericParam.Flags, "-"));
29 |
30 | return ret;
31 | }
32 |
33 | ///
34 | /// Clones the specified origin MethodDef.
35 | ///
36 | /// The origin MethodDef.
37 | /// The cloned MethodDef.
38 | static MethodDefUser Clone(MethodDef origin)
39 | {
40 | var ret = new MethodDefUser(origin.Name, null, origin.ImplAttributes, origin.Attributes);
41 |
42 | foreach (GenericParam genericParam in origin.GenericParameters)
43 | ret.GenericParameters.Add(new GenericParamUser(genericParam.Number, genericParam.Flags, "-"));
44 |
45 | return ret;
46 | }
47 |
48 | ///
49 | /// Clones the specified origin FieldDef.
50 | ///
51 | /// The origin FieldDef.
52 | /// The cloned FieldDef.
53 | private static FieldDefUser Clone(FieldDef origin)
54 | {
55 | var ret = new FieldDefUser(origin.Name, null, origin.Attributes);
56 | return ret;
57 | }
58 |
59 | ///
60 | /// Populates the context mappings.
61 | ///
62 | /// The origin TypeDef.
63 | /// The injection context.
64 | /// The new TypeDef.
65 | private static TypeDef PopulateContext(TypeDef typeDef, InjectContext ctx)
66 | {
67 | TypeDef ret;
68 | IDnlibDef existing;
69 | if (!ctx.Map.TryGetValue(typeDef, out existing))
70 | {
71 | ret = Clone(typeDef);
72 | ctx.Map[typeDef] = ret;
73 | }
74 | else
75 | ret = (TypeDef)existing;
76 |
77 | foreach (TypeDef nestedType in typeDef.NestedTypes)
78 | ret.NestedTypes.Add(PopulateContext(nestedType, ctx));
79 |
80 | foreach (MethodDef method in typeDef.Methods)
81 | ret.Methods.Add((MethodDef)(ctx.Map[method] = Clone(method)));
82 |
83 | foreach (FieldDef field in typeDef.Fields)
84 | ret.Fields.Add((FieldDef)(ctx.Map[field] = Clone(field)));
85 |
86 | return ret;
87 | }
88 |
89 | ///
90 | /// Copies the information from the origin type to injected type.
91 | ///
92 | /// The origin TypeDef.
93 | /// The injection context.
94 | private static void CopyTypeDef(TypeDef typeDef, InjectContext ctx)
95 | {
96 | var newTypeDef = (TypeDef)ctx.Map[typeDef];
97 |
98 | newTypeDef.BaseType = (ITypeDefOrRef)ctx.Importer.Import(typeDef.BaseType);
99 |
100 | foreach (InterfaceImpl iface in typeDef.Interfaces)
101 | newTypeDef.Interfaces.Add(new InterfaceImplUser((ITypeDefOrRef)ctx.Importer.Import(iface.Interface)));
102 | }
103 |
104 | ///
105 | /// Copies the information from the origin method to injected method.
106 | ///
107 | /// The origin MethodDef.
108 | /// The injection context.
109 | private static void CopyMethodDef(MethodDef methodDef, InjectContext ctx)
110 | {
111 | var newMethodDef = (MethodDef)ctx.Map[methodDef];
112 |
113 | newMethodDef.Signature = ctx.Importer.Import(methodDef.Signature);
114 | newMethodDef.Parameters.UpdateParameterTypes();
115 |
116 | if (methodDef.ImplMap != null)
117 | newMethodDef.ImplMap = new ImplMapUser(new ModuleRefUser(ctx.TargetModule, methodDef.ImplMap.Module.Name), methodDef.ImplMap.Name, methodDef.ImplMap.Attributes);
118 |
119 | foreach (CustomAttribute ca in methodDef.CustomAttributes)
120 | newMethodDef.CustomAttributes.Add(new CustomAttribute((ICustomAttributeType)ctx.Importer.Import(ca.Constructor)));
121 |
122 | if (!methodDef.HasBody) return;
123 | newMethodDef.Body = new CilBody(methodDef.Body.InitLocals, new List(), new List(), new List());
124 | newMethodDef.Body.MaxStack = methodDef.Body.MaxStack;
125 |
126 | var bodyMap = new Dictionary