patch_solution_since_16.0.7.0.hpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #include <string>
  3. #include <list>
  4. #include "patch_solution_since.hpp"
  5. #include "elf64_interpreter.hpp"
  6. #include "amd64_emulator.hpp"
  7. namespace nkg {
  8. template<>
  9. class patch_solution_since<16, 0, 7, 0> final : public patch_solution {
  10. private:
  11. static inline std::string_view official_encoded_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw1dqF3SkCaAAmMzs889IqdW9M2dIdh3jG9yPcmLnmJiGpBF4E9VHSMGe8oPAy2kJDmdNt4BcEygvssEfginva5t5jm352UAoDosUJkTXGQhpAWMF4fBmBpO3EedG62rOsqMBgmSdAyxCSPBRJIOFR0QgZFbRnU0frj34fiVmgYiLuZSAmIbs8ZxiHPdp1oD4tUpvsFci4QJtYNjNnGU2WPH6rvChGl1IRKrxMtqLielsvajUjyrgOC6NmymYMvZNER3htFEtL1eQbCyTfDmtYyQ1Wt4Ot12lxf0wVIR5mcGN7XCXJRHOFHSf1gzXWabRSvmt1nrl7sW6cjxljuuQawIDAQAB";
  12. elf64_interpreter& m_libcc_interpreter;
  13. elf64_interpreter::va_t m_va_CSRegistrationInfoFetcher_LINUX_vtable;
  14. elf64_interpreter::va_t m_va_CSRegistrationInfoFetcher_LINUX_GenerateRegistrationKey;
  15. elf64_interpreter::va_t m_va_pltgot_std_string_append;
  16. std::list<std::pair<elf64_interpreter::va_t, size_t>> m_tracing;
  17. uint64_t _emulator_append_external_api_impl(amd64_emulator& x64_emulator, std::string_view api_name, const std::vector<uint8_t>& api_impl);
  18. uint64_t _emulator_malloc(amd64_emulator& x64_emulator, size_t alloc_size);
  19. void _emulator_free(amd64_emulator& x64_emulator, uint64_t alloc_p);
  20. bool _emulator_page_fault_handler(amd64_emulator& x64_emulator, uc_mem_type access, uint64_t address, size_t size, int64_t value);
  21. void _emulator_dl_runtime_resolve_handler(amd64_emulator& x64_emulator, uint64_t address, size_t size);
  22. void _emulator_malloc_handler(amd64_emulator& x64_emulator, uint64_t address, size_t size);
  23. void _emulator_free_handler(amd64_emulator& x64_emulator, uint64_t address, size_t size);
  24. static std::string _build_encoded_key(const rsa_cipher& cipher);
  25. std::list<std::pair<elf64_interpreter::va_t, size_t>> _calculate_reliable_areas() const;
  26. public:
  27. patch_solution_since(elf64_interpreter& libcc_interpreter);
  28. [[nodiscard]]
  29. virtual bool find_patch() override;
  30. [[nodiscard]]
  31. virtual bool check_rsa_privkey(const rsa_cipher& cipher) override;
  32. virtual void make_patch(const rsa_cipher& cipher) override;
  33. };
  34. }