feat (module): New Detection Gravity Hack

This commit is contained in:
MDIC
2022-05-04 20:52:51 -04:00
parent 317f3ac963
commit 84d084b367
6 changed files with 31 additions and 7 deletions

View File

@@ -81,6 +81,7 @@ Anticheat.DetectTelePortHack = 1
Anticheat.IgnoreControlHack = 1 Anticheat.IgnoreControlHack = 1
Anticheat.DetectZaxisHack =1 Anticheat.DetectZaxisHack =1
Anticheat.AntiSwimHack = 1 Anticheat.AntiSwimHack = 1
Anticheat.DetectGravityHack = 1
# Anticheat.StricterFlyHackCheck # Anticheat.StricterFlyHackCheck
# Description: Checks moveflag ascending (may give false positives) # Description: Checks moveflag ascending (may give false positives)

View File

@@ -14,6 +14,7 @@ CREATE TABLE IF NOT EXISTS `daily_players_reports` (
`ignorecontrol_reports` bigint unsigned NOT NULL DEFAULT 0, `ignorecontrol_reports` bigint unsigned NOT NULL DEFAULT 0,
`zaxis_reports` bigint unsigned NOT NULL DEFAULT 0, `zaxis_reports` bigint unsigned NOT NULL DEFAULT 0,
`antiswim_reports` bigint unsigned NOT NULL DEFAULT 0, `antiswim_reports` bigint unsigned NOT NULL DEFAULT 0,
`gravity_reports` bigint unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`guid`) PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@@ -33,5 +34,6 @@ CREATE TABLE IF NOT EXISTS `players_reports_status` (
`ignorecontrol_reports` bigint unsigned NOT NULL DEFAULT 0, `ignorecontrol_reports` bigint unsigned NOT NULL DEFAULT 0,
`zaxis_reports` bigint unsigned NOT NULL DEFAULT 0, `zaxis_reports` bigint unsigned NOT NULL DEFAULT 0,
`antiswim_reports` bigint unsigned NOT NULL DEFAULT 0, `antiswim_reports` bigint unsigned NOT NULL DEFAULT 0,
`gravity_reports` bigint unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`guid`) PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@@ -3,7 +3,7 @@
#include "AnticheatMgr.h" #include "AnticheatMgr.h"
#define MAX_REPORT_TYPES 10 #define MAX_REPORT_TYPES 11
class AnticheatData class AnticheatData
{ {

View File

@@ -413,6 +413,7 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo,
ClimbHackDetection(player, movementInfo, opcode); ClimbHackDetection(player, movementInfo, opcode);
TeleportHackDetection(player, movementInfo); TeleportHackDetection(player, movementInfo);
IgnoreControlHackDetection(player, movementInfo); IgnoreControlHackDetection(player, movementInfo);
GravityHackDetection(player, movementInfo);
if (player->GetLiquidData().Status == LIQUID_MAP_WATER_WALK) if (player->GetLiquidData().Status == LIQUID_MAP_WATER_WALK)
{ {
WalkOnWaterHackDetection(player, movementInfo); WalkOnWaterHackDetection(player, movementInfo);
@@ -491,6 +492,23 @@ void AnticheatMgr::AntiSwimHackDetection(Player* player, MovementInfo movementIn
} }
} }
void AnticheatMgr::GravityHackDetection(Player* player, MovementInfo movementInfo)
{
if (!sConfigMgr->GetOption<bool>("Anticheat.DetectGravityHack", true))
return;
if (!player->HasUnitState(MOVEMENTFLAG_DISABLE_GRAVITY) && movementInfo.jump.zspeed < -10.0f)
{
if (sConfigMgr->GetOption<bool>("Anticheat.WriteLog", true))
{
uint32 latency = 0;
latency = player->GetSession()->GetLatency();
LOG_INFO("module", "AnticheatMgr:: Gravity-Hack detected player {} ({}) - Latency: {} ms", player->GetName(), player->GetGUID().ToString(), latency);
}
BuildReport(player, GRAVITY_HACK_REPORT);
}
}
void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo) void AnticheatMgr::SpeedHackDetection(Player* player, MovementInfo movementInfo)
{ {
if (!sConfigMgr->GetOption<bool>("Anticheat.DetectSpeedHack", true)) if (!sConfigMgr->GetOption<bool>("Anticheat.DetectSpeedHack", true))
@@ -618,8 +636,8 @@ void AnticheatMgr::HandlePlayerLogout(Player* player)
} }
void AnticheatMgr::SavePlayerData(Player* player) void AnticheatMgr::SavePlayerData(Player* player)
{// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 {// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
CharacterDatabase.Execute("REPLACE INTO players_reports_status (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), m_Players[player->GetGUID()].GetAverage(), m_Players[player->GetGUID()].GetTotalReports(), m_Players[player->GetGUID()].GetTypeReports(SPEED_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(FLY_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(JUMP_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(WALK_WATER_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_PLANE_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(CLIMB_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(IGNORE_CONTROL_REPORT), m_Players[player->GetGUID()].GetTypeReports(ZAXIS_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(ANTISWIM_HACK_REPORT), m_Players[player->GetGUID()].GetCreationTime()); CharacterDatabase.Execute("REPLACE INTO players_reports_status (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,gravity_reports,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), m_Players[player->GetGUID()].GetAverage(), m_Players[player->GetGUID()].GetTotalReports(), m_Players[player->GetGUID()].GetTypeReports(SPEED_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(FLY_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(JUMP_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(WALK_WATER_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_PLANE_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(CLIMB_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(IGNORE_CONTROL_REPORT), m_Players[player->GetGUID()].GetTypeReports(ZAXIS_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(ANTISWIM_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(GRAVITY_HACK_REPORT), m_Players[player->GetGUID()].GetCreationTime());
} }
uint32 AnticheatMgr::GetTotalReports(ObjectGuid guid) uint32 AnticheatMgr::GetTotalReports(ObjectGuid guid)
@@ -710,8 +728,8 @@ void AnticheatMgr::BuildReport(Player* player, uint16 reportType)
if (sConfigMgr->GetOption<uint32>("Anticheat.MaxReportsForDailyReport", 70) < m_Players[key].GetTotalReports()) if (sConfigMgr->GetOption<uint32>("Anticheat.MaxReportsForDailyReport", 70) < m_Players[key].GetTotalReports())
{ {
if (!m_Players[key].GetDailyReportState()) if (!m_Players[key].GetDailyReportState())
{// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 {// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
CharacterDatabase.Execute("REPLACE INTO daily_players_reports (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), m_Players[player->GetGUID()].GetAverage(), m_Players[player->GetGUID()].GetTotalReports(), m_Players[player->GetGUID()].GetTypeReports(SPEED_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(FLY_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(JUMP_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(WALK_WATER_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_PLANE_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(CLIMB_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(IGNORE_CONTROL_REPORT), m_Players[player->GetGUID()].GetTypeReports(ZAXIS_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(ANTISWIM_HACK_REPORT), m_Players[player->GetGUID()].GetCreationTime()); CharacterDatabase.Execute("REPLACE INTO daily_players_reports (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleport_reports,ignorecontrol_reports,zaxis_reports,antiswim_reports,gravity_reports,creation_time) VALUES ({},{},{},{},{},{},{},{},{},{},{},{},{},{},{});", player->GetGUID().GetCounter(), m_Players[player->GetGUID()].GetAverage(), m_Players[player->GetGUID()].GetTotalReports(), m_Players[player->GetGUID()].GetTypeReports(SPEED_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(FLY_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(JUMP_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(WALK_WATER_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_PLANE_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(CLIMB_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(TELEPORT_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(IGNORE_CONTROL_REPORT), m_Players[player->GetGUID()].GetTypeReports(ZAXIS_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(ANTISWIM_HACK_REPORT), m_Players[player->GetGUID()].GetTypeReports(GRAVITY_HACK_REPORT), m_Players[player->GetGUID()].GetCreationTime());
m_Players[key].SetDailyReportState(true); m_Players[key].SetDailyReportState(true);
} }
} }

View File

@@ -37,7 +37,8 @@ enum ReportTypes
TELEPORT_HACK_REPORT = 6, TELEPORT_HACK_REPORT = 6,
IGNORE_CONTROL_REPORT = 7, IGNORE_CONTROL_REPORT = 7,
ZAXIS_HACK_REPORT = 8, ZAXIS_HACK_REPORT = 8,
ANTISWIM_HACK_REPORT = 9 ANTISWIM_HACK_REPORT = 9,
GRAVITY_HACK_REPORT = 10
// MAX_REPORT_TYPES // MAX_REPORT_TYPES
}; };
@@ -81,6 +82,7 @@ class AnticheatMgr
void TeleportHackDetection(Player* player, MovementInfo movementInfo); void TeleportHackDetection(Player* player, MovementInfo movementInfo);
void IgnoreControlHackDetection(Player* player, MovementInfo movementInfo); void IgnoreControlHackDetection(Player* player, MovementInfo movementInfo);
void ZAxisHackDetection(Player* player, MovementInfo movementInfo); void ZAxisHackDetection(Player* player, MovementInfo movementInfo);
void GravityHackDetection(Player* player, MovementInfo movementInfo);
void BuildReport(Player* player,uint16 reportType); void BuildReport(Player* player,uint16 reportType);
bool MustCheckTempReports(uint8 type); bool MustCheckTempReports(uint8 type);

View File

@@ -208,6 +208,7 @@ public:
uint32 ignorecontrol_reports = sAnticheatMgr->GetTypeReports(guid, 7); uint32 ignorecontrol_reports = sAnticheatMgr->GetTypeReports(guid, 7);
uint32 zaxis_reports = sAnticheatMgr->GetTypeReports(guid, 8); uint32 zaxis_reports = sAnticheatMgr->GetTypeReports(guid, 8);
uint32 antiswim_reports = sAnticheatMgr->GetTypeReports(guid, 9); uint32 antiswim_reports = sAnticheatMgr->GetTypeReports(guid, 9);
uint32 gravity_reports = sAnticheatMgr->GetTypeReports(guid, 10);
Player* playerTarget = player->GetConnectedPlayer(); Player* playerTarget = player->GetConnectedPlayer();
uint32 latency = 0; uint32 latency = 0;
latency = playerTarget->GetSession()->GetLatency(); latency = playerTarget->GetSession()->GetLatency();
@@ -217,7 +218,7 @@ public:
handler->PSendSysMessage("Walk On Water Reports: %u || Teleport To Plane Reports: %u", waterwalk_reports, teleportplane_reports); handler->PSendSysMessage("Walk On Water Reports: %u || Teleport To Plane Reports: %u", waterwalk_reports, teleportplane_reports);
handler->PSendSysMessage("Teleport Reports: %u || Climb Reports: %u", teleport_reports, climb_reports); handler->PSendSysMessage("Teleport Reports: %u || Climb Reports: %u", teleport_reports, climb_reports);
handler->PSendSysMessage("Ignore Control Reports: %u || Ignore Z-Axis Reports: %u", ignorecontrol_reports, zaxis_reports); handler->PSendSysMessage("Ignore Control Reports: %u || Ignore Z-Axis Reports: %u", ignorecontrol_reports, zaxis_reports);
handler->PSendSysMessage("Ignore Anti-Swim Reports: %u", antiswim_reports); handler->PSendSysMessage("Ignore Anti-Swim Reports: %u || Gravity Reports: %u", antiswim_reports, gravity_reports);
return true; return true;
} }
else else