-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathAntiTamper.cs
51 lines (50 loc) · 1.29 KB
/
AntiTamper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using dnlib.DotNet;
using dnlib.DotNet.Emit;
namespace BabelDeobfuscator.Protections
{
internal class AntiTamper
{
public static void AntiTamp(ModuleDefMD module)
{
foreach (TypeDef typeDef in module.GetTypes())
{
foreach (MethodDef methodDef in typeDef.Methods)
{
bool flag = !methodDef.HasBody;
bool flag2 = !flag;
if (flag2)
{
bool flag3 = methodDef.Body.Instructions.Count != 3;
bool flag4 = !flag3;
if (flag4)
{
bool flag5 = methodDef.Body.Instructions[0].OpCode != OpCodes.Ldnull;
bool flag6 = !flag5;
if (flag6)
{
bool flag7 = methodDef.Body.Instructions[1].OpCode != OpCodes.Call;
bool flag8 = !flag7;
if (flag8)
{
bool flag9 = methodDef.Body.Instructions[2].OpCode != OpCodes.Ret;
bool flag10 = !flag9;
if (flag10)
{
bool flag11 = !methodDef.Body.Instructions[1].Operand.ToString().Contains("FailFast");
bool flag12 = !flag11;
if (flag12)
{
methodDef.Body.Instructions[0].OpCode = OpCodes.Nop;
methodDef.Body.Instructions[1].OpCode = OpCodes.Nop;
}
}
}
}
}
}
}
}
}
}
}