/login will send a password SHA512 hash instead of the password

This commit is contained in:
Aragas 2016-12-06 16:55:46 +03:00
parent 1f139dbae3
commit cd427045c2
1 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,8 @@
Imports System.IO Imports System.IO
Imports System.Net.Sockets Imports System.Net.Sockets
Imports System.Net Imports System.Net
Imports System.Security.Cryptography
Imports System.Text
Namespace Servers Namespace Servers
@ -202,7 +204,12 @@ Namespace Servers
End Sub End Sub
Public Sub SendChatMessage(ByVal message As String) 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) message = message.Remove(0, 4)
Dim playerName As String = message Dim playerName As String = message
While Core.ServersManager.PlayerCollection.HasPlayer(playerName) = False And playerName.Contains(" ") = True While Core.ServersManager.PlayerCollection.HasPlayer(playerName) = False And playerName.Contains(" ") = True