better security

This commit is contained in:
Bitl 2021-09-27 13:53:05 -07:00
parent 141f00843a
commit 1323edc7f5
1 changed files with 37 additions and 34 deletions

View File

@ -640,45 +640,48 @@ public class GlobalFuncs
FileFormat.ClientInfo DefaultClientInfo = new FileFormat.ClientInfo(); FileFormat.ClientInfo DefaultClientInfo = new FileFormat.ClientInfo();
bool placeholder = false; bool placeholder = false;
string ClientName = ""; if (GlobalVars.AdminMode)
{
string ClientName = "";
if (File.Exists(path + "\\RobloxApp_client.exe")) if (File.Exists(path + "\\RobloxApp_client.exe"))
{ {
ClientName = "\\RobloxApp_client.exe"; ClientName = "\\RobloxApp_client.exe";
} }
else if (File.Exists(path + "\\RobloxApp.exe")) else if (File.Exists(path + "\\RobloxApp.exe"))
{ {
ClientName = "\\RobloxApp.exe"; ClientName = "\\RobloxApp.exe";
DefaultClientInfo.LegacyMode = true; DefaultClientInfo.LegacyMode = true;
} }
else else
{ {
IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation."); IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation.");
throw clientNotFoundEX; 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)) if (!string.IsNullOrWhiteSpace(ClientMD5))
{ {
DefaultClientInfo.ClientMD5 = ClientMD5.ToUpper(CultureInfo.InvariantCulture); DefaultClientInfo.ClientMD5 = ClientMD5.ToUpper(CultureInfo.InvariantCulture);
} }
else else
{ {
IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation."); IOException clientNotFoundEX = new IOException("Could not find client exe for MD5 generation.");
throw clientNotFoundEX; 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)) if (!string.IsNullOrWhiteSpace(ClientScriptMD5))
{ {
DefaultClientInfo.ScriptMD5 = ClientScriptMD5.ToUpper(CultureInfo.InvariantCulture); DefaultClientInfo.ScriptMD5 = ClientScriptMD5.ToUpper(CultureInfo.InvariantCulture);
} }
else else
{ {
IOException clientNotFoundEX = new IOException("Could not find script file for MD5 generation."); IOException clientNotFoundEX = new IOException("Could not find script file for MD5 generation.");
throw clientNotFoundEX; throw clientNotFoundEX;
}
} }
string desc = "This client information file for '" + GlobalVars.UserConfiguration.SelectedClient + string desc = "This client information file for '" + GlobalVars.UserConfiguration.SelectedClient +