Files
2026-08-27 11:21:58 -06:00

28 lines
776 B
C#

using dnlib.DotNet;
using dnlib.DotNet.Emit;
using Obfuscator.Helper;
namespace Obfuscator.Obfuscator.Mutation2;
public class Sub : iMutation
{
public void Prepare(TypeDef type)
{
}
public void Process(MethodDef method, ref int index)
{
int ldcI4Value = method.Body.Instructions[index].GetLdcI4Value();
int num = Methods.Random.Next((int)((double)ldcI4Value / 1.5));
method.Body.Instructions[index].OpCode = OpCodes.Ldc_I4;
method.Body.Instructions[index].Operand = ldcI4Value + num;
method.Body.Instructions.Insert(++index, new Instruction(OpCodes.Ldc_I4, num));
method.Body.Instructions.Insert(++index, new Instruction(OpCodes.Sub));
}
public bool Supported(Instruction instr)
{
return Utils.CheckArithmetic(instr);
}
}