diff --git a/Server/AuthSession.cs b/Server/AuthSession.cs index d5aee69..0d732d7 100644 --- a/Server/AuthSession.cs +++ b/Server/AuthSession.cs @@ -1,5 +1,4 @@ -using System.Security.Cryptography; -using System.Text; +using System.Text; using MassTransit.Mediator; using Microsoft.Extensions.Logging; using NetCoreServer; @@ -21,37 +20,19 @@ public abstract class AuthSession : TcpSession protected override void OnReceived(byte[] buffer, long offset, long size) { Console.WriteLine($"Length: {size} & offset: {offset}"); - //Console.WriteLine(BitConverter.ToString(buffer.ToArray()).Replace("-", string.Empty)); Span decryptedBuffer = new byte[size]; - // xor every value after the first 8 bytes - // then apply AES decryption var dataBuffer = Decrypt(new ArraySegment(buffer, 8, (int)size - 8).ToArray()); - /*using (var ms = new MemoryStream(dataBuffer)) - using (var cs = new CryptoStream(ms, _decryptor, CryptoStreamMode.Read)) - { - cs.Read(decryptedBuffer); - }*/ - Console.WriteLine("Length " + BitConverter.ToUInt16(buffer, 0)); var opCode = BitConverter.ToUInt16(buffer.ToArray(), 2); Console.WriteLine("Packet Op Code: " + opCode); Console.WriteLine("Some Value: " + buffer[4]); - /* - * 20s = 5 - * 15s = 4 - * 10s = 3 - * - * client alive time * 5s => uptime - */ var clientAliveTime = BitConverter.ToUInt16(buffer.ToArray(), 5); Console.WriteLine("Client Alive time: " + clientAliveTime); Console.WriteLine("Might be a flag:" + buffer[7]); - Console.WriteLine("username: " + Encoding.ASCII.GetString(dataBuffer.ToArray(), 0, 20)); - Console.WriteLine("password: " + Encoding.ASCII.GetString(dataBuffer.ToArray(), 20, 32)); Console.WriteLine("Full buffer: " + Encoding.ASCII.GetString(dataBuffer.ToArray())); RawPacket rawPacket = new RawPacket((OperationCode)opCode, dataBuffer, clientAliveTime, buffer[0], diff --git a/Server/Packets/RawPacket.cs b/Server/Packets/RawPacket.cs index fa84014..7273dbd 100644 --- a/Server/Packets/RawPacket.cs +++ b/Server/Packets/RawPacket.cs @@ -23,6 +23,12 @@ public class RawPacket SessionId = sessionId; Session = session; OperationCode = operationCode; + /* + * 20s = 5 + * 15s = 4 + * 10s = 3 + * client alive time * 5s => uptime + */ ClientAliveTime = TimeSpan.FromSeconds(5 * aliveTime); } } \ No newline at end of file diff --git a/Server/Services/WonderkingAuthServer.cs b/Server/Services/WonderkingAuthServer.cs index e1fefa3..0aa46dd 100644 --- a/Server/Services/WonderkingAuthServer.cs +++ b/Server/Services/WonderkingAuthServer.cs @@ -1,7 +1,5 @@ using System.Net; using System.Net.Sockets; -using MassTransit; -using MassTransit.Mediator; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging;