Repository navigation
Expand file tree
/
Copy pathRenameProtector.cs
More file actions
52 lines (50 loc) · 1.7 KB
/
Copy pathRenameProtector.cs
File metadata and controls
52 lines (50 loc) · 1.7 KB
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
52
using System;
using System.Linq;
using dnlib.DotNet;
static class RenameProtector
{
public static int count_xxx = 0;
public static void Execute(ModuleDef module)
{
module.Name = "YOUTUBE .NET OBFUSCATED";
foreach (TypeDef type in module.Types)
{
if (type.IsGlobalModuleType || type.IsRuntimeSpecialName || type.IsSpecialName || type.IsWindowsRuntime || type.IsInterface)
continue;
else
{
count_xxx += 1;
type.Name = RandomString(40);
type.Namespace = "";
foreach (PropertyDef property in type.Properties)
{
count_xxx += 1;
property.Name = RandomString(40);
}
foreach (FieldDef fields in type.Fields)
{
count_xxx += 1;
fields.Name = RandomString(40);
}
foreach (EventDef eventdef in type.Events)
{
count_xxx += 1;
eventdef.Name = RandomString(40);
}
foreach (MethodDef method in type.Methods)
{
if (method.IsConstructor) continue;
count_xxx += 1;
method.Name = RandomString(40);
}
}
}
}
private static Random random = new Random();
public static string RandomString(int length)
{
const string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[random.Next(s.Length)]).ToArray());
}
}