Update code since submodule was updated
This commit is contained in:
parent
aa529c6c5a
commit
5ad2e18695
|
@ -178,7 +178,7 @@ namespace AssemblyData.methodsrewriter {
|
||||||
|
|
||||||
void initLocals() {
|
void initLocals() {
|
||||||
locals = new List<LocalBuilder>();
|
locals = new List<LocalBuilder>();
|
||||||
foreach (var local in methodInfo.methodDef.Body.LocalList)
|
foreach (var local in methodInfo.methodDef.Body.Variables)
|
||||||
locals.Add(ilg.DeclareLocal(Resolver.getRtType(local.Type), local.Type.RemoveModifiers().IsPinned));
|
locals.Add(ilg.DeclareLocal(Resolver.getRtType(local.Type), local.Type.RemoveModifiers().IsPinned));
|
||||||
tempObjLocal = ilg.DeclareLocal(typeof(object));
|
tempObjLocal = ilg.DeclareLocal(typeof(object));
|
||||||
tempObjArrayLocal = ilg.DeclareLocal(typeof(object[]));
|
tempObjArrayLocal = ilg.DeclareLocal(typeof(object[]));
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace de4dot.blocks {
|
||||||
|
|
||||||
public void updateBlocks() {
|
public void updateBlocks() {
|
||||||
var body = method.Body;
|
var body = method.Body;
|
||||||
locals = body.LocalList;
|
locals = body.Variables;
|
||||||
methodBlocks = new InstructionListParser(body.Instructions, body.ExceptionHandlers).parse();
|
methodBlocks = new InstructionListParser(body.Instructions, body.ExceptionHandlers).parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -442,9 +442,9 @@ namespace de4dot.blocks {
|
||||||
var fromBody = fromMethod.Body;
|
var fromBody = fromMethod.Body;
|
||||||
var toBody = toMethod.Body;
|
var toBody = toMethod.Body;
|
||||||
|
|
||||||
toBody.LocalList.Clear();
|
toBody.Variables.Clear();
|
||||||
foreach (var local in fromBody.LocalList)
|
foreach (var local in fromBody.Variables)
|
||||||
toBody.LocalList.Add(new Local(local.Type));
|
toBody.Variables.Add(new Local(local.Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateInstructionOperands(MethodDef fromMethod, MethodDef toMethod) {
|
static void updateInstructionOperands(MethodDef fromMethod, MethodDef toMethod) {
|
||||||
|
@ -459,8 +459,8 @@ namespace de4dot.blocks {
|
||||||
var toParams = toMethod.Parameters;
|
var toParams = toMethod.Parameters;
|
||||||
for (int i = 0; i < fromParams.Count; i++)
|
for (int i = 0; i < fromParams.Count; i++)
|
||||||
newOperands[fromParams[i]] = toParams[i];
|
newOperands[fromParams[i]] = toParams[i];
|
||||||
for (int i = 0; i < fromBody.LocalList.Count; i++)
|
for (int i = 0; i < fromBody.Variables.Count; i++)
|
||||||
newOperands[fromBody.LocalList[i]] = toBody.LocalList[i];
|
newOperands[fromBody.Variables[i]] = toBody.Variables[i];
|
||||||
|
|
||||||
foreach (var instr in toBody.Instructions) {
|
foreach (var instr in toBody.Instructions) {
|
||||||
if (instr.Operand == null)
|
if (instr.Operand == null)
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace de4dot.blocks.cflow {
|
||||||
|
|
||||||
public void init(MethodDef method) {
|
public void init(MethodDef method) {
|
||||||
this.parameterDefs = method.Parameters;
|
this.parameterDefs = method.Parameters;
|
||||||
this.localDefs = method.Body.LocalList;
|
this.localDefs = method.Body.Variables;
|
||||||
valueStack.init();
|
valueStack.init();
|
||||||
protectedStackValues.Clear();
|
protectedStackValues.Clear();
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ namespace de4dot.code {
|
||||||
|
|
||||||
bool getLocalVariableValue(Local variable, out object value) {
|
bool getLocalVariableValue(Local variable, out object value) {
|
||||||
if (variableValues == null)
|
if (variableValues == null)
|
||||||
variableValues = new VariableValues(theMethod.Body.LocalList, allBlocks);
|
variableValues = new VariableValues(theMethod.Body.Variables, allBlocks);
|
||||||
var val = variableValues.getValue(variable);
|
var val = variableValues.getValue(variable);
|
||||||
if (!val.isValid()) {
|
if (!val.isValid()) {
|
||||||
value = null;
|
value = null;
|
||||||
|
@ -342,7 +342,7 @@ namespace de4dot.code {
|
||||||
case Code.Ldloc_1:
|
case Code.Ldloc_1:
|
||||||
case Code.Ldloc_2:
|
case Code.Ldloc_2:
|
||||||
case Code.Ldloc_3:
|
case Code.Ldloc_3:
|
||||||
getLocalVariableValue(instr.Instruction.GetLocal(theMethod.Body.LocalList), out arg);
|
getLocalVariableValue(instr.Instruction.GetLocal(theMethod.Body.Variables), out arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Code.Ldfld:
|
case Code.Ldfld:
|
||||||
|
|
|
@ -123,8 +123,8 @@ namespace de4dot.code.deobfuscators.Agile_NET.vm {
|
||||||
|
|
||||||
Logger.v("Locals:");
|
Logger.v("Locals:");
|
||||||
Logger.Instance.indent();
|
Logger.Instance.indent();
|
||||||
for (int i = 0; i < method.Body.LocalList.Count; i++)
|
for (int i = 0; i < method.Body.Variables.Count; i++)
|
||||||
Logger.v("#{0}: {1}", i, method.Body.LocalList[i].Type);
|
Logger.v("#{0}: {1}", i, method.Body.Variables[i].Type);
|
||||||
Logger.Instance.deIndent();
|
Logger.Instance.deIndent();
|
||||||
|
|
||||||
Logger.v("Code:");
|
Logger.v("Code:");
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace de4dot.code.deobfuscators.Agile_NET.vm {
|
||||||
var newExceptions = readExceptions(cilMethod, csvmMethod, newInstructions);
|
var newExceptions = readExceptions(cilMethod, csvmMethod, newInstructions);
|
||||||
|
|
||||||
fixInstructionOperands(newInstructions);
|
fixInstructionOperands(newInstructions);
|
||||||
fixLocals(newInstructions, cilMethod.Body.LocalList);
|
fixLocals(newInstructions, cilMethod.Body.Variables);
|
||||||
fixArgs(newInstructions, cilMethod);
|
fixArgs(newInstructions, cilMethod);
|
||||||
|
|
||||||
DotNetUtils.restoreBody(cilMethod, newInstructions, newExceptions);
|
DotNetUtils.restoreBody(cilMethod, newInstructions, newExceptions);
|
||||||
|
|
|
@ -462,7 +462,7 @@ namespace de4dot.code.deobfuscators.Agile_NET.vm {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool rethrow_check(UnknownHandlerInfo info) {
|
static bool rethrow_check(UnknownHandlerInfo info) {
|
||||||
return info.ExecuteMethod.Body.LocalList.Count == 0;
|
return info.ExecuteMethod.Body.Variables.Count == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Instruction rethrow_read(BinaryReader reader) {
|
static Instruction rethrow_read(BinaryReader reader) {
|
||||||
|
|
|
@ -115,9 +115,9 @@ namespace de4dot.code.deobfuscators.Babel_NET {
|
||||||
body.MaxStack = babelMethod.MaxStack;
|
body.MaxStack = babelMethod.MaxStack;
|
||||||
body.InitLocals = babelMethod.InitLocals;
|
body.InitLocals = babelMethod.InitLocals;
|
||||||
|
|
||||||
body.LocalList.Clear();
|
body.Variables.Clear();
|
||||||
foreach (var local in babelMethod.Locals)
|
foreach (var local in babelMethod.Locals)
|
||||||
body.LocalList.Add(local);
|
body.Variables.Add(local);
|
||||||
|
|
||||||
var toNewOperand = new Dictionary<object, object>();
|
var toNewOperand = new Dictionary<object, object>();
|
||||||
if (babelMethod.ThisParameter != null)
|
if (babelMethod.ThisParameter != null)
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace de4dot.code.deobfuscators {
|
||||||
|
|
||||||
public ConstantsReader(MethodDef method)
|
public ConstantsReader(MethodDef method)
|
||||||
: this(method.Body.Instructions) {
|
: this(method.Body.Instructions) {
|
||||||
this.locals = method.Body.LocalList;
|
this.locals = method.Body.Variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstantsReader(IList<Instr> instrs, IList<Local> locals)
|
public ConstantsReader(IList<Instr> instrs, IList<Local> locals)
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace de4dot.code.deobfuscators.CryptoObfuscator {
|
||||||
static IList<Local> getLocals(MethodDef method) {
|
static IList<Local> getLocals(MethodDef method) {
|
||||||
if (method.Body == null)
|
if (method.Body == null)
|
||||||
return new List<Local>();
|
return new List<Local>();
|
||||||
return method.Body.LocalList;
|
return method.Body.Variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IField ReadInlineField(Instruction instr) {
|
protected override IField ReadInlineField(Instruction instr) {
|
||||||
|
|
|
@ -159,7 +159,7 @@ namespace de4dot.code.deobfuscators.CryptoObfuscator {
|
||||||
Utils.removeNewlines(encMethod.FullName),
|
Utils.removeNewlines(encMethod.FullName),
|
||||||
encMethod.MDToken.ToInt32(),
|
encMethod.MDToken.ToInt32(),
|
||||||
encMethod.Body.Instructions.Count,
|
encMethod.Body.Instructions.Count,
|
||||||
encMethod.Body.LocalList.Count,
|
encMethod.Body.Variables.Count,
|
||||||
encMethod.Body.ExceptionHandlers.Count);
|
encMethod.Body.ExceptionHandlers.Count);
|
||||||
delegateTypes.Add(delegateType);
|
delegateTypes.Add(delegateType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace de4dot.code.deobfuscators.CryptoObfuscator {
|
||||||
var ldloc = instrs[i];
|
var ldloc = instrs[i];
|
||||||
if (!ldloc.IsLdloc())
|
if (!ldloc.IsLdloc())
|
||||||
continue;
|
continue;
|
||||||
var local = ldloc.GetLocal(method.Body.LocalList);
|
var local = ldloc.GetLocal(method.Body.Variables);
|
||||||
if (local == null || local.Type.GetElementType().GetPrimitiveSize() < 0)
|
if (local == null || local.Type.GetElementType().GetPrimitiveSize() < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ namespace de4dot.code.deobfuscators.CryptoObfuscator {
|
||||||
var ldloc = instructions[i - 2];
|
var ldloc = instructions[i - 2];
|
||||||
if (!ldloc.IsLdloc())
|
if (!ldloc.IsLdloc())
|
||||||
continue;
|
continue;
|
||||||
var local = ldloc.GetLocal(method.Body.LocalList);
|
var local = ldloc.GetLocal(method.Body.Variables);
|
||||||
if (local.Type.GetElementType().GetPrimitiveSize() < 0)
|
if (local.Type.GetElementType().GetPrimitiveSize() < 0)
|
||||||
continue;
|
continue;
|
||||||
constants.Add(flagValue);
|
constants.Add(flagValue);
|
||||||
|
|
|
@ -134,7 +134,7 @@ namespace de4dot.code.deobfuscators.DeepSea {
|
||||||
foreach (var parameter in method.MethodSig.GetParams())
|
foreach (var parameter in method.MethodSig.GetParams())
|
||||||
removeType(candidates, parameter);
|
removeType(candidates, parameter);
|
||||||
if (method.Body != null) {
|
if (method.Body != null) {
|
||||||
foreach (var local in method.Body.LocalList)
|
foreach (var local in method.Body.Variables)
|
||||||
removeType(candidates, local.Type);
|
removeType(candidates, local.Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace de4dot.code.deobfuscators.DeepSea {
|
||||||
var stloc = instrs[i + 2];
|
var stloc = instrs[i + 2];
|
||||||
if (!stloc.IsStloc())
|
if (!stloc.IsStloc())
|
||||||
continue;
|
continue;
|
||||||
var local = stloc.GetLocal(initMethod.Body.LocalList);
|
var local = stloc.GetLocal(initMethod.Body.Variables);
|
||||||
|
|
||||||
int startInitIndex = i;
|
int startInitIndex = i;
|
||||||
i++;
|
i++;
|
||||||
|
@ -89,7 +89,7 @@ namespace de4dot.code.deobfuscators.DeepSea {
|
||||||
var ldloc = instrs[i];
|
var ldloc = instrs[i];
|
||||||
if (!ldloc.IsLdloc())
|
if (!ldloc.IsLdloc())
|
||||||
continue;
|
continue;
|
||||||
if (ldloc.GetLocal(method.Body.LocalList) != local)
|
if (ldloc.GetLocal(method.Body.Variables) != local)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var stsfld = instrs[i + 1];
|
var stsfld = instrs[i + 1];
|
||||||
|
|
|
@ -555,7 +555,7 @@ namespace de4dot.code.deobfuscators {
|
||||||
var body = method.Body;
|
var body = method.Body;
|
||||||
if (body.InitLocals || body.MaxStack > 8)
|
if (body.InitLocals || body.MaxStack > 8)
|
||||||
return true;
|
return true;
|
||||||
if (body.LocalList.Count > 0)
|
if (body.Variables.Count > 0)
|
||||||
return true;
|
return true;
|
||||||
if (body.ExceptionHandlers.Count > 0)
|
if (body.ExceptionHandlers.Count > 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -349,7 +349,7 @@ namespace de4dot.code.deobfuscators.Eazfuscator_NET {
|
||||||
var ldloc = instrs[index];
|
var ldloc = instrs[index];
|
||||||
if (!ldloc.IsLdloc())
|
if (!ldloc.IsLdloc())
|
||||||
continue;
|
continue;
|
||||||
if (ldloc.GetLocal(method.Body.LocalList) != local)
|
if (ldloc.GetLocal(method.Body.Variables) != local)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
|
@ -374,7 +374,7 @@ namespace de4dot.code.deobfuscators.Eazfuscator_NET {
|
||||||
var stloc = instrs[index++];
|
var stloc = instrs[index++];
|
||||||
if (!stloc.IsStloc())
|
if (!stloc.IsStloc())
|
||||||
return null;
|
return null;
|
||||||
return stloc.GetLocal(method.Body.LocalList);
|
return stloc.GetLocal(method.Body.Variables);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize() {
|
void initialize() {
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace de4dot.code.deobfuscators.ILProtector {
|
||||||
var cctor = DotNetUtils.getModuleTypeCctor(module);
|
var cctor = DotNetUtils.getModuleTypeCctor(module);
|
||||||
if (cctor != null) {
|
if (cctor != null) {
|
||||||
cctor.Body.InitLocals = false;
|
cctor.Body.InitLocals = false;
|
||||||
cctor.Body.LocalList.Clear();
|
cctor.Body.Variables.Clear();
|
||||||
cctor.Body.Instructions.Clear();
|
cctor.Body.Instructions.Clear();
|
||||||
cctor.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
|
cctor.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
|
||||||
cctor.Body.ExceptionHandlers.Clear();
|
cctor.Body.ExceptionHandlers.Clear();
|
||||||
|
|
|
@ -212,7 +212,7 @@ namespace de4dot.code.deobfuscators.ILProtector {
|
||||||
Utils.removeNewlines(method.FullName),
|
Utils.removeNewlines(method.FullName),
|
||||||
method.MDToken.ToInt32(),
|
method.MDToken.ToInt32(),
|
||||||
method.Body.Instructions.Count,
|
method.Body.Instructions.Count,
|
||||||
method.Body.LocalList.Count,
|
method.Body.Variables.Count,
|
||||||
method.Body.ExceptionHandlers.Count);
|
method.Body.ExceptionHandlers.Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,7 +246,7 @@ namespace de4dot.code.deobfuscators {
|
||||||
case Code.Ldloc_1:
|
case Code.Ldloc_1:
|
||||||
case Code.Ldloc_2:
|
case Code.Ldloc_2:
|
||||||
case Code.Ldloc_3:
|
case Code.Ldloc_3:
|
||||||
local = pushInstr.GetLocal(method.Body.LocalList);
|
local = pushInstr.GetLocal(method.Body.Variables);
|
||||||
if (local == null)
|
if (local == null)
|
||||||
return null;
|
return null;
|
||||||
type = local.Type.RemovePinned();
|
type = local.Type.RemovePinned();
|
||||||
|
|
|
@ -102,7 +102,7 @@ namespace de4dot.code.deobfuscators.Spices_Net {
|
||||||
calledMethod = null;
|
calledMethod = null;
|
||||||
if (method.Body == null)
|
if (method.Body == null)
|
||||||
return false;
|
return false;
|
||||||
if (method.Body.LocalList.Count > 0)
|
if (method.Body.Variables.Count > 0)
|
||||||
return false;
|
return false;
|
||||||
if (method.Body.ExceptionHandlers.Count > 0)
|
if (method.Body.ExceptionHandlers.Count > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace de4dot.code.deobfuscators {
|
||||||
class LocalTypes : StringCounts {
|
class LocalTypes : StringCounts {
|
||||||
public LocalTypes(MethodDef method) {
|
public LocalTypes(MethodDef method) {
|
||||||
if (method != null && method.Body != null)
|
if (method != null && method.Body != null)
|
||||||
init(method.Body.LocalList);
|
init(method.Body.Variables);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalTypes(IEnumerable<Local> locals) {
|
public LocalTypes(IEnumerable<Local> locals) {
|
||||||
|
|
|
@ -329,7 +329,7 @@ namespace de4dot.code.deobfuscators {
|
||||||
pushedArgs = MethodStack.getPushedArgInstructions(instructions, i);
|
pushedArgs = MethodStack.getPushedArgInstructions(instructions, i);
|
||||||
if (pushedArgs.NumValidArgs < 1)
|
if (pushedArgs.NumValidArgs < 1)
|
||||||
break;
|
break;
|
||||||
addMethodArgType(method, getParameter(methodParams, pushedArgs.getEnd(0)), instr.GetLocal(method.Body.LocalList));
|
addMethodArgType(method, getParameter(methodParams, pushedArgs.getEnd(0)), instr.GetLocal(method.Body.Variables));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Code.Stsfld:
|
case Code.Stsfld:
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
|
||||||
continue;
|
continue;
|
||||||
if (!DotNetUtils.isMethod(method, "System.Void", "()"))
|
if (!DotNetUtils.isMethod(method, "System.Void", "()"))
|
||||||
continue;
|
continue;
|
||||||
if (method.Body.LocalList.Count > 1)
|
if (method.Body.Variables.Count > 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
simpleDeobfuscator.deobfuscate(method);
|
simpleDeobfuscator.deobfuscate(method);
|
||||||
|
|
|
@ -530,11 +530,11 @@ namespace de4dot.code.renamer {
|
||||||
if (ret == null)
|
if (ret == null)
|
||||||
return null;
|
return null;
|
||||||
if (ret.IsStloc()) {
|
if (ret.IsStloc()) {
|
||||||
var local = ret.GetLocal(method.Body.LocalList);
|
var local = ret.GetLocal(method.Body.Variables);
|
||||||
ret = DotNetUtils.getInstruction(instructions, ref index);
|
ret = DotNetUtils.getInstruction(instructions, ref index);
|
||||||
if (ret == null || !ret.IsLdloc())
|
if (ret == null || !ret.IsLdloc())
|
||||||
return null;
|
return null;
|
||||||
if (ret.GetLocal(method.Body.LocalList) != local)
|
if (ret.GetLocal(method.Body.Variables) != local)
|
||||||
return null;
|
return null;
|
||||||
ret = DotNetUtils.getInstruction(instructions, ref index);
|
ret = DotNetUtils.getInstruction(instructions, ref index);
|
||||||
}
|
}
|
||||||
|
@ -592,9 +592,9 @@ namespace de4dot.code.renamer {
|
||||||
return null;
|
return null;
|
||||||
if (sig.Params.Count != 1)
|
if (sig.Params.Count != 1)
|
||||||
return null;
|
return null;
|
||||||
if (method.Body.LocalList.Count != 1)
|
if (method.Body.Variables.Count != 1)
|
||||||
return null;
|
return null;
|
||||||
if (!isEventHandlerType(method.Body.LocalList[0].Type))
|
if (!isEventHandlerType(method.Body.Variables[0].Type))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var instructions = method.Body.Instructions;
|
var instructions = method.Body.Instructions;
|
||||||
|
|
|
@ -405,7 +405,7 @@ namespace de4dot.code.renamer.asmmodules {
|
||||||
return;
|
return;
|
||||||
add(cb.Instructions);
|
add(cb.Instructions);
|
||||||
add(cb.ExceptionHandlers);
|
add(cb.ExceptionHandlers);
|
||||||
add(cb.LocalList);
|
add(cb.Variables);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(IEnumerable<Instruction> instrs) {
|
void add(IEnumerable<Instruction> instrs) {
|
||||||
|
|
2
dot10
2
dot10
|
@ -1 +1 @@
|
||||||
Subproject commit 9efe77cebda9b8d3b667fa6404c2805036b967cd
|
Subproject commit a3a732dde405752bcec85add1dad9e1fdc69b214
|
Loading…
Reference in New Issue
Block a user