代码清理

dev
walon 2025-06-22 10:39:31 +08:00
parent cfe9dcdd08
commit 0ad96daa32
28 changed files with 29 additions and 77 deletions

View File

@ -1,6 +1,5 @@
using dnlib.DotNet; using dnlib.DotNet;
using dnlib.DotNet.Emit; using dnlib.DotNet.Emit;
using dnlib.DotNet.Writer;
using Obfuz.Utils; using Obfuz.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -1,6 +1,5 @@
using NUnit.Framework; using NUnit.Framework;
using Obfuz.Utils; using Obfuz.Utils;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Obfuz.EncryptionVM.Instructions namespace Obfuz.EncryptionVM.Instructions

View File

@ -2,7 +2,6 @@
using dnlib.DotNet.Emit; using dnlib.DotNet.Emit;
using Obfuz.Emit; using Obfuz.Emit;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Obfuz.ObfusPasses namespace Obfuz.ObfusPasses
{ {

View File

@ -1,12 +1,9 @@
using dnlib.DotNet; using dnlib.DotNet;
using Obfuz.Conf; using Obfuz.Conf;
using Obfuz.Settings; using Obfuz.Settings;
using Obfuz.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Xml; using System.Xml;
using UnityEditor.VersionControl;
namespace Obfuz.ObfusPasses.EvalStackObfus namespace Obfuz.ObfusPasses.EvalStackObfus
{ {

View File

@ -4,12 +4,7 @@ using Obfuz.Data;
using Obfuz.Emit; using Obfuz.Emit;
using Obfuz.Settings; using Obfuz.Settings;
using Obfuz.Utils; using Obfuz.Utils;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Obfuz.ObfusPasses.EvalStackObfus namespace Obfuz.ObfusPasses.EvalStackObfus
{ {

View File

@ -1,6 +1,4 @@
using dnlib.DotNet; using dnlib.DotNet.Emit;
using dnlib.DotNet.Emit;
using Obfuz.Emit;
using System.Collections.Generic; using System.Collections.Generic;
namespace Obfuz.ObfusPasses.EvalStackObfus namespace Obfuz.ObfusPasses.EvalStackObfus

View File

@ -1,12 +1,9 @@
using dnlib.DotNet; using dnlib.DotNet;
using Obfuz.Conf; using Obfuz.Conf;
using Obfuz.Settings; using Obfuz.Settings;
using Obfuz.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Xml; using System.Xml;
using UnityEditor.VersionControl;
namespace Obfuz.ObfusPasses.ExprObfus namespace Obfuz.ObfusPasses.ExprObfus
{ {

View File

@ -6,8 +6,6 @@ using Obfuz.ObfusPasses.ExprObfus.Obfuscators;
using Obfuz.Settings; using Obfuz.Settings;
using Obfuz.Utils; using Obfuz.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Obfuz.ObfusPasses.ExprObfus namespace Obfuz.ObfusPasses.ExprObfus
{ {

View File

@ -1,5 +1,4 @@
using dnlib.DotNet; using dnlib.DotNet.Emit;
using dnlib.DotNet.Emit;
using Obfuz.Emit; using Obfuz.Emit;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -1,13 +1,8 @@
using dnlib.DotNet.Emit; using dnlib.DotNet.Emit;
using dnlib.DotNet;
using Obfuz.Emit;
using System.Collections.Generic;
using Obfuz.Utils;
using Obfuz.Data; using Obfuz.Data;
using UnityEngine; using Obfuz.Emit;
using UnityEngine.Assertions; using Obfuz.Utils;
using JetBrains.Annotations; using System.Collections.Generic;
using System;
namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators
{ {

View File

@ -1,12 +1,7 @@
using dnlib.DotNet; using dnlib.DotNet;
using dnlib.DotNet.Emit; using dnlib.DotNet.Emit;
using Obfuz.Emit; using Obfuz.Emit;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators namespace Obfuz.ObfusPasses.ExprObfus.Obfuscators

View File

@ -1,12 +1,9 @@
using dnlib.DotNet; using dnlib.DotNet;
using dnlib.DotNet.Emit; using dnlib.DotNet.Emit;
using Obfuz.Editor; using Obfuz.Editor;
using Obfuz.Emit;
using Obfuz.Settings;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Security;
using System.Text; using System.Text;
using UnityEngine.Assertions; using UnityEngine.Assertions;

View File

@ -1,7 +1,6 @@
using dnlib.DotNet; using dnlib.DotNet;
using dnlib.DotNet.Emit; using dnlib.DotNet.Emit;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Obfuz.ObfusPasses namespace Obfuz.ObfusPasses
{ {

View File

@ -1,6 +1,5 @@
using dnlib.DotNet; using dnlib.DotNet;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine.Assertions; using UnityEngine.Assertions;
namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers namespace Obfuz.ObfusPasses.SymbolObfus.NameMakers

View File

@ -2,7 +2,6 @@
using Obfuz.Editor; using Obfuz.Editor;
using Obfuz.Utils; using Obfuz.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Obfuz.ObfusPasses.SymbolObfus.Policies namespace Obfuz.ObfusPasses.SymbolObfus.Policies
{ {

View File

@ -3,8 +3,6 @@ using dnlib.DotNet.Emit;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
namespace Obfuz.ObfusPasses.SymbolObfus namespace Obfuz.ObfusPasses.SymbolObfus

View File

@ -2,6 +2,7 @@
using Obfuz.ObfusPasses; using Obfuz.ObfusPasses;
using Obfuz.ObfusPasses.CallObfus; using Obfuz.ObfusPasses.CallObfus;
using Obfuz.ObfusPasses.ConstEncrypt; using Obfuz.ObfusPasses.ConstEncrypt;
using Obfuz.ObfusPasses.ControlFlowObfus;
using Obfuz.ObfusPasses.EvalStackObfus; using Obfuz.ObfusPasses.EvalStackObfus;
using Obfuz.ObfusPasses.ExprObfus; using Obfuz.ObfusPasses.ExprObfus;
using Obfuz.ObfusPasses.FieldEncrypt; using Obfuz.ObfusPasses.FieldEncrypt;
@ -186,6 +187,10 @@ namespace Obfuz
{ {
builder.AddPass(new CallObfusPass(settings.callObfusSettings.ToFacade())); builder.AddPass(new CallObfusPass(settings.callObfusSettings.ToFacade()));
} }
if (obfuscationPasses.HasFlag(ObfuscationPassType.ControlFlowObfus))
{
builder.AddPass(new ControlFlowObfusPass(settings.controlFlowObfuscationSettings.ToFacade()));
}
if (obfuscationPasses.HasFlag(ObfuscationPassType.SymbolObfus)) if (obfuscationPasses.HasFlag(ObfuscationPassType.SymbolObfus))
{ {
builder.AddPass(new SymbolObfusPass(settings.symbolObfusSettings.ToFacade())); builder.AddPass(new SymbolObfusPass(settings.symbolObfusSettings.ToFacade()));

View File

@ -40,6 +40,9 @@ namespace Obfuz.Settings
[Tooltip("expression obfuscation settings")] [Tooltip("expression obfuscation settings")]
public ExprObfuscationSettings exprObfusSettings; public ExprObfuscationSettings exprObfusSettings;
[Tooltip("control flow obfuscation settings")]
public ControlFlowObfuscationSettings controlFlowObfuscationSettings;
public string ObfuzRootDir => $"Library/Obfuz"; public string ObfuzRootDir => $"Library/Obfuz";
public string GetObfuscatedAssemblyOutputPath(BuildTarget target) public string GetObfuscatedAssemblyOutputPath(BuildTarget target)

View File

@ -36,6 +36,7 @@ namespace Obfuz.Settings
private SerializedProperty _fieldEncryptSettings; private SerializedProperty _fieldEncryptSettings;
private SerializedProperty _callObfusSettings; private SerializedProperty _callObfusSettings;
private SerializedProperty _exprObfusSettings; private SerializedProperty _exprObfusSettings;
private SerializedProperty _controlFlowObfusSettings;
public ObfuzSettingsProvider() : base("Project/Obfuz", SettingsScope.Project) public ObfuzSettingsProvider() : base("Project/Obfuz", SettingsScope.Project)
{ {
@ -70,6 +71,7 @@ namespace Obfuz.Settings
_exprObfusSettings = _serializedObject.FindProperty("exprObfusSettings"); _exprObfusSettings = _serializedObject.FindProperty("exprObfusSettings");
_fieldEncryptSettings = _serializedObject.FindProperty("fieldEncryptSettings"); _fieldEncryptSettings = _serializedObject.FindProperty("fieldEncryptSettings");
_callObfusSettings = _serializedObject.FindProperty("callObfusSettings"); _callObfusSettings = _serializedObject.FindProperty("callObfusSettings");
_controlFlowObfusSettings = _serializedObject.FindProperty("controlFlowObfuscationSettings");
} }
public override void OnGUI(string searchContext) public override void OnGUI(string searchContext)
@ -94,6 +96,7 @@ namespace Obfuz.Settings
EditorGUILayout.PropertyField(_exprObfusSettings); EditorGUILayout.PropertyField(_exprObfusSettings);
EditorGUILayout.PropertyField(_fieldEncryptSettings); EditorGUILayout.PropertyField(_fieldEncryptSettings);
EditorGUILayout.PropertyField(_callObfusSettings); EditorGUILayout.PropertyField(_callObfusSettings);
EditorGUILayout.PropertyField(_controlFlowObfusSettings);
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())

View File

@ -1,11 +1,7 @@
using dnlib.DotNet.Emit; using dnlib.DotNet;
using dnlib.DotNet; using dnlib.DotNet.Emit;
using Obfuz.Data; using Obfuz.Data;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils namespace Obfuz.Utils
{ {

View File

@ -1,9 +1,5 @@
using dnlib.DotNet; using dnlib.DotNet;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils namespace Obfuz.Utils
{ {

View File

@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz.Utils namespace Obfuz.Utils
{ {

View File

@ -1,10 +1,4 @@
using System; namespace Obfuz
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz
{ {
public static class ObfuscationInstincts public static class ObfuscationInstincts
{ {

View File

@ -1,10 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Obfuz namespace Obfuz
{ {