Advertisement
Guest User

class Authentication

a guest
Jan 24th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. // ☺ Created by Mohamed L. Tommi
  2. // ☺ Copyright © 2010 - 2016 TQ Digital
  3. // ☺ Test Conquer - Project
  4.  
  5. using System;
  6. using System.IO;
  7. using System.Text;
  8. using Conquer_Online_Server.Network.Cryptography;
  9.  
  10. namespace Conquer_Online_Server.Network.AuthPackets
  11. {
  12. public unsafe class Authentication : Interfaces.IPacket
  13. {
  14. public string Password, Username, Server, MacAddress;
  15. public Authentication()
  16. {
  17. }
  18. public byte[] ToArray()
  19. {
  20. throw new NotImplementedException();
  21. }
  22. public void Deserialize(byte[] buffer)
  23. {
  24. if (buffer.Length == 312)
  25. {
  26. ushort length = BitConverter.ToUInt16(buffer, 0);
  27. if (length == 312)
  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. BR.ReadUInt16();
  36. BR.ReadUInt16();
  37. Username = Encoding.Default.GetString(BR.ReadBytes(32));
  38. Username = Username.Replace("\0", "");
  39. BR.ReadBytes(37);
  40. byte[] PasswordArray = BR.ReadBytes(32);
  41. Password = Encoding.Default.GetString(PasswordArray);
  42. LoaderEncryption.Decrypt(PasswordArray);
  43. Password = Encoding.Default.GetString(PasswordArray);
  44. Password = Password.Replace("\0", "");
  45. BR.ReadBytes(31);
  46. Server = Encoding.Default.GetString(BR.ReadBytes(16));
  47. Server = Server.Replace("\0", "");
  48. //Console.WriteLine("password:" + Password);
  49. BR.Close();
  50. MS.Close();
  51. }
  52. }
  53. }
  54. }
  55. public void Send(Client.GameState client)
  56. {
  57. throw new NotImplementedException();
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement