Advertisement
Guest User

Untitled

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