Skip to content

Commit

Permalink
[+] Bypass Cake.dll hash check and SSL pinning (#63)
Browse files Browse the repository at this point in the history
* Bypass Cake.dll hash check and SSL pinning

* Move to BasicFix
  • Loading branch information
Menci authored Oct 13, 2024
1 parent 854b6b7 commit 9384d1d
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions AquaMai/Fix/BasicFix.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using HarmonyLib;
using System.Net;
using HarmonyLib;
using Manager;
using Monitor.MusicSelect.ChainList;
using Net;
Expand Down Expand Up @@ -55,11 +56,23 @@ private static bool CalcSpecialNum(ref int __result)
return false;
}

[HarmonyPrefix]
[HarmonyPatch(typeof(NetHttpClient), "CheckServerHash")]
private static bool CheckServerHash(ref bool __result)
[HarmonyPostfix]
[HarmonyPatch(typeof(NetHttpClient), MethodType.Constructor)]
private static void OnNetHttpClientConstructor(NetHttpClient __instance)
{
__result = true;
return false;
// Bypass Cake.dll hash check
var tInstance = Traverse.Create(__instance).Field("isTrueDll");
if (tInstance.FieldExists())
{
tInstance.SetValue(true);
}
}

[HarmonyPostfix]
[HarmonyPatch(typeof(NetHttpClient), "Create")]
private static void OnNetHttpClientCreate()
{
// Unset the certificate validation callback (SSL pinning) to restore the default behavior
ServicePointManager.ServerCertificateValidationCallback = null;
}
}

0 comments on commit 9384d1d

Please sign in to comment.