From e2393ae1ed5684d1114a0ecd90564ca565bbb085 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Wed, 31 Jul 2024 01:29:53 -0500 Subject: [PATCH] platform spoofer detection --- BetterAmongUs.csproj | 4 ++++ Modules/AntiCheat.cs | 35 +++++++++++++++++++++++++++++++++++ main.cs | 5 ++++- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/BetterAmongUs.csproj b/BetterAmongUs.csproj index 28c3d0e..036d25f 100644 --- a/BetterAmongUs.csproj +++ b/BetterAmongUs.csproj @@ -30,4 +30,8 @@ + + + + diff --git a/Modules/AntiCheat.cs b/Modules/AntiCheat.cs index 67f0711..442e30b 100644 --- a/Modules/AntiCheat.cs +++ b/Modules/AntiCheat.cs @@ -1,4 +1,5 @@ using AmongUs.GameOptions; +using HarmonyLib; using Hazel; using InnerNet; @@ -25,6 +26,40 @@ class AntiCheat } } + [HarmonyPatch(typeof(PlatformSpecificData))] + class PlatformSpecificDataPatch + { + [HarmonyPatch(nameof(PlatformSpecificData.Deserialize))] + [HarmonyPostfix] + public static void Deserialize_Postfix(PlatformSpecificData __instance) + { + _ = new LateTask(() => + { + var player = Main.AllPlayerControls.FirstOrDefault(pc => pc.GetClient().PlatformData == __instance); + + if (player != null) + { + if (__instance.Platform is Platforms.StandaloneWin10 or Platforms.Xbox) + { + if (__instance.XboxPlatformId == 0) + { + BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); + } + } + + if (__instance.Platform is Platforms.Playstation) + { + if (__instance.PsnPlatformId == 0) + { + BetterNotificationManager.NotifyCheat(player, $"Platform Spoofer", newText: "Has been detected with a cheat"); + } + } + } + }, 1.5f, shoudLog: false); + } + } + + // Handle RPC before anti cheat detection public static void HandleRPCBeforeCheck(PlayerControl player, byte callId, MessageReader Oldreader) { diff --git a/main.cs b/main.cs index 9ff095e..d42263b 100644 --- a/main.cs +++ b/main.cs @@ -2,6 +2,7 @@ using BepInEx.Configuration; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; +using BetterAmongUs.Patches; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Innersloth.IO; @@ -21,7 +22,7 @@ public enum ReleaseTypes : int public class Main : BasePlugin { public const ReleaseTypes ReleaseBuildType = ReleaseTypes.Canary; - public const string CanaryNum = "4"; + public const string CanaryNum = "5"; public const string HotfixNum = "0"; public const bool IsHotFix = false; public const string PluginGuid = "com.d1gq.betteramongus"; @@ -124,6 +125,7 @@ public class Main : BasePlugin public static ConfigEntry AntiCheat { get; private set; } public static ConfigEntry BetterHost { get; private set; } + public static ConfigEntry ModdedProtocol { get; private set; } public static ConfigEntry BetterRoleAlgorithma { get; private set; } public static ConfigEntry LobbyPlayerInfo { get; private set; } public static ConfigEntry DisableLobbyTheme { get; private set; } @@ -134,6 +136,7 @@ public class Main : BasePlugin { AntiCheat = Config.Bind("Better Options", "AntiCheat", true); BetterHost = Config.Bind("Better Options", "BetterHost", false); + ModdedProtocol = Config.Bind("Better Options", "ModdedProtocol", false); BetterRoleAlgorithma = Config.Bind("Better Options", "BetterRoleAlgorithma", true); LobbyPlayerInfo = Config.Bind("Better Options", "LobbyPlayerInfo", true); DisableLobbyTheme = Config.Bind("Better Options", "DisableLobbyTheme", true);