|
3 | 3 | using System.Text; |
4 | 4 | using System.Security.Cryptography; |
5 | 5 | using O_Z_IL2CPP_Security.LitJson; |
| 6 | +using OZ_Obfus.obfuscators; |
6 | 7 | using System.Diagnostics; |
| 8 | +using OZ_Obfuscator.Ofbuscators; |
| 9 | +using OZ_Obfus; |
7 | 10 |
|
8 | 11 | List<byte[]> StringLiteraBytes = new List<byte[]>(); |
9 | 12 | List<byte[]> StringLiteraBytes_Crypted = new List<byte[]>(); |
@@ -128,8 +131,8 @@ void _Crypt() |
128 | 131 | StringLiteraBytes_Crypted = Crypt.Cryptstring(StringLiteraBytes,jsonManager.index.key); |
129 | 132 | byte[] allstring = metadata.GetAllStringFromMeta(); |
130 | 133 | 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); |
133 | 136 | Console.WriteLine("正在写入文件..."); |
134 | 137 | File.WriteAllBytes(args[2], tmp); |
135 | 138 | Console.WriteLine("Done!"); |
@@ -159,14 +162,14 @@ void _Generate() |
159 | 162 | if (jsonManager.index.Version == "24.4") |
160 | 163 | { |
161 | 164 | 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)); |
163 | 166 | File.WriteAllText("Generation/" + jsonManager.index.Version + "/libil2cpp/vm/MetadataCache.cpp", cpp.retsrc); |
164 | 167 | File.WriteAllLines("Generation/" + jsonManager.index.Version + "/libil2cpp/il2cpp-metadata.h", File.ReadAllLines("src-res/" + jsonManager.index.Version + "/il2cpp-metadata.h")); |
165 | 168 | } |
166 | 169 | else if (jsonManager.index.Version == "28") |
167 | 170 | { |
168 | 171 | 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)); |
170 | 173 | File.WriteAllText("Generation/" + jsonManager.index.Version + "/libil2cpp/vm/GlobalMetadata.cpp", cpp.retsrc); |
171 | 174 | File.WriteAllLines("Generation/" + jsonManager.index.Version + "/libil2cpp/vm/GlobalMetadataFileInternals.h", File.ReadAllLines("src-res/" + jsonManager.index.Version + "/GlobalMetadataFileInternals.h")); |
172 | 175 | } |
@@ -211,22 +214,26 @@ void Help() |
211 | 214 | } |
212 | 215 | void MonoObfus() |
213 | 216 | { |
214 | | - string args = ""; |
215 | | - args +=OpenFilePath; |
| 217 | + AssemblyLoader loader = new AssemblyLoader(OpenFilePath); |
216 | 218 | if (jsonManager.index.Obfus.ControlFlow == 1) |
217 | | - args += " --ControlFlow"; |
| 219 | + { |
| 220 | + ControlFlow controlFlow = new ControlFlow(loader.Module); |
| 221 | + controlFlow.Execute(); |
| 222 | + } |
218 | 223 | 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 | + } |
222 | 233 | if (jsonManager.index.Obfus.StrCrypter == 1) |
223 | | - args += " --StrCrypter"; |
224 | | - if(string.Compare(args,OpenFilePath)!=0) |
225 | 234 | { |
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(); |
230 | 237 | } |
231 | | - |
| 238 | + loader.Save(); |
232 | 239 | } |
0 commit comments