Advertisement
Guest User

Untitled

a guest
Jan 30th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. // Created by Mostafa Shalby (COServer)
  2.  
  3. using Conquer_Online_Server.Network.Cryptography;
  4. using System;
  5. using System.IO;
  6. using System.Text;
  7.  
  8. namespace Conquer_Online_Server.Network.AuthPackets
  9. {
  10. public unsafe class Authentication : Interfaces.IPacket
  11. {
  12. public string Username;
  13. public string Password;
  14. public string Server;
  15.  
  16.  
  17. public Authentication()
  18. {
  19. }
  20. public void Deserialize(byte[] buffer)
  21. {
  22. if (buffer.Length == 312)
  23. {
  24. ushort length = BitConverter.ToUInt16(buffer, 0);
  25.  
  26. if (length == 312)
  27. {
  28.  
  29. ushort type = BitConverter.ToUInt16(buffer, 2);
  30. byte[] temp = new byte[16];
  31. if (type == 1542)
  32. {
  33. MemoryStream MS = new MemoryStream(buffer);
  34. BinaryReader BR = new BinaryReader(MS);
  35.  
  36. BR.ReadUInt16();
  37. BR.ReadUInt16();
  38. Username = Encoding.Default.GetString(BR.ReadBytes(32));
  39. Username = Username.Replace("\0", "");
  40. BR.ReadBytes(36);
  41. var PasswordArray = BR.ReadBytes(32);
  42. LoaderEncryption.Decrypt(PasswordArray, 32);
  43. Password = Encoding.Default.GetString(PasswordArray);
  44. Password = Password.Replace("\0", "");
  45. BR.ReadBytes(32);
  46. Server = Encoding.Default.GetString(BR.ReadBytes(32));
  47. Server = Server.Replace("\0", "");
  48. BR.Close();
  49. MS.Close();
  50. }
  51. }
  52. }
  53. }
  54.  
  55. public byte[] ToArray()
  56. {
  57. throw new NotImplementedException();
  58. }
  59. public void Send(Client.GameState client)
  60. {
  61. throw new NotImplementedException();
  62. }
  63. }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement