From 10e8797ba2fb0460b085b79c57ea44baadf0b531 Mon Sep 17 00:00:00 2001 From: zombieb Date: Sun, 21 Sep 2025 17:42:06 -0400 Subject: [PATCH] Internal add hash to login form for all logins, fix registration patch --- Core/PluginHash.cs | 14 ++++++++++++++ Patches/BestHTTP.cs | 2 -- Patches/Internals/LoginHelper.cs | 30 ++++++++++++++++++++++++++++++ Patches/Registration.cs | 15 ++++----------- 4 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 Core/PluginHash.cs create mode 100644 Patches/Internals/LoginHelper.cs diff --git a/Core/PluginHash.cs b/Core/PluginHash.cs new file mode 100644 index 0000000..f2b26d0 --- /dev/null +++ b/Core/PluginHash.cs @@ -0,0 +1,14 @@ +using System; +using System.IO; +using System.Reflection; +using System.Security.Cryptography; + +namespace undead_universal_patch_il2cpp.Core; + +public class PluginHash +{ + public static string GetHash() + { + return BitConverter.ToString(MD5.Create().ComputeHash(File.OpenRead(Assembly.GetExecutingAssembly().Location))).Replace("-", "").ToLowerInvariant(); + } +} \ No newline at end of file diff --git a/Patches/BestHTTP.cs b/Patches/BestHTTP.cs index 98ddff8..b39db29 100644 --- a/Patches/BestHTTP.cs +++ b/Patches/BestHTTP.cs @@ -1,8 +1,6 @@ using System; using System.Reflection; -using System.Security.Cryptography; using BestHTTP; -using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls; using HarmonyLib; using undead_universal_patch_il2cpp.Core; using undead_universal_patch_il2cpp.Core.Config; diff --git a/Patches/Internals/LoginHelper.cs b/Patches/Internals/LoginHelper.cs new file mode 100644 index 0000000..6df0b8b --- /dev/null +++ b/Patches/Internals/LoginHelper.cs @@ -0,0 +1,30 @@ +using BestHTTP.Forms; +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using undead_universal_patch_il2cpp.Core; + +namespace undead_universal_patch_il2cpp.Patches.Internals; + +[HarmonyPatch] +public class LoginHelperFieldsPatch +{ + static PatchTypesResult typesResult = Util.PreparePatchTypes( + "Add patch hash to the login form", + "RecNet.Login", + "LoginHelper" + ); + + static MethodBase TargetMethod() => typesResult.Method; + static bool Prepare() => typesResult.Success; + + static void Prefix(ref HTTPUrlEncodedForm loginParams) + { + loginParams.AddField("x-patch-plugin-hash", PluginHash.GetHash()); + Util.ConditionalDebug("Added hash to login form"); + } +} \ No newline at end of file diff --git a/Patches/Registration.cs b/Patches/Registration.cs index c6cbc9e..2ec0222 100644 --- a/Patches/Registration.cs +++ b/Patches/Registration.cs @@ -10,22 +10,15 @@ namespace undead_universal_patch_il2cpp.Patches { static PatchTypesResult patchResult = Util.ConfigPreparePatchTypes( PatchConfig.RegistrationPatch, - "Registration patch (to be vetted, might not work)", - "UnityEngine.PlayerPrefs", - "GetInt" + "Registration patch", + "ProfileWatchUIFlow", + "Button_Email" ); static bool Prepare() => patchResult.Success; static MethodInfo TargetMethod() => patchResult.Method; - static void Postfix(ref string key, ref int defaultValue, ref int __result) - { - if (key.StartsWith("IncompleteRegistration-")) - { - __result = 0; - UniversalPatchPlugin.Log.LogInfo("Detour'd IncompleteRegistration pref key"); - } - } + static bool Prefix() => false; } } \ No newline at end of file