Advertisement
Guest User

Untitled

a guest
Dec 17th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Text;
  4. using Conquer_Online_Server.Network.Cryptography;
  5.  
  6. namespace Conquer_Online_Server.Network.AuthPackets
  7. {
  8. public 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. BR.ReadUInt16();
  34. BR.ReadUInt16();
  35. Username = Encoding.Default.GetString(BR.ReadBytes(32));
  36. Username = Username.Replace("\0", "");
  37. BR.ReadBytes(37);
  38. byte[] PasswordArray = BR.ReadBytes(32);
  39. Password = Encoding.Default.GetString(PasswordArray);
  40. LoaderEncryption.Decrypt(PasswordArray);
  41. Password = Encoding.Default.GetString(PasswordArray);
  42. Password = Password.Replace("\0", "");
  43. BR.ReadBytes(31);
  44. Server = Encoding.Default.GetString(BR.ReadBytes(16));
  45. Server = Server.Replace("\0", "");
  46. //Console.WriteLine("password:" + Password);
  47. BR.Close();
  48. MS.Close();
  49. }
  50. }
  51. }
  52. }
  53.  
  54. public byte[] ToArray()
  55. {
  56. throw new NotImplementedException();
  57. }
  58. public void Send(Client.GameState client)
  59. {
  60. throw new NotImplementedException();
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement