38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
// Decompiled with JetBrains decompiler
|
|||
|
|
// Type: MindLated.Protection.CtrlFlow.JumpCFlow
|
||
|
|
// 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 MindLated.Protection.Renamer;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Linq;
|
||
|
|
|
||
|
|
//#nullable disable
|
||
|
|
namespace MindLated.Protection.CtrlFlow {
|
||
|
|
|
||
|
|
public static class JumpCFlow
|
||
|
|
{
|
||
|
|
public static void Execute(ModuleDefMD module)
|
||
|
|
{
|
||
|
|
foreach (TypeDef type in (IEnumerable<TypeDef>) module.Types)
|
||
|
|
{
|
||
|
|
foreach (MethodDef methodDef in type.Methods.ToArray<MethodDef>())
|
||
|
|
{
|
||
|
|
if (methodDef.HasBody && methodDef.Body.HasInstructions && !methodDef.Body.HasExceptionHandlers)
|
||
|
|
{
|
||
|
|
for (int index = 0; index < methodDef.Body.Instructions.Count - 2; index = index + 2 + 1)
|
||
|
|
{
|
||
|
|
Instruction instruction = methodDef.Body.Instructions[index + 1];
|
||
|
|
methodDef.Body.Instructions.Insert(index + 1, Instruction.Create(OpCodes.Ldstr, RenamerPhase.GenerateString(RenamerPhase.RenameMode.Ascii)));
|
||
|
|
methodDef.Body.Instructions.Insert(index + 1, Instruction.Create(OpCodes.Br_S, instruction));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|