Skip to content

Commit 4a31072

Browse files
update v1.41(fix bug & error)
1 parent cd0b5b7 commit 4a31072

File tree

5 files changed

+40
-20
lines changed

5 files changed

+40
-20
lines changed

O&Z_IL2CPP_Security/O&Z_IL2CPP_Security.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@
2424
<None Remove="README.md" />
2525
</ItemGroup>
2626

27+
<ItemGroup>
28+
<ProjectReference Include="..\O&amp;Z_Obfuscator\OZ_Obfuscator.csproj" />
29+
</ItemGroup>
30+
31+
<ItemGroup>
32+
<Reference Include="dnlib">
33+
<HintPath>..\O&amp;Z_Obfuscator\plugin\dnlib.dll</HintPath>
34+
</Reference>
35+
</ItemGroup>
36+
2737
</Project>

O&Z_IL2CPP_Security/Progarm.cs

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
using System.Text;
44
using System.Security.Cryptography;
55
using O_Z_IL2CPP_Security.LitJson;
6+
using OZ_Obfus.obfuscators;
67
using System.Diagnostics;
8+
using OZ_Obfuscator.Ofbuscators;
9+
using OZ_Obfus;
710

811
List<byte[]> StringLiteraBytes = new List<byte[]>();
912
List<byte[]> StringLiteraBytes_Crypted = new List<byte[]>();
@@ -128,8 +131,8 @@ void _Crypt()
128131
StringLiteraBytes_Crypted = Crypt.Cryptstring(StringLiteraBytes,jsonManager.index.key);
129132
byte[] allstring = metadata.GetAllStringFromMeta();
130133
Console.WriteLine("正在构建新的Metadata文件...");
131-
Stream stream = metadata.SetCryptedStreamToMetadata(StringLiteraBytes_Crypted, Crypt.CryptWithSkipNULL(allstring,(byte)Tools.CheckNull(jsonManager.index.key), jsonManager.index.key),ver);
132-
byte[] tmp = Tools.StreamToBytes(stream);
134+
Stream stream = metadata.SetCryptedStreamToMetadata(StringLiteraBytes_Crypted, Crypt.CryptWithSkipNULL(allstring,(byte)O_Z_IL2CPP_Security.Tools.CheckNull(jsonManager.index.key), jsonManager.index.key),ver);
135+
byte[] tmp = O_Z_IL2CPP_Security.Tools.StreamToBytes(stream);
133136
Console.WriteLine("正在写入文件...");
134137
File.WriteAllBytes(args[2], tmp);
135138
Console.WriteLine("Done!");
@@ -159,14 +162,14 @@ void _Generate()
159162
if (jsonManager.index.Version == "24.4")
160163
{
161164
src = File.ReadAllText("src-res/" + jsonManager.index.Version + "/MetadataCache.cpp");
162-
cpp = new CPP(src, IL2CPP_Version.V24_4, jsonManager.index.key, (byte)Tools.CheckNull(jsonManager.index.key));
165+
cpp = new CPP(src, IL2CPP_Version.V24_4, jsonManager.index.key, (byte)O_Z_IL2CPP_Security.Tools.CheckNull(jsonManager.index.key));
163166
File.WriteAllText("Generation/" + jsonManager.index.Version + "/libil2cpp/vm/MetadataCache.cpp", cpp.retsrc);
164167
File.WriteAllLines("Generation/" + jsonManager.index.Version + "/libil2cpp/il2cpp-metadata.h", File.ReadAllLines("src-res/" + jsonManager.index.Version + "/il2cpp-metadata.h"));
165168
}
166169
else if (jsonManager.index.Version == "28")
167170
{
168171
src = File.ReadAllText("src-res/" + jsonManager.index.Version + "/GlobalMetadata.cpp");
169-
cpp = new CPP(src, IL2CPP_Version.V24_4, jsonManager.index.key, (byte)Tools.CheckNull(jsonManager.index.key));
172+
cpp = new CPP(src, IL2CPP_Version.V24_4, jsonManager.index.key, (byte)O_Z_IL2CPP_Security.Tools.CheckNull(jsonManager.index.key));
170173
File.WriteAllText("Generation/" + jsonManager.index.Version + "/libil2cpp/vm/GlobalMetadata.cpp", cpp.retsrc);
171174
File.WriteAllLines("Generation/" + jsonManager.index.Version + "/libil2cpp/vm/GlobalMetadataFileInternals.h", File.ReadAllLines("src-res/" + jsonManager.index.Version + "/GlobalMetadataFileInternals.h"));
172175
}
@@ -211,22 +214,26 @@ void Help()
211214
}
212215
void MonoObfus()
213216
{
214-
string args = "";
215-
args +=OpenFilePath;
217+
AssemblyLoader loader = new AssemblyLoader(OpenFilePath);
216218
if (jsonManager.index.Obfus.ControlFlow == 1)
217-
args += " --ControlFlow";
219+
{
220+
ControlFlow controlFlow = new ControlFlow(loader.Module);
221+
controlFlow.Execute();
222+
}
218223
if (jsonManager.index.Obfus.NumObfus == 1)
219-
args += " --NumObfus";
220-
if(jsonManager.index.Obfus.LocalVariables2Field==1)
221-
args += " --LocalVariables2Field";
224+
{
225+
NumObfus numObfus = new NumObfus(loader.Module);
226+
numObfus.Execute();
227+
}
228+
if (jsonManager.index.Obfus.LocalVariables2Field == 1)
229+
{
230+
LocalVariables2Field localVariables2Field = new LocalVariables2Field(loader.Module);
231+
localVariables2Field.Execute();
232+
}
222233
if (jsonManager.index.Obfus.StrCrypter == 1)
223-
args += " --StrCrypter";
224-
if(string.Compare(args,OpenFilePath)!=0)
225234
{
226-
Process process = new Process();
227-
process.StartInfo.FileName = "OZ_Obfuscator.exe";
228-
process.StartInfo.Arguments = args;
229-
process.Start();
235+
StrCrypter strCrypter = new StrCrypter(loader.Module);
236+
strCrypter.Execute();
230237
}
231-
238+
loader.Save();
232239
}

O&Z_IL2CPP_Security/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"Obfus": {
2020
"commandName": "Project",
21-
"commandLineArgs": "\"C:\\Users\\22864\\Desktop\\2019Testbuild\\O&Z_2019_4_32_f1_Data\\Managed\\Assembly-CSharp.bak.dll\" MonoObfus"
21+
"commandLineArgs": "\"C:\\Users\\22864\\Desktop\\END_AUTO V2\\END_Data\\Managed\\Assembly-CSharp.dll.bak\" MonoObfus"
2222
}
2323
}
2424
}

O&Z_Obfuscator/OZ_Obfuscator.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{5C48CBD8-78BC-4789-B851-71170FFF0662}</ProjectGuid>
8-
<OutputType>Exe</OutputType>
8+
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>OZ_Obfuscator</RootNamespace>
1111
<AssemblyName>OZ_Obfuscator</AssemblyName>
@@ -48,7 +48,7 @@
4848
<ErrorReport>prompt</ErrorReport>
4949
<WarningLevel>4</WarningLevel>
5050
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
51-
<PlatformTarget>x64</PlatformTarget>
51+
<PlatformTarget>AnyCPU</PlatformTarget>
5252
</PropertyGroup>
5353
<PropertyGroup>
5454
<StartupObject />

O&Z_Obfuscator/OZ_Obfuscator.csproj.user

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@
1111
<FallbackCulture>zh-CN</FallbackCulture>
1212
<VerifyUploadedFiles>false</VerifyUploadedFiles>
1313
</PropertyGroup>
14+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
15+
<StartArguments>“C:\Users\22864\Desktop\END_AUTO V2\END_Data\Managed\Assembly-CSharp.dll” --ControlFlow --NumObfus --LocalVariables2Field --StrCrypter</StartArguments>
16+
</PropertyGroup>
1417
</Project>

0 commit comments

Comments
 (0)