mirror of
https://gitgud.io/yuv420p10le/plexmediaserver_crack
synced 2025-07-05 17:03:21 +00:00
Standardized code between Windows and Linux versions.
This commit is contained in:
parent
791525f2eb
commit
cfccf82908
@ -28,6 +28,21 @@ bool get_dottext_info(uintptr_t& start, uintptr_t& end)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void write_jmp(const uintptr_t from, const uintptr_t to)
|
||||||
|
{
|
||||||
|
uint8_t shellcode[] =
|
||||||
|
{
|
||||||
|
0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp [rip+0x06]
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ?
|
||||||
|
};
|
||||||
|
|
||||||
|
*reinterpret_cast<uintptr_t*>(&shellcode[6]) = to;
|
||||||
|
|
||||||
|
mprotect(reinterpret_cast<void*>(from), sizeof(shellcode), PROT_READ|PROT_WRITE|PROT_EXEC);
|
||||||
|
memcpy(reinterpret_cast<void*>(from), shellcode, sizeof(shellcode));
|
||||||
|
mprotect(reinterpret_cast<void*>(from), sizeof(shellcode), PROT_READ|PROT_EXEC);
|
||||||
|
}
|
||||||
|
|
||||||
uintptr_t sig_scan(const uintptr_t start, const uintptr_t end, std::string_view pattern)
|
uintptr_t sig_scan(const uintptr_t start, const uintptr_t end, std::string_view pattern)
|
||||||
{
|
{
|
||||||
constexpr const uint16_t WILDCARD = 0xFFFF;
|
constexpr const uint16_t WILDCARD = 0xFFFF;
|
||||||
@ -116,7 +131,5 @@ void hook()
|
|||||||
|
|
||||||
*reinterpret_cast<decltype(&hook_is_feature_available)*>(&shellcode[6]) = &hook_is_feature_available;
|
*reinterpret_cast<decltype(&hook_is_feature_available)*>(&shellcode[6]) = &hook_is_feature_available;
|
||||||
|
|
||||||
mprotect(reinterpret_cast<void*>(_is_feature_available), sizeof(shellcode), PROT_READ|PROT_WRITE|PROT_EXEC);
|
write_jmp(_is_feature_available, reinterpret_cast<uintptr_t>(&hook_is_feature_available));
|
||||||
memcpy(reinterpret_cast<void*>(_is_feature_available), shellcode, sizeof(shellcode));
|
|
||||||
mprotect(reinterpret_cast<void*>(_is_feature_available), sizeof(shellcode), PROT_READ|PROT_EXEC);
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
bool get_dottext_info(uintptr_t& start, uintptr_t& end);
|
bool get_dottext_info(uintptr_t& start, uintptr_t& end);
|
||||||
|
void write_jmp(const uintptr_t from, const uintptr_t to);
|
||||||
uintptr_t sig_scan(const uintptr_t start, const uintptr_t end, std::string_view pattern);
|
uintptr_t sig_scan(const uintptr_t start, const uintptr_t end, std::string_view pattern);
|
||||||
uint64_t hook_is_feature_available(uintptr_t user, const char* feature);
|
uint64_t hook_is_feature_available(uintptr_t user, const char* feature);
|
||||||
void hook();
|
void hook();
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
#include <format>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -38,6 +37,22 @@ bool get_section_info(std::string_view name, uintptr_t& start, uintptr_t& end)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void write_jmp(const uintptr_t from, const uintptr_t to)
|
||||||
|
{
|
||||||
|
uint8_t shellcode[] =
|
||||||
|
{
|
||||||
|
0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp [rip+0x06]
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ?
|
||||||
|
};
|
||||||
|
|
||||||
|
*reinterpret_cast<uintptr_t*>(&shellcode[6]) = to;
|
||||||
|
|
||||||
|
DWORD old_prot;
|
||||||
|
VirtualProtect(reinterpret_cast<void*>(from), sizeof(shellcode), PAGE_EXECUTE_READWRITE, &old_prot);
|
||||||
|
memcpy(reinterpret_cast<void*>(from), shellcode, sizeof(shellcode));
|
||||||
|
VirtualProtect(reinterpret_cast<void*>(from), sizeof(shellcode), old_prot, &old_prot);
|
||||||
|
}
|
||||||
|
|
||||||
uintptr_t sig_scan(const uintptr_t start, const uintptr_t end, std::string_view pattern)
|
uintptr_t sig_scan(const uintptr_t start, const uintptr_t end, std::string_view pattern)
|
||||||
{
|
{
|
||||||
constexpr const uint16_t WILDCARD = 0xFFFF;
|
constexpr const uint16_t WILDCARD = 0xFFFF;
|
||||||
@ -77,7 +92,7 @@ uintptr_t sig_scan(const uintptr_t start, const uintptr_t end, std::string_view
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
end_address = std::min(end, reinterpret_cast<uintptr_t>(mbi.BaseAddress) + mbi.RegionSize);
|
end_address = std::min(end, static_cast<uintptr_t>(reinterpret_cast<uintptr_t>(mbi.BaseAddress) + mbi.RegionSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto vec_length = pattern_vec.size();
|
const auto vec_length = pattern_vec.size();
|
||||||
@ -134,18 +149,6 @@ void hook()
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Jumps to specified address
|
|
||||||
uint8_t shellcode[] =
|
|
||||||
{
|
|
||||||
0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp [rip+0x06]
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ?
|
|
||||||
};
|
|
||||||
|
|
||||||
*reinterpret_cast<decltype(&hook_is_feature_available)*>(&shellcode[6]) = &hook_is_feature_available;
|
write_jmp(_is_feature_available, reinterpret_cast<uintptr_t>(&hook_is_feature_available));
|
||||||
|
|
||||||
DWORD old_prot;
|
|
||||||
VirtualProtect(reinterpret_cast<void*>(_is_feature_available), sizeof(shellcode), PAGE_EXECUTE_READWRITE, &old_prot);
|
|
||||||
memcpy(reinterpret_cast<void*>(_is_feature_available), shellcode, sizeof(shellcode));
|
|
||||||
VirtualProtect(reinterpret_cast<void*>(_is_feature_available), sizeof(shellcode), old_prot, &old_prot);
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
bool get_section_info(std::string_view name, uintptr_t& start, uintptr_t& end);
|
bool get_section_info(std::string_view name, uintptr_t& start, uintptr_t& end);
|
||||||
|
void write_jmp(const uintptr_t from, const uintptr_t to);
|
||||||
uintptr_t sig_scan(const uintptr_t start, const uintptr_t end, std::string_view pattern);
|
uintptr_t sig_scan(const uintptr_t start, const uintptr_t end, std::string_view pattern);
|
||||||
uint64_t hook_is_feature_available(uintptr_t user, const char* feature);
|
uint64_t hook_is_feature_available(uintptr_t user, const char* feature);
|
||||||
void hook();
|
void hook();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user