Move method to DotNetUtils
This commit is contained in:
parent
823d3b07a7
commit
7b71a565ec
|
@ -908,5 +908,17 @@ namespace de4dot.blocks {
|
||||||
MetadataToken = new MetadataToken(TokenType.Event, nextTokenRid--),
|
MetadataToken = new MetadataToken(TokenType.Event, nextTokenRid--),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool findLdcI4Constant(MethodDefinition method, int constant) {
|
||||||
|
if (method == null || method.Body == null)
|
||||||
|
return false;
|
||||||
|
foreach (var instr in method.Body.Instructions) {
|
||||||
|
if (instr.OpCode.Code != Code.Ldc_I4)
|
||||||
|
continue;
|
||||||
|
if (constant == (int)instr.Operand)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,7 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
|
||||||
if (compileMethod == null)
|
if (compileMethod == null)
|
||||||
return DeobfuscatorInfo.THE_NAME + " < 4.0";
|
return DeobfuscatorInfo.THE_NAME + " < 4.0";
|
||||||
DeobfuscatedFile.deobfuscate(compileMethod);
|
DeobfuscatedFile.deobfuscate(compileMethod);
|
||||||
bool compileMethodHasConstant_0x70000000 = findConstant(compileMethod, 0x70000000); // 4.0-4.1
|
bool compileMethodHasConstant_0x70000000 = DotNetUtils.findLdcI4Constant(compileMethod, 0x70000000); // 4.0-4.1
|
||||||
DeobfuscatedFile.deobfuscate(methodsDecrypter.Method);
|
DeobfuscatedFile.deobfuscate(methodsDecrypter.Method);
|
||||||
bool hasCorEnableProfilingString = findString(methodsDecrypter.Method, "Cor_Enable_Profiling"); // 4.1-4.4
|
bool hasCorEnableProfilingString = findString(methodsDecrypter.Method, "Cor_Enable_Profiling"); // 4.1-4.4
|
||||||
|
|
||||||
|
@ -362,18 +362,6 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool findConstant(MethodDefinition method, int constant) {
|
|
||||||
if (method == null || method.Body == null)
|
|
||||||
return false;
|
|
||||||
foreach (var instr in method.Body.Instructions) {
|
|
||||||
if (instr.OpCode.Code != Code.Ldc_I4)
|
|
||||||
continue;
|
|
||||||
if (constant == (int)instr.Operand)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool getDecryptedModule(ref byte[] newFileData, ref Dictionary<uint, DumpedMethod> dumpedMethods) {
|
public override bool getDecryptedModule(ref byte[] newFileData, ref Dictionary<uint, DumpedMethod> dumpedMethods) {
|
||||||
fileData = ModuleBytes ?? DeobUtils.readModule(module);
|
fileData = ModuleBytes ?? DeobUtils.readModule(module);
|
||||||
peImage = new PeImage(fileData);
|
peImage = new PeImage(fileData);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user