Fix securitylevel message
This commit is contained in:
parent
4c6ad8a134
commit
a9742bc8ec
2
deps/fmt
vendored
2
deps/fmt
vendored
@ -1 +1 @@
|
|||||||
Subproject commit a5d0adf3953f0ae3e698d5b5702d1e5a7bf3d87e
|
Subproject commit 2bf59a97c6e65e4963913d9ba2f8d260e5c8fbf5
|
2
deps/json11
vendored
2
deps/json11
vendored
@ -1 +1 @@
|
|||||||
Subproject commit fb6cc808e0a3532d27ee336cd8f2e1ff06093f3b
|
Subproject commit 787809178ddb3d739e6f408af5233930c9077929
|
2
deps/mongoose
vendored
2
deps/mongoose
vendored
@ -1 +1 @@
|
|||||||
Subproject commit af98854ce440181a46a3a3315c1e69dcbf1e7918
|
Subproject commit d4a8351464e9737b8108435ffb51382f21a55230
|
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 32fadc0d4928c5f2d2c76fc4ddc39270673b7fa7
|
Subproject commit a2484208c3291ea522a891114d2821829bd09083
|
@ -85,12 +85,16 @@ namespace Components
|
|||||||
jmp AntiCheat::NullSub
|
jmp AntiCheat::NullSub
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
void AntiCheat::CrashClient()
|
void AntiCheat::CrashClient()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_DETECTIONS
|
||||||
|
MessageBoxA(0, "Check the debug log for more information!", "AntiCheat triggered", MB_ICONERROR);
|
||||||
|
#else
|
||||||
Utils::Hook::Set<BYTE>(0x41BA2C, 0xEB);
|
Utils::Hook::Set<BYTE>(0x41BA2C, 0xEB);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AntiCheat::AssertCalleeModule(void* callee)
|
void AntiCheat::AssertCalleeModule(void* callee)
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
// Log detections
|
// Log detections
|
||||||
// Make sure to disable that before releasig!
|
// Make sure to disable that before releasig!
|
||||||
//#define DEBUG_DETECTIONS
|
#define DEBUG_DETECTIONS
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,51 @@ namespace Components
|
|||||||
Utils::Cryptography::Token Auth::ComputeToken;
|
Utils::Cryptography::Token Auth::ComputeToken;
|
||||||
Utils::Cryptography::ECC::Key Auth::GuidKey;
|
Utils::Cryptography::ECC::Key Auth::GuidKey;
|
||||||
|
|
||||||
|
void Auth::Frame()
|
||||||
|
{
|
||||||
|
if (Auth::TokenContainer.generating)
|
||||||
|
{
|
||||||
|
static int lastCalc = 0;
|
||||||
|
static double mseconds = 0;
|
||||||
|
|
||||||
|
if (!lastCalc || (Game::Sys_Milliseconds() - lastCalc) > 500)
|
||||||
|
{
|
||||||
|
lastCalc = Game::Sys_Milliseconds();
|
||||||
|
|
||||||
|
int diff = Game::Sys_Milliseconds() - Auth::TokenContainer.startTime;
|
||||||
|
double hashPMS = (Auth::TokenContainer.hashes * 1.0) / diff;
|
||||||
|
double requiredHashes = std::pow(2, Auth::TokenContainer.targetLevel + 1) - Auth::TokenContainer.hashes;
|
||||||
|
mseconds = requiredHashes / hashPMS;
|
||||||
|
if (mseconds < 0) mseconds = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Localization::Set("MPUI_SECURITY_INCREASE_MESSAGE", Utils::String::VA("Increasing security level from %d to %d (est. %s)", Auth::GetSecurityLevel(), Auth::TokenContainer.targetLevel, Utils::String::FormatTimeSpan(static_cast<int>(mseconds)).data()));
|
||||||
|
}
|
||||||
|
else if (Auth::TokenContainer.thread.joinable())
|
||||||
|
{
|
||||||
|
Auth::TokenContainer.thread.join();
|
||||||
|
Auth::TokenContainer.generating = false;
|
||||||
|
|
||||||
|
Auth::StoreKey();
|
||||||
|
Logger::Print("Security level is %d\n", Auth::GetSecurityLevel());
|
||||||
|
Command::Execute("closemenu security_increase_popmenu", false);
|
||||||
|
|
||||||
|
if (!Auth::TokenContainer.cancel)
|
||||||
|
{
|
||||||
|
if (Auth::TokenContainer.command.empty())
|
||||||
|
{
|
||||||
|
Game::MessageBox(Utils::String::VA("Your new security level is %d", Auth::GetSecurityLevel()), "Success");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Command::Execute(Auth::TokenContainer.command, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Auth::TokenContainer.cancel = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Auth::SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char *format, int len)
|
void Auth::SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char *format, int len)
|
||||||
{
|
{
|
||||||
// Ensure our certificate is loaded
|
// Ensure our certificate is loaded
|
||||||
@ -319,6 +364,8 @@ namespace Components
|
|||||||
|
|
||||||
Auth::LoadKey(true);
|
Auth::LoadKey(true);
|
||||||
|
|
||||||
|
QuickPatch::OnFrame(Auth::Frame);
|
||||||
|
|
||||||
// Register dvar
|
// Register dvar
|
||||||
Dvar::Register<int>("sv_securityLevel", 23, 0, 512, Game::dvar_flag::DVAR_FLAG_SERVERINFO, "Security level for GUID certificates (POW)");
|
Dvar::Register<int>("sv_securityLevel", 23, 0, 512, Game::dvar_flag::DVAR_FLAG_SERVERINFO, "Security level for GUID certificates (POW)");
|
||||||
|
|
||||||
|
@ -41,5 +41,7 @@ namespace Components
|
|||||||
static void SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char *format, int len);
|
static void SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char *format, int len);
|
||||||
static void ParseConnectData(Game::msg_t* msg, Game::netadr_t addr);
|
static void ParseConnectData(Game::msg_t* msg, Game::netadr_t addr);
|
||||||
static void DirectConnectStub();
|
static void DirectConnectStub();
|
||||||
|
|
||||||
|
static void Frame();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ namespace Components
|
|||||||
|
|
||||||
// This is placed here in case the anticheat has been disabled!
|
// This is placed here in case the anticheat has been disabled!
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
Renderer::OnFrame(AntiCheat::ScanIntegrityCheck);
|
QuickPatch::OnFrame(AntiCheat::ScanIntegrityCheck);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace Components
|
|||||||
|
|
||||||
// This is placed here in case the anticheat has been disabled!
|
// This is placed here in case the anticheat has been disabled!
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
Renderer::OnFrame(AntiCheat::FlagIntegrityCheck);
|
QuickPatch::OnFrame(AntiCheat::FlagIntegrityCheck);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -719,7 +719,7 @@ namespace Components
|
|||||||
|
|
||||||
// This is placed here in case the anticheat has been disabled!
|
// This is placed here in case the anticheat has been disabled!
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
Renderer::OnFrame(AntiCheat::ReadIntegrityCheck);
|
QuickPatch::OnFrame(AntiCheat::ReadIntegrityCheck);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
tools/protoc.exe
BIN
tools/protoc.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user