Add MethodCallInliner prop to cflow deob class
This commit is contained in:
parent
17327902c3
commit
c28b575f7a
|
@ -30,12 +30,12 @@ namespace de4dot.blocks.cflow {
|
|||
DeadCodeRemover deadCodeRemover = new DeadCodeRemover();
|
||||
DeadStoreRemover deadStoreRemover = new DeadStoreRemover();
|
||||
StLdlocFixer stLdlocFixer = new StLdlocFixer();
|
||||
IMethodCallInliner methodCallInliner;
|
||||
ConstantsFolder constantsFolder = new ConstantsFolder();
|
||||
|
||||
public void init(Blocks blocks, IMethodCallInliner methodCallInliner) {
|
||||
public IMethodCallInliner MethodCallInliner { get; set; }
|
||||
|
||||
public void init(Blocks blocks) {
|
||||
this.blocks = blocks;
|
||||
this.methodCallInliner = methodCallInliner;
|
||||
}
|
||||
|
||||
public void deobfuscate() {
|
||||
|
@ -53,8 +53,8 @@ namespace de4dot.blocks.cflow {
|
|||
changed |= fixDotfuscatorLoop();
|
||||
|
||||
foreach (var block in allBlocks) {
|
||||
methodCallInliner.init(blocks, block);
|
||||
changed |= methodCallInliner.deobfuscate();
|
||||
MethodCallInliner.init(blocks, block);
|
||||
changed |= MethodCallInliner.deobfuscate();
|
||||
}
|
||||
|
||||
foreach (var block in allBlocks) {
|
||||
|
|
|
@ -24,15 +24,14 @@ using Mono.Cecil.Cil;
|
|||
namespace de4dot.blocks.cflow {
|
||||
public class CflowDeobfuscator : ICflowDeobfuscator {
|
||||
BlocksCflowDeobfuscator cflowDeobfuscator = new BlocksCflowDeobfuscator();
|
||||
IMethodCallInliner methodCallInliner;
|
||||
|
||||
public CflowDeobfuscator(IMethodCallInliner methodCallInliner) {
|
||||
this.methodCallInliner = methodCallInliner;
|
||||
cflowDeobfuscator.MethodCallInliner = methodCallInliner;
|
||||
}
|
||||
|
||||
public void deobfuscate(MethodDefinition method) {
|
||||
deobfuscate(method, (blocks) => {
|
||||
cflowDeobfuscator.init(blocks, methodCallInliner);
|
||||
cflowDeobfuscator.init(blocks);
|
||||
cflowDeobfuscator.deobfuscate();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -537,14 +537,13 @@ namespace de4dot.code {
|
|||
|
||||
Log.v("Deobfuscating methods");
|
||||
var methodPrinter = new MethodPrinter();
|
||||
var cflowDeobfuscator = new BlocksCflowDeobfuscator();
|
||||
var methodCallInliner = deob.MethodCallInliner;
|
||||
var cflowDeobfuscator = new BlocksCflowDeobfuscator { MethodCallInliner = deob.MethodCallInliner };
|
||||
foreach (var method in allMethods) {
|
||||
Log.v("Deobfuscating {0} ({1:X8})", Utils.removeNewlines(method), method.MetadataToken.ToUInt32());
|
||||
Log.indent();
|
||||
|
||||
try {
|
||||
deobfuscate(method, cflowDeobfuscator, methodCallInliner, methodPrinter);
|
||||
deobfuscate(method, cflowDeobfuscator, methodPrinter);
|
||||
}
|
||||
catch (ApplicationException) {
|
||||
throw;
|
||||
|
@ -560,7 +559,7 @@ namespace de4dot.code {
|
|||
}
|
||||
}
|
||||
|
||||
void deobfuscate(MethodDefinition method, BlocksCflowDeobfuscator cflowDeobfuscator, IMethodCallInliner methodCallInliner, MethodPrinter methodPrinter) {
|
||||
void deobfuscate(MethodDefinition method, BlocksCflowDeobfuscator cflowDeobfuscator, MethodPrinter methodPrinter) {
|
||||
if (!hasNonEmptyBody(method))
|
||||
return;
|
||||
|
||||
|
@ -570,7 +569,7 @@ namespace de4dot.code {
|
|||
|
||||
deob.deobfuscateMethodBegin(blocks);
|
||||
if (options.ControlFlowDeobfuscation) {
|
||||
cflowDeobfuscator.init(blocks, methodCallInliner);
|
||||
cflowDeobfuscator.init(blocks);
|
||||
cflowDeobfuscator.deobfuscate();
|
||||
}
|
||||
|
||||
|
@ -894,8 +893,8 @@ namespace de4dot.code {
|
|||
return;
|
||||
|
||||
deobfuscate(method, "Deobfuscating control flow", (blocks) => {
|
||||
var cflowDeobfuscator = new BlocksCflowDeobfuscator();
|
||||
cflowDeobfuscator.init(blocks, deob.MethodCallInliner);
|
||||
var cflowDeobfuscator = new BlocksCflowDeobfuscator { MethodCallInliner = deob.MethodCallInliner };
|
||||
cflowDeobfuscator.init(blocks);
|
||||
cflowDeobfuscator.deobfuscate();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user