Session.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef SESSION_H
  2. #define SESSION_H
  3. #include <vector>
  4. #include <random>
  5. #include <memory>
  6. #include <functional>
  7. #include <climits>
  8. #include <algorithm>
  9. #include "Utils.h"
  10. #include "stdlib.h"
  11. #include "ShannonConnection.h"
  12. #include "LoginBlob.h"
  13. #include "ApResolve.h"
  14. #include "PlainConnection.h"
  15. #include "Packet.h"
  16. #include "ConstantParameters.h"
  17. #include "Crypto.h"
  18. #include "ProtoHelper.h"
  19. #define SPOTIFY_VERSION 0x10800000000
  20. #define LOGIN_REQUEST_COMMAND 0xAB
  21. #define AUTH_SUCCESSFUL_COMMAND 0xAC
  22. #define AUTH_DECLINED_COMMAND 0xAD
  23. class Session
  24. {
  25. private:
  26. ClientResponseEncrypted authRequest;
  27. ClientResponsePlaintext clientResPlaintext;
  28. ClientHello clientHello;
  29. APResponseMessage apResponse;
  30. std::shared_ptr<PlainConnection> conn;
  31. std::unique_ptr<Crypto> crypto;
  32. std::vector<uint8_t> sendClientHelloRequest();
  33. void processAPHelloResponse(std::vector<uint8_t> &helloPacket);
  34. public:
  35. Session();
  36. std::shared_ptr<ShannonConnection> shanConn;
  37. std::shared_ptr<LoginBlob> authBlob;
  38. void connect(std::unique_ptr<PlainConnection> connection);
  39. void connectWithRandomAp();
  40. void close();
  41. std::vector<uint8_t> authenticate(std::shared_ptr<LoginBlob> blob);
  42. };
  43. #endif