unreliablecode / Unity-AntiModLoader
Қоғамдық
Lightweight Unity C# module detecting unauthorized mod loader frameworks (MelonLoader & BepInEx) via runtime filesystem and proxy DLL heuristic checks.
main
1 Жұлдыздар
0 Шанышқылар
0 Бақылаушылар
Жаңартылған Aug 19, 2024
C#
100%
Код
Мәселелер
Сұрауларды тарту 0
Міндеттеме береді
Филиалдар
Тегтер
Шығарылымдар
Іздеу
Қатысушылар
Wiki
Түсініктер
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System;
using System.IO;
using UnityAntiModLoader.Models;
namespace UnityAntiModLoader.Detectors
{
public static class BepInExDetector
{
// Known BepInEx directory structures
private static readonly string[] s_KnownDirectories = new string[]
{
"BepInEx",
"BepInEx/core",
"BepInEx/plugins",
"BepInEx/patchers",
"BepInEx/config"
};
// Known BepInEx binaries and proxy DLLs
private static readonly string[] s_KnownFiles = new string[]
{
"doorstop_config.ini",
"winhttp.dll",
"doorstop_version.txt",
"BepInEx/core/BepInEx.dll",
"BepInEx/core/BepInEx.Core.dll",
"BepInEx/core/0Harmony.dll",
"BepInEx/core/0Harmony20.dll",
"BepInEx/core/Mono.Cecil.dll",
"BepInEx/core/BepInEx.Preloader.dll",
"BepInEx/LogOutput.log"
};
/// <summary>
/// Scans the game directory for BepInEx mod loader artifacts.
/// </summary>
/// <param name="gameRootDirectory">Base path of the game executable.</param>
/// <returns>ModDetectionResult with detected files and directories.</returns>
public static ModDetectionResult Scan(string gameRootDirectory)
{
var result = new ModDetectionResult
{
FrameworkName = "BepInEx",
DetectionTimestamp = DateTime.UtcNow
};
if (string.IsNullOrEmpty(gameRootDirectory) || !Directory.Exists(gameRootDirectory))
{
return result;
}
// 1. Check for known BepInEx directories
foreach (string relDir in s_KnownDirectories)
{
string fullDirPath = Path.Combine(gameRootDirectory, relDir);
try
{
if (Directory.Exists(fullDirPath))
{
result.DetectedArtifacts.Add($"Directory: {relDir}");
}
}
catch
{
// Ignore filesystem access exceptions
}
}
// 2. Check for known BepInEx files & proxy loaders
foreach (string relFile in s_KnownFiles)
{
string fullFilePath = Path.Combine(gameRootDirectory, relFile);
try
{
if (File.Exists(fullFilePath))
{
result.DetectedArtifacts.Add($"File: {relFile}");
}
}
catch
{
// Ignore filesystem access exceptions
}
}
// Evaluate severity
if (result.DetectedArtifacts.Count > 0)
{
result.Severity = result.DetectedArtifacts.Count >= 2 ? DetectionSeverity.Critical : DetectionSeverity.High;
}
return result;
}
}
}