public override int Excute(ModuleDef module) { int fixedProxy = 0; foreach (TypeDef tDef in module.Types) { foreach (MethodDef method in tDef.Methods) { if (!method.HasBody) { continue; } for (int i = 0; i < method.Body.Instructions.Count; i++) { if (method.Body.Instructions[i].Operand is MethodDef && method.Body.Instructions[i].OpCode == OpCodes.Call) { MethodDef opMethod = method.Body.Instructions[i].Operand as MethodDef; if (opMethod.Parameters.Count == 0) { List <Instruction> fixedMethod = noNop(opMethod); if (fixedMethod[0].IsLdcI4() && fixedMethod[1].Operand is MethodDef && fixedMethod[1].OpCode == OpCodes.Call) { MethodDef methodDef = fixedMethod[1].Operand as MethodDef; List <Instruction> fixedMethod_ = noNop(methodDef); if (fixedMethod_.Count == 8) { if (fixedMethod[0].IsLdcI4()) { //Console.Write(fixedMethod_.Count + " "); method.Body.Instructions[i].OpCode = perc((int)fixedMethod[0].Operand) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0; //method.Body.Instructions[i - 1].OpCode = OpCodes.Nop; fixedProxy++; DeobfTypes.Add(methodDef); DeobfTypes.Add(opMethod); } } } } } } } } return(fixedProxy); }
public override int Excute(ModuleDef module) { int fixedInteger = 0; foreach (TypeDef type in module.Types) { foreach (MethodDef method in type.Methods) { if (!method.HasBody) { continue; } for (int i = 0; i < method.Body.Instructions.Count; i++) { if (method.Body.Instructions[i].Operand is MethodDef && method.Body.Instructions[i].OpCode == OpCodes.Call) { try { MethodDef opMethod = method.Body.Instructions[i].Operand as MethodDef; if (opMethod.ReturnType != module.CorLibTypes.Int32) { continue; } Tuple <Instruction, Instruction> tuple = getValues(opMethod); if (tuple == null) { continue; } method.Body.Instructions[i].OpCode = OpCodes.Ldc_I4; method.Body.Instructions[i].Operand = getFixedValue(opMethod); //method.Body.Instructions[i - 1].OpCode = OpCodes.Nop; fixedInteger++; DeobfTypes.Add(opMethod); } catch { } } } } } return(fixedInteger); }
public override int Excute(ModuleDef module) { //Console.WriteLine(method.Name + " : " + method.DeclaringType.Name); int fixedProxy = 0; foreach (var tDef in module.Types) { foreach (MethodDef method in tDef.Methods) { if (!method.HasBody) { continue; } for (int i = 0; i < method.Body.Instructions.Count; i++) { if (method.Body.Instructions[i].Operand is MethodDef && method.Body.Instructions[i].OpCode == OpCodes.Call) { MethodDef opMethod = (MethodDef)method.Body.Instructions[i].Operand; if (opMethod.HasBody) { if (noNop(opMethod).Count == 2 || noNop(opMethod).Count == 4) { if (opMethod.ReturnType != opMethod.Module.CorLibTypes.Void) { Instruction newInstr = noNop(opMethod)[0]; if (newInstr.OpCode == OpCodes.Newobj || newInstr.IsLdcI4() || newInstr.OpCode == OpCodes.Ldstr || newInstr.OpCode == OpCodes.Ldc_I8 || newInstr.OpCode == OpCodes.Ldc_R4) { method.Body.Instructions[i].OpCode = newInstr.OpCode; method.Body.Instructions[i].Operand = newInstr.Operand; fixedProxy++; DeobfTypes.Add(opMethod); } } } } } } } } return(fixedProxy); }
public override int Excute(ModuleDef module) { int fixedString = 0; foreach (TypeDef type in module.Types) { foreach (MethodDef method in type.Methods) { if (!method.HasBody) { continue; } for (int i = 0; i < method.Body.Instructions.Count; i++) { if (method.Body.Instructions[i].Operand is MethodDef && method.Body.Instructions[i].OpCode == OpCodes.Call) { MethodDef opMethod = method.Body.Instructions[i].Operand as MethodDef; if (opMethod.Parameters.Count != 1) { continue; } Tuple <string, int> tuple = getValues(opMethod); if (tuple == null) { continue; } if (method.Body.Instructions[i - 1].IsLdcI4()) { bool b = (method.Body.Instructions[i - 1].GetLdcI4Value() == 1 ? true : false); method.Body.Instructions[i].OpCode = OpCodes.Ldstr; method.Body.Instructions[i].Operand = fixit(b, tuple.Item1, tuple.Item2); method.Body.Instructions[i - 1].OpCode = OpCodes.Nop; fixedString++; DeobfTypes.Add(opMethod); } } } } } return(fixedString); }
public override int Excute(ModuleDef module) { int fixedProxy = 0; foreach (TypeDef tDef in module.Types) { foreach (MethodDef method in tDef.Methods) { if (!method.HasBody) { continue; } for (int i = 0; i < method.Body.Instructions.Count; i++) { if (method.Body.Instructions[i].Operand is MethodDef && method.Body.Instructions[i].OpCode == OpCodes.Call) { MethodDef opMethod = method.Body.Instructions[i].Operand as MethodDef; if (opMethod.Parameters.Count == 1) { if (containsRound(opMethod)) { if (method.Body.Instructions[i - 1].IsLdcI4()) { method.Body.Instructions[i].OpCode = round((int)method.Body.Instructions[i - 1].Operand) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0; method.Body.Instructions[i - 1].OpCode = OpCodes.Nop; fixedProxy++; DeobfTypes.Add(opMethod); } } } } } } } return(fixedProxy); }