[AntiCheat] Add redundant code scanners

This commit is contained in:
momo5502 2017-06-11 21:24:32 +02:00
parent 7a0261ccbd
commit 29ef5d6379
4 changed files with 52 additions and 0 deletions

View File

@ -229,6 +229,46 @@ namespace Components
AntiCheat::Flags |= AntiCheat::IntergrityFlag::MEMORY_SCAN;
}
void AntiCheat::QuickCodeScanner_1()
{
static Utils::Time::Interval interval;
static Utils::Value<std::string> hashVal;
if (!interval.elapsed(11s)) return;
interval.update();
// Hash .text segment
// Add 1 to each value, so searching in memory doesn't reveal anything
size_t textSize = 0x2D5FFF;
uint8_t* textBase = reinterpret_cast<uint8_t*>(0x400FFF);
std::string hash = Utils::Cryptography::SHA256::Compute(textBase + 1, textSize + 1, false);
if (hashVal.isValid() && hash != hashVal.get())
{
Utils::Hook::Set<BYTE>(0x42A667, 0x90); // Crash
}
hashVal.set(hash);
}
void AntiCheat::QuickCodeScanner_2()
{
static Utils::Time::Interval interval;
static Utils::Value<std::string> hashVal;
if (!interval.elapsed(12s)) return;
interval.update();
// Hash .text segment
std::string hash = Utils::Cryptography::SHA1::Compute(reinterpret_cast<uint8_t*>(0x401000), 0x2D6000, false);
if (hashVal.isValid() && hash != hashVal.get())
{
Utils::Hook::Set<BYTE>(0x40797C, 0x90); // Crash
}
hashVal.set(hash);
}
#ifdef DEBUG_LOAD_LIBRARY
HANDLE AntiCheat::LoadLibary(std::wstring library, HANDLE file, DWORD flags, void* callee)
{

View File

@ -31,6 +31,10 @@ namespace Components
static void VerifyThreadIntegrity();
static void QuickCodeScanner_1();
static void QuickCodeScanner_2();
static void QuickCodeScanner_3();
private:
enum IntergrityFlag
{

View File

@ -55,6 +55,10 @@ namespace Components
// Changelog
UIFeeder::Add(62.0f, Changelog::GetChangelogCount, Changelog::GetChangelogText, Changelog::SelectChangelog);
#if !defined(DEBUG) && !defined(DISABLE_ANTICHEAT)
Scheduler::OnFrame(AntiCheat::QuickCodeScanner_1);
#endif
}
Changelog::~Changelog()

View File

@ -766,6 +766,10 @@ namespace Components
}
});
#if !defined(DEBUG) && !defined(DISABLE_ANTICHEAT)
Scheduler::OnFrame(AntiCheat::QuickCodeScanner_2);
#endif
Command::Add("mp_QuickMessage", [] (Command::Params*)
{
Command::Execute("openmenu quickmessage");