diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs index 4a44dde..3e7c91a 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs @@ -9,6 +9,7 @@ using System.Drawing; using System.Drawing.Imaging; using System.Globalization; using System.IO; +using System.Linq; using System.Net; using System.Reflection; using System.Text; @@ -223,7 +224,7 @@ public class GlobalFuncs if (string.IsNullOrWhiteSpace(SecurityFuncs.Base64Decode(tripcode))) { - GenerateTripcode(); + GlobalVars.UserConfiguration.PlayerTripcode = GenerateAndReturnTripcode(); Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true); } else @@ -1085,7 +1086,7 @@ public class GlobalFuncs GlobalVars.UserConfiguration.LauncherStyle = style; #endif GeneratePlayerID(); - GenerateTripcode(); + GlobalVars.UserConfiguration.PlayerTripcode = GlobalFuncs.GenerateAndReturnTripcode(); ResetCustomizationValues(); } @@ -1284,15 +1285,9 @@ public class GlobalFuncs GlobalVars.UserConfiguration.UserID = randomID; } - public static void GenerateTripcode() - { - GlobalVars.UserConfiguration.PlayerTripcode = SecurityFuncs.RandomString(); - } - public static string GenerateAndReturnTripcode() { - GenerateTripcode(); - return GlobalVars.UserConfiguration.PlayerTripcode; + return SecurityFuncs.RandomString(20); } public static GlobalVars.LauncherState GetStateForType(ScriptType type) @@ -2013,60 +2008,87 @@ public class GlobalFuncs string args = ""; GlobalVars.ValidatedExtraFiles = 0; - if (!info.AlreadyHasSecurity && !GlobalVars.AdminMode) + if (!info.AlreadyHasSecurity) { - string validstart = ""; - string validend = ""; - - foreach (string line in info.CommandLineArgs.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) + Match match = Regex.Match(GlobalVars.UserConfiguration.PlayerTripcode, "[^a-zA-Z0-9]"); + if (match != Match.Empty || string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.PlayerTripcode)) { - if (line.Contains(validstart) && line.Contains(validend)) - { - string extractedFile = ScriptFuncs.ClientScript.GetArgsFromTag(line, validstart, validend); - if (!string.IsNullOrWhiteSpace(extractedFile)) - { - try - { - string[] parsedFileParams = extractedFile.Split('|'); - string filePath = parsedFileParams[0]; - string fileMD5 = parsedFileParams[1]; - string fullFilePath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\" + filePath; - - if (!SecurityFuncs.CheckMD5(fileMD5, fullFilePath)) - { + MessageBox.Show(match.Captures.Count.ToString()); #if URI - if (label != null) - { - label.Text = "The client has been detected as modified."; - } + if (label != null) + { + label.Text = "The client has been detected as modified."; + } #elif LAUNCHER - if (box != null) - { - ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2, box); - } + if (box != null) + { + ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2, box); + } #elif CMD - ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2); + ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2); #endif #if URI || LAUNCHER - MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); #endif - return; - } - else - { - GlobalVars.ValidatedExtraFiles += 1; - } - } -#if URI || LAUNCHER || CMD || BASICLAUNCHER - catch (Exception ex) + return; + } + + if (!GlobalVars.AdminMode) + { + string validstart = ""; + string validend = ""; + + foreach (string line in info.CommandLineArgs.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) + { + if (line.Contains(validstart) && line.Contains(validend)) + { + string extractedFile = ScriptFuncs.ClientScript.GetArgsFromTag(line, validstart, validend); + if (!string.IsNullOrWhiteSpace(extractedFile)) { - LogExceptions(ex); + try + { + string[] parsedFileParams = extractedFile.Split('|'); + string filePath = parsedFileParams[0]; + string fileMD5 = parsedFileParams[1]; + string fullFilePath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\" + filePath; + + if (!SecurityFuncs.CheckMD5(fileMD5, fullFilePath)) + { +#if URI + if (label != null) + { + label.Text = "The client has been detected as modified."; + } +#elif LAUNCHER + if (box != null) + { + ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2, box); + } +#elif CMD + ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2); +#endif + +#if URI || LAUNCHER + MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); +#endif + return; + } + else + { + GlobalVars.ValidatedExtraFiles += 1; + } + } +#if URI || LAUNCHER || CMD || BASICLAUNCHER + catch (Exception ex) + { + LogExceptions(ex); #else catch (Exception) { #endif - continue; + continue; + } } } } @@ -2196,7 +2218,7 @@ public class GlobalFuncs GlobalVars.ValidatedExtraFiles = 0; } -#if URI || LAUNCHER || CMD || BASICLAUNCHER +#if URI || LAUNCHER || CMD || BASICLAUNCHER catch (Exception ex) #else catch (Exception) diff --git a/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs index ab9c966..35588af 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs @@ -27,11 +27,6 @@ public class SecurityFuncs return new string(Enumerable.Repeat(chars, length) .Select(s => s[random.Next(s.Length)]).ToArray()); } - - public static string RandomString() - { - return RandomString(20); - } //these 2 methods are for the clientinfo creator. public static string Base64DecodeNew(string base64EncodedData) diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs index da8e3ed..382510c 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs @@ -1022,7 +1022,7 @@ namespace NovetusLauncher public void GenerateTripcode() { - GlobalFuncs.GenerateTripcode(); + GlobalVars.UserConfiguration.PlayerTripcode = GlobalFuncs.GenerateAndReturnTripcode(); PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode; } diff --git a/changelog.txt b/changelog.txt index e370440..32e49c8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -29,6 +29,7 @@ Fixes: - Fixed the Stylish interface not showing a warning when hosting a seperate master server. - Fixed the Stylish interface not pinging the master server. - Fixed some clients not functioning properly with Wine (Credits to man-of-eel in pull request #27). +- Fixed small issues with tripcodes. ---------------------------------------------------------------------------- 1.3 v11.2021.1 Changes from Pre-Release 5: diff --git a/scripts/game/2007E-Shaders/CSMPFunctions.lua b/scripts/game/2007E-Shaders/CSMPFunctions.lua index 8b025eb..6cc27e6 100644 --- a/scripts/game/2007E-Shaders/CSMPFunctions.lua +++ b/scripts/game/2007E-Shaders/CSMPFunctions.lua @@ -126,7 +126,7 @@ function LoadCharacterNew(playerApp,newChar) end end -function InitalizeClientAppearance(Player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID,TShirtTexID) +function InitalizeClientAppearance(Player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID) local newCharApp = Instance.new("IntValue",Player) newCharApp.Name = "Appearance" --BODY COLORS @@ -183,13 +183,6 @@ function InitalizeClientAppearance(Player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,Torso newTShirt.Value = "NoTShirt.rbxm" end newTShirt.Name = "T-Shirt" - local newTShirtTexID = Instance.new("StringValue",newTShirt) - if (TShirtTexID ~= nil) then - newTShirtTexID.Value = TShirtTexID - else - newTShirtTexID.Value = "" - end - newTShirtTexID.Name = "Texture" --EXTRA local newItem = Instance.new("StringValue",newCharApp) if (ItemID ~= nil) then @@ -371,7 +364,7 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti pcall(function() game.Close:connect(function() Server:stop() end) end) end -function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Tripcode,VerifiedScripts,TShirtTexID,Ticket) +function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Tripcode,VerifiedScripts,Ticket) local suc, err = pcall(function() client = game:service("NetworkClient") player = game:service("Players"):createLocalPlayer(UserID) @@ -383,7 +376,7 @@ function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,He player:SetAdminMode(true) pcall(function() player.Name=PlayerName or "" end) game:service("Visit"):setUploadUrl("") - InitalizeClientAppearance(player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID,TShirtTexID) + InitalizeClientAppearance(player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID) end) local function dieerror(errmsg) @@ -443,14 +436,14 @@ function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,He end end -function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID,TShirtTexID) +function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID) game:service("RunService"):run() local plr = game.Players:createLocalPlayer(UserID) game.Workspace:insertContent("rbxasset://Fonts//libraries.rbxm") plr.Name = PlayerName plr:SetAdminMode(true) plr:LoadCharacter() - InitalizeClientAppearance(plr,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID,TShirtTexID) + InitalizeClientAppearance(plr,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID) LoadCharacterNew(newWaitForChild(plr,"Appearance"),plr.Character,false) game:service("Visit"):setUploadUrl("") while true do diff --git a/scripts/game/2007E/CSMPFunctions.lua b/scripts/game/2007E/CSMPFunctions.lua index 8b025eb..6cc27e6 100644 --- a/scripts/game/2007E/CSMPFunctions.lua +++ b/scripts/game/2007E/CSMPFunctions.lua @@ -126,7 +126,7 @@ function LoadCharacterNew(playerApp,newChar) end end -function InitalizeClientAppearance(Player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID,TShirtTexID) +function InitalizeClientAppearance(Player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID) local newCharApp = Instance.new("IntValue",Player) newCharApp.Name = "Appearance" --BODY COLORS @@ -183,13 +183,6 @@ function InitalizeClientAppearance(Player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,Torso newTShirt.Value = "NoTShirt.rbxm" end newTShirt.Name = "T-Shirt" - local newTShirtTexID = Instance.new("StringValue",newTShirt) - if (TShirtTexID ~= nil) then - newTShirtTexID.Value = TShirtTexID - else - newTShirtTexID.Value = "" - end - newTShirtTexID.Name = "Texture" --EXTRA local newItem = Instance.new("StringValue",newCharApp) if (ItemID ~= nil) then @@ -371,7 +364,7 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti pcall(function() game.Close:connect(function() Server:stop() end) end) end -function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Tripcode,VerifiedScripts,TShirtTexID,Ticket) +function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Tripcode,VerifiedScripts,Ticket) local suc, err = pcall(function() client = game:service("NetworkClient") player = game:service("Players"):createLocalPlayer(UserID) @@ -383,7 +376,7 @@ function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,He player:SetAdminMode(true) pcall(function() player.Name=PlayerName or "" end) game:service("Visit"):setUploadUrl("") - InitalizeClientAppearance(player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID,TShirtTexID) + InitalizeClientAppearance(player,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID) end) local function dieerror(errmsg) @@ -443,14 +436,14 @@ function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,He end end -function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID,TShirtTexID) +function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID) game:service("RunService"):run() local plr = game.Players:createLocalPlayer(UserID) game.Workspace:insertContent("rbxasset://Fonts//libraries.rbxm") plr.Name = PlayerName plr:SetAdminMode(true) plr:LoadCharacter() - InitalizeClientAppearance(plr,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID,TShirtTexID) + InitalizeClientAppearance(plr,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID) LoadCharacterNew(newWaitForChild(plr,"Appearance"),plr.Character,false) game:service("Visit"):setUploadUrl("") while true do