[Merge] feature/anticheat -> develop
# Conflicts: # src/Components/Modules/AntiCheat.hpp # src/Utils/Utils.cpp # src/Utils/Utils.hpp
This commit is contained in:
commit
e25cab6492
2
deps/libtomcrypt
vendored
2
deps/libtomcrypt
vendored
@ -1 +1 @@
|
||||
Subproject commit 2816da42af88aa1ed4d2d0b958d81021956a6c7e
|
||||
Subproject commit a4671110d5b988161d029eb5001d1516301606dd
|
@ -190,7 +190,7 @@ namespace Components
|
||||
{
|
||||
if (component)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
if(!Loader::PerformingUnitTests())
|
||||
{
|
||||
Logger::Print("Component registered: %s\n", component->getName().data());
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -31,6 +31,9 @@ namespace Components
|
||||
|
||||
static void VerifyThreadIntegrity();
|
||||
|
||||
static void QuickCodeScanner_1();
|
||||
static void QuickCodeScanner_2();
|
||||
|
||||
private:
|
||||
enum IntergrityFlag
|
||||
{
|
||||
|
@ -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()
|
||||
|
@ -257,7 +257,7 @@ namespace Components
|
||||
{
|
||||
if (params->length() > 1)
|
||||
{
|
||||
ShellExecuteA(nullptr, "open", params->get(1), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
Utils::OpenUrl(params->get(1));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -286,12 +286,12 @@ namespace Components
|
||||
}
|
||||
});
|
||||
|
||||
#if !defined(DEBUG) && !defined(DISABLE_ANTICHEAT)
|
||||
if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled() && !Utils::IsWineEnvironment() && !Loader::PerformingUnitTests())
|
||||
{
|
||||
AntiCheat::PatchVirtualProtect(VirtualProtect, VirtualProtectEx);
|
||||
}
|
||||
#endif
|
||||
// #if !defined(DEBUG) && !defined(DISABLE_ANTICHEAT)
|
||||
// if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled() && !Utils::IsWineEnvironment() && !Loader::PerformingUnitTests())
|
||||
// {
|
||||
// AntiCheat::PatchVirtualProtect(VirtualProtect, VirtualProtectEx);
|
||||
// }
|
||||
// #endif
|
||||
}
|
||||
|
||||
Localization::~Localization()
|
||||
|
@ -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");
|
||||
|
@ -204,12 +204,12 @@ namespace Components
|
||||
|
||||
UIScript::Add("visitWebsite", [](UIScript::Token)
|
||||
{
|
||||
ShellExecuteA(nullptr, "open", Utils::Cache::GetStaticUrl("").data(), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
Utils::OpenUrl(Utils::Cache::GetStaticUrl(""));
|
||||
});
|
||||
|
||||
UIScript::Add("visitWiki", [](UIScript::Token)
|
||||
{
|
||||
ShellExecuteA(nullptr, "open", Utils::Cache::GetStaticUrl("/wiki/").data(), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
Utils::OpenUrl(Utils::Cache::GetStaticUrl("/wiki/"));
|
||||
});
|
||||
|
||||
Localization::Set("MPUI_CHANGELOG_TEXT", "Loading...");
|
||||
|
@ -256,6 +256,7 @@ namespace Components
|
||||
// dont run UPNP stuff on main thread
|
||||
Utils::Hook::Set<BYTE>(0x48A135, 0xC3);
|
||||
Utils::Hook::Set<BYTE>(0x48A151, 0xC3);
|
||||
Utils::Hook::Nop(0x684080, 5); // Don't spam the console
|
||||
|
||||
// spawn upnp thread when UPNP_init returns
|
||||
Utils::Hook::Hook(0x47982B, []()
|
||||
|
@ -127,7 +127,7 @@ namespace Components
|
||||
void Window::ApplyCursor()
|
||||
{
|
||||
bool isLoading = !FastFiles::Ready();
|
||||
SetCursor(LoadCursor(nullptr, isLoading ? IDC_WAIT : IDC_ARROW));
|
||||
SetCursor(LoadCursor(nullptr, isLoading ? IDC_APPSTARTING : IDC_ARROW));
|
||||
}
|
||||
|
||||
BOOL WINAPI Window::MessageHandler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
|
@ -49,7 +49,7 @@ namespace Main
|
||||
call Main::Initialize
|
||||
popad
|
||||
|
||||
push 6BAC14h // Continue init routine
|
||||
push 6BAA2Fh // Continue init routine
|
||||
push 6CA062h // ___security_init_cookie
|
||||
retn
|
||||
}
|
||||
|
@ -110,6 +110,15 @@ namespace Utils
|
||||
return GetModuleHandleA(Utils::String::XOR(std::string(reinterpret_cast<char*>(ntdll), sizeof ntdll), -1).data());
|
||||
}
|
||||
|
||||
void OpenUrl(std::string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
ShellExecuteA(nullptr, "open", url.data(), nullptr, nullptr, SW_SHOWNORMAL);
|
||||
}
|
||||
catch (...) {}
|
||||
}
|
||||
|
||||
bool HasIntercection(unsigned int base1, unsigned int len1, unsigned int base2, unsigned int len2)
|
||||
{
|
||||
return !(base1 + len1 <= base2 || base2 + len2 <= base1);
|
||||
|
@ -19,6 +19,8 @@ namespace Utils
|
||||
void* GetThreadStartAddress(HANDLE hThread);
|
||||
HMODULE GetNTDLL();
|
||||
|
||||
void OpenUrl(std::string url);
|
||||
|
||||
bool HasIntercection(unsigned int base1, unsigned int len1, unsigned int base2, unsigned int len2);
|
||||
|
||||
template <typename T> inline void RotLeft(T& object, size_t bits)
|
||||
|
Loading…
Reference in New Issue
Block a user