initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using dnlib.DotNet;
|
||||
using dnlib.DotNet.Emit;
|
||||
using Obfuscator.Helper;
|
||||
|
||||
namespace Obfuscator.Obfuscator.Mutation2;
|
||||
|
||||
public class CharMutations : iMutation
|
||||
{
|
||||
public MethodDef Converter { get; set; }
|
||||
|
||||
public void Prepare(TypeDef type)
|
||||
{
|
||||
MethodDef methodDef = ModuleDefMD.Load(typeof(FuncMutation).Module).ResolveTypeDef(MDToken.ToRID(typeof(FuncMutation).MetadataToken)).FindMethod("CharToInt");
|
||||
methodDef.Name = Methods.GenerateString();
|
||||
methodDef.DeclaringType = null;
|
||||
type.Methods.Add(methodDef);
|
||||
Converter = methodDef;
|
||||
}
|
||||
|
||||
public void Process(MethodDef method, ref int index)
|
||||
{
|
||||
method.Body.Instructions.Insert(++index, new Instruction(OpCodes.Call, Converter));
|
||||
}
|
||||
|
||||
public bool Supported(Instruction instr)
|
||||
{
|
||||
return Utils.CheckArithmetic(instr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user