From cd427045c2e65ad1c4d90af811d91dd19a74c4e0 Mon Sep 17 00:00:00 2001 From: Aragas Date: Tue, 6 Dec 2016 16:55:46 +0300 Subject: [PATCH] /login will send a password SHA512 hash instead of the password --- 2.5DHero/2.5DHero/Network/Servers/ServerConnection.vb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/2.5DHero/2.5DHero/Network/Servers/ServerConnection.vb b/2.5DHero/2.5DHero/Network/Servers/ServerConnection.vb index 53ca6eec3..2932c241b 100644 --- a/2.5DHero/2.5DHero/Network/Servers/ServerConnection.vb +++ b/2.5DHero/2.5DHero/Network/Servers/ServerConnection.vb @@ -1,6 +1,8 @@ Imports System.IO Imports System.Net.Sockets Imports System.Net +Imports System.Security.Cryptography +Imports System.Text Namespace Servers @@ -202,7 +204,12 @@ Namespace Servers End Sub Public Sub SendChatMessage(ByVal message As String) - If message.ToLower().StartsWith("/pm ") = True Then + If message.ToLower().StartsWith("/login ") = True Then + Dim password As String = message.Remove(0, 7) + Dim hashedPassword As String = BitConverter.ToString(new SHA512Managed().ComputeHash(Encoding.UTF8.GetBytes(password))).Replace("-", "").ToLower() + message = "/login " + hashedPassword + SendPackage(New Package(Package.PackageTypes.ChatMessage, Core.ServersManager.ID, Package.ProtocolTypes.TCP, message)) + Else If message.ToLower().StartsWith("/pm ") = True Then message = message.Remove(0, 4) Dim playerName As String = message While Core.ServersManager.PlayerCollection.HasPlayer(playerName) = False And playerName.Contains(" ") = True