Optimize antishit

This commit is contained in:
momo5502 2016-06-28 11:30:49 +02:00
parent 6bad0ef9a4
commit 9b2d709211
5 changed files with 24 additions and 4 deletions

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit 79325bd219ae6fea7809324c38824269c2774fd1 Subproject commit ced823cd95b70b313fa56baad544ccec5d6ccd5b

2
deps/protobuf vendored

@ -1 +1 @@
Subproject commit 2bcd43afe4b649c95d932daf31b0b83948f7cf7c Subproject commit dc0aeaa9030bdac264b44d56d07b6839a1ae94e9

View File

@ -97,8 +97,16 @@ namespace Components
static uint8_t loadLibStub[] = { 0x33, 0xC0, 0xC2, 0x04, 0x00 }; // xor eax, eax; retn 04h static uint8_t loadLibStub[] = { 0x33, 0xC0, 0xC2, 0x04, 0x00 }; // xor eax, eax; retn 04h
static uint8_t loadLibExStub[] = { 0x33, 0xC0, 0xC2, 0x0C, 0x00 }; // xor eax, eax; retn 0Ch static uint8_t loadLibExStub[] = { 0x33, 0xC0, 0xC2, 0x0C, 0x00 }; // xor eax, eax; retn 0Ch
AntiCheat::LoadLibHook[0].Initialize(LoadLibraryA, loadLibStub, HOOK_JUMP); static uint8_t kernel32Str[] = { 0xB4, 0x9A, 0x8D, 0xB1, 0x9A, 0x93, 0xCC, 0xCD, 0xD1, 0x9B, 0x93, 0x93 }; // KerNel32.dll
AntiCheat::LoadLibHook[1].Initialize(LoadLibraryW, loadLibStub, HOOK_JUMP); static uint8_t loadLibAStr[] = { 0xB3, 0x90, 0x9E, 0x9B, 0xB3, 0x96, 0x9D, 0x8D, 0x9E, 0x8D, 0x86, 0xBE }; // LoadLibraryA
static uint8_t loadLibWStr[] = { 0xB3, 0x90, 0x9E, 0x9B, 0xB3, 0x96, 0x9D, 0x8D, 0x9E, 0x8D, 0x86, 0xA8 }; // LoadLibraryW
HMODULE kernel32 = GetModuleHandleA(Utils::XORString(std::string(reinterpret_cast<char*>(kernel32Str), sizeof kernel32Str), -1).data());
FARPROC loadLibA = GetProcAddress(kernel32, Utils::XORString(std::string(reinterpret_cast<char*>(loadLibAStr), sizeof loadLibAStr), -1).data());
FARPROC loadLibW = GetProcAddress(kernel32, Utils::XORString(std::string(reinterpret_cast<char*>(loadLibWStr), sizeof loadLibWStr), -1).data());
AntiCheat::LoadLibHook[0].Initialize(loadLibA, loadLibStub, HOOK_JUMP);
AntiCheat::LoadLibHook[1].Initialize(loadLibW, loadLibStub, HOOK_JUMP);
//AntiCheat::LoadLibHook[2].Initialize(LoadLibraryExA, loadLibExStub, HOOK_JUMP); //AntiCheat::LoadLibHook[2].Initialize(LoadLibraryExA, loadLibExStub, HOOK_JUMP);
//AntiCheat::LoadLibHook[3].Initialize(LoadLibraryExW, loadLibExStub, HOOK_JUMP); //AntiCheat::LoadLibHook[3].Initialize(LoadLibraryExW, loadLibExStub, HOOK_JUMP);
} }

View File

@ -61,6 +61,16 @@ namespace Utils
return result; return result;
} }
std::string XORString(std::string str, char value)
{
for (unsigned int i = 0; i < str.size(); ++i)
{
str[i] ^= value;
}
return str;
}
// Complementary function for memset, which checks if a memory is set // Complementary function for memset, which checks if a memory is set
bool MemIsSet(void* mem, char chr, size_t length) bool MemIsSet(void* mem, char chr, size_t length)
{ {

View File

@ -22,6 +22,8 @@ namespace Utils
std::string DumpHex(std::string data, std::string separator = " "); std::string DumpHex(std::string data, std::string separator = " ");
std::string XORString(std::string str, char value);
bool MemIsSet(void* mem, char chr, size_t length); bool MemIsSet(void* mem, char chr, size_t length);
class InfoString class InfoString