From 1323edc7f559962fc7d53ffc94a9b22a4e9eeed7 Mon Sep 17 00:00:00 2001 From: Bitl Date: Mon, 27 Sep 2021 13:53:05 -0700 Subject: [PATCH] better security --- .../StorageAndFunctions/GlobalFuncs.cs | 71 ++++++++++--------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs index f66e4ad..92efea4 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs @@ -640,45 +640,48 @@ public class GlobalFuncs FileFormat.ClientInfo DefaultClientInfo = new FileFormat.ClientInfo(); bool placeholder = false; - string ClientName = ""; + if (GlobalVars.AdminMode) + { + string ClientName = ""; - if (File.Exists(path + "\\RobloxApp_client.exe")) - { - ClientName = "\\RobloxApp_client.exe"; - } - else if (File.Exists(path + "\\RobloxApp.exe")) - { - ClientName = "\\RobloxApp.exe"; - DefaultClientInfo.LegacyMode = true; - } - else - { - IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation."); - throw clientNotFoundEX; - } + if (File.Exists(path + "\\RobloxApp_client.exe")) + { + ClientName = "\\RobloxApp_client.exe"; + } + else if (File.Exists(path + "\\RobloxApp.exe")) + { + ClientName = "\\RobloxApp.exe"; + DefaultClientInfo.LegacyMode = true; + } + else + { + IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation."); + throw clientNotFoundEX; + } - string ClientMD5 = File.Exists(path + ClientName) ? SecurityFuncs.GenerateMD5(path + ClientName) : ""; + string ClientMD5 = File.Exists(path + ClientName) ? SecurityFuncs.GenerateMD5(path + ClientName) : ""; - if (!string.IsNullOrWhiteSpace(ClientMD5)) - { - DefaultClientInfo.ClientMD5 = ClientMD5.ToUpper(CultureInfo.InvariantCulture); - } - else - { - IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation."); - throw clientNotFoundEX; - } + if (!string.IsNullOrWhiteSpace(ClientMD5)) + { + DefaultClientInfo.ClientMD5 = ClientMD5.ToUpper(CultureInfo.InvariantCulture); + } + else + { + IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation."); + throw clientNotFoundEX; + } - string ClientScriptMD5 = File.Exists(path + "\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") ? SecurityFuncs.GenerateMD5(path + "\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : ""; + string ClientScriptMD5 = File.Exists(path + "\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") ? SecurityFuncs.GenerateMD5(path + "\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : ""; - if (!string.IsNullOrWhiteSpace(ClientScriptMD5)) - { - DefaultClientInfo.ScriptMD5 = ClientScriptMD5.ToUpper(CultureInfo.InvariantCulture); - } - else - { - IOException clientNotFoundEX = new IOException("Could not find script file for MD5 generation."); - throw clientNotFoundEX; + if (!string.IsNullOrWhiteSpace(ClientScriptMD5)) + { + DefaultClientInfo.ScriptMD5 = ClientScriptMD5.ToUpper(CultureInfo.InvariantCulture); + } + else + { + IOException clientNotFoundEX = new IOException("Could not find script file for MD5 generation."); + throw clientNotFoundEX; + } } string desc = "This client information file for '" + GlobalVars.UserConfiguration.SelectedClient +