public static bool VerifySteamHash(string executablePath) { //Get Steam_api.dll from (parent)filepath\Among Us_Data\Plugins\x86\steam_api.dll and steam_api64.dll var baseDllFolder = Path.Join(Directory.GetParent(executablePath).FullName, "\\Among Us_Data\\Plugins\\x86\\"); var steam_apiCert = AuthenticodeTools.IsTrusted(Path.Join(baseDllFolder, "steam_api.dll")); var steam_api64Cert = AuthenticodeTools.IsTrusted(Path.Join(baseDllFolder, "steam_api64.dll")); //Settings.conInterface.WriteModuleTextColored("GameVerifier",Color.Yellow,$"steam_apiCert: {steam_apiCert}"); //Settings.conInterface.WriteModuleTextColored("GameVerifier",Color.Yellow,$"steam_api64Cert: {steam_api64Cert}"); return((steam_apiCert) && (steam_api64Cert)); }
public static bool VerifySteamHash(string executablePath) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { //Get Steam_api.dll from (parent)filepath\Among Us_Data\Plugins\x86\steam_api.dll and steam_api64.dll var baseDllFolder = Path.Join(Directory.GetParent(executablePath).FullName, "/Among Us_Data/Plugins/x86/"); var steam_apiCert = AuthenticodeTools.IsTrusted(Path.Join(baseDllFolder, "steam_api.dll")); var steam_api64Cert = AuthenticodeTools.IsTrusted(Path.Join(baseDllFolder, "steam_api64.dll")); //Settings.conInterface.WriteModuleTextColored("GameVerifier",Color.Yellow,$"steam_apiCert: {steam_apiCert}"); //Settings.conInterface.WriteModuleTextColored("GameVerifier",Color.Yellow,$"steam_api64Cert: {steam_api64Cert}"); return((steam_apiCert) && (steam_api64Cert)); } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { var baseDllFolder = Path.Join(Directory.GetParent(executablePath).FullName, "/Among Us_Data/Plugins/x86/"); var steam_apiPath = Path.Join(baseDllFolder, "steam_api.dll"); var steam_api64Path = Path.Join(baseDllFolder, "steam_api64.dll"); var steam_apiHash = String.Empty; var steam_api64Hash = String.Empty; using (SHA1Managed sha1 = new SHA1Managed()) { using (FileStream fs = new FileStream(steam_apiPath, FileMode.Open)) { using (var bs = new BufferedStream(fs)) { var hash = sha1.ComputeHash(bs); StringBuilder steam_apihashSb = new StringBuilder(2 * hash.Length); foreach (byte byt in hash) { steam_apihashSb.AppendFormat("{0:X2}", byt); } steam_apiHash = steam_apihashSb.ToString(); } } using (FileStream fs = new FileStream(steam_api64Path, FileMode.Open)) { using (var bs = new BufferedStream(fs)) { var hash = sha1.ComputeHash(bs); StringBuilder steam_api64hashSb = new StringBuilder(2 * hash.Length); foreach (byte byt in hash) { steam_api64hashSb.AppendFormat("{0:X2}", byt); } steam_api64Hash = steam_api64hashSb.ToString(); } } } return(String.Equals(steamapi32_orig_hash.ToUpper(), steam_apiHash) && String.Equals(steamapi64_orig_hash.ToUpper(), steam_api64Hash)); } throw new PlatformNotSupportedException(); }