// Decompiled with JetBrains decompiler // Type: MindLated.Protection.CtrlFlow.BlockParser // Assembly: Server, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: 33673F0A-7F43-4A2B-BC08-8E59A15CB7DA // Assembly location: C:\Users\Admin\Desktop\Sheet RAT 2.5\Server.exe using dnlib.DotNet; using dnlib.DotNet.Emit; using System.Collections.Generic; //#nullable disable namespace MindLated.Protection.CtrlFlow { public class BlockParser { public static List ParseMethod(MethodDef method) { List method1 = new List(); Block block1 = new Block(); int num1 = 0; int num2 = 0; block1.Number = num1; block1.Instructions.Add(Instruction.Create(OpCodes.Nop)); method1.Add(block1); Block block2 = new Block(); Stack exceptionHandlerStack = new Stack(); foreach (Instruction instruction in (IEnumerable) method.Body.Instructions) { foreach (ExceptionHandler exceptionHandler in (IEnumerable) method.Body.ExceptionHandlers) { if (exceptionHandler.HandlerStart == instruction || exceptionHandler.TryStart == instruction || exceptionHandler.FilterStart == instruction) exceptionHandlerStack.Push(exceptionHandler); } foreach (ExceptionHandler exceptionHandler in (IEnumerable) method.Body.ExceptionHandlers) { if (exceptionHandler.HandlerEnd == instruction || exceptionHandler.TryEnd == instruction) exceptionHandlerStack.Pop(); } int pushes; int pops; instruction.CalculateStackUsage(out pushes, out pops); block2.Instructions.Add(instruction); num2 += pushes - pops; if (pushes == 0 && instruction.OpCode != OpCodes.Nop && (num2 == 0 || instruction.OpCode == OpCodes.Ret) && exceptionHandlerStack.Count == 0) { block2.Number = ++num1; method1.Add(block2); block2 = new Block(); } } return method1; } } }