Updated: Teleport Detection, New Sql, New Conf

New Detection Type for Teleport Hack, New SQL column,  new conf to enable detection logging of teleport hack. Add notice since new hack detection requires the new teleport helpers introduced with c50f7feda
This commit is contained in:
acidmanifesto
2022-02-11 10:29:30 -05:00
parent 3bd91e16c4
commit 95a1e71cf4
6 changed files with 64 additions and 24 deletions

View File

@@ -4,6 +4,10 @@
This is a port of the PassiveAnticheat Script from lordpsyan's repo to [AzerothCore](http://www.azerothcore.org) This is a port of the PassiveAnticheat Script from lordpsyan's repo to [AzerothCore](http://www.azerothcore.org)
## Notice
Requires revision [c50f7feda](https://github.com/azerothcore/azerothcore-wotlk/commit/c50f7feda0ee360f7bcca7f004bf6fb22abde533) or newer.
## How to install ## How to install
### 1) Simply place the module under the `modules` folder of your AzerothCore source folder. ### 1) Simply place the module under the `modules` folder of your AzerothCore source folder.

View File

@@ -61,6 +61,7 @@ Anticheat.DetectJumpHack = 1
Anticheat.DetectTelePlaneHack = 1 Anticheat.DetectTelePlaneHack = 1
Anticheat.DetectSpeedHack = 1 Anticheat.DetectSpeedHack = 1
Anticheat.DetectClimbHack = 0 Anticheat.DetectClimbHack = 0
Anticheat.DetectTelePortHack =1
# Anticheat.StricterFlyHackCheck # Anticheat.StricterFlyHackCheck
# Description: Checks moveflag ascending (may give false positives) # Description: Checks moveflag ascending (may give false positives)

View File

@@ -1,21 +1,5 @@
DROP TABLE IF EXISTS `players_reports_status`;
CREATE TABLE `players_reports_status` (
`guid` int(10) unsigned NOT NULL DEFAULT '0',
`creation_time` int(10) unsigned NOT NULL DEFAULT '0',
`average` float NOT NULL DEFAULT '0',
`total_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`speed_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`fly_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`jump_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`waterwalk_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`teleportplane_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`climb_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='';
DROP TABLE IF EXISTS `daily_players_reports`; DROP TABLE IF EXISTS `daily_players_reports`;
CREATE TABLE `daily_players_reports` ( CREATE TABLE IF NOT EXISTS `daily_players_reports` (
`guid` int(10) unsigned NOT NULL DEFAULT '0', `guid` int(10) unsigned NOT NULL DEFAULT '0',
`creation_time` int(10) unsigned NOT NULL DEFAULT '0', `creation_time` int(10) unsigned NOT NULL DEFAULT '0',
`average` float NOT NULL DEFAULT '0', `average` float NOT NULL DEFAULT '0',
@@ -26,5 +10,22 @@ CREATE TABLE `daily_players_reports` (
`waterwalk_reports` bigint(20) unsigned NOT NULL DEFAULT '0', `waterwalk_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`teleportplane_reports` bigint(20) unsigned NOT NULL DEFAULT '0', `teleportplane_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`climb_reports` bigint(20) unsigned NOT NULL DEFAULT '0', `climb_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`teleporthack_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`guid`) PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=''; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `players_reports_status`;
CREATE TABLE IF NOT EXISTS `players_reports_status` (
`guid` int(10) unsigned NOT NULL DEFAULT '0',
`creation_time` int(10) unsigned NOT NULL DEFAULT '0',
`average` float NOT NULL DEFAULT '0',
`total_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`speed_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`fly_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`jump_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`waterwalk_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`teleportplane_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`climb_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
`teleporthack_reports` bigint(20) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@@ -182,6 +182,34 @@ void AnticheatMgr::TeleportPlaneHackDetection(Player* player, MovementInfo movem
} }
} }
void AnticheatMgr::TeleportHackDetection(Player* player, MovementInfo movementInfo)
{
if (!sConfigMgr->GetOption<bool>("Anticheat.DetectTelePortHack", true))
return;
ObjectGuid key = player->GetGUID();
if (m_Players[key].GetLastMovementInfo().pos.GetPositionX() == movementInfo.pos.GetPositionX())
return;
float lastX = m_Players[key].GetLastMovementInfo().pos.GetPositionX();
float newX = movementInfo.pos.GetPositionX();
float lastY = m_Players[key].GetLastMovementInfo().pos.GetPositionY();
float newY = movementInfo.pos.GetPositionY();
float xDiff = fabs(lastX - newX);
float yDiff = fabs(lastY - newY);
if ((xDiff >= 50.0f || yDiff >= 50.0f) && !player->CanTeleport())
{
LOG_INFO("module", "AnticheatMgr:: Teleport-Hack detected player {} ({})", player->GetName(), player->GetGUID().ToString());
BuildReport(player, TELEPORT_HACK_REPORT);
}
else if (player->CanTeleport())
player->SetCanTeleport(false);
}
void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode) void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo, uint32 opcode)
{ {
if (!sConfigMgr->GetOption<bool>("Anticheat.Enabled", 0)) if (!sConfigMgr->GetOption<bool>("Anticheat.Enabled", 0))
@@ -205,7 +233,7 @@ void AnticheatMgr::StartHackDetection(Player* player, MovementInfo movementInfo,
JumpHackDetection(player, movementInfo, opcode); JumpHackDetection(player, movementInfo, opcode);
TeleportPlaneHackDetection(player, movementInfo); TeleportPlaneHackDetection(player, movementInfo);
ClimbHackDetection(player, movementInfo, opcode); ClimbHackDetection(player, movementInfo, opcode);
TeleportHackDetection(player, movementInfo);
m_Players[key].SetLastMovementInfo(movementInfo); m_Players[key].SetLastMovementInfo(movementInfo);
m_Players[key].SetLastOpcode(opcode); m_Players[key].SetLastOpcode(opcode);
} }
@@ -317,7 +345,7 @@ void AnticheatMgr::HandlePlayerLogout(Player* player)
void AnticheatMgr::SavePlayerData(Player* player) void AnticheatMgr::SavePlayerData(Player* player)
{ {
CharacterDatabase.Execute("REPLACE INTO players_reports_status (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_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()].GetCreationTime()); CharacterDatabase.Execute("REPLACE INTO players_reports_status (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleporthack_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()].GetCreationTime());
} }
uint32 AnticheatMgr::GetTotalReports(ObjectGuid guid) uint32 AnticheatMgr::GetTotalReports(ObjectGuid guid)
@@ -340,6 +368,9 @@ bool AnticheatMgr::MustCheckTempReports(uint8 type)
if (type == JUMP_HACK_REPORT) if (type == JUMP_HACK_REPORT)
return false; return false;
if (type == TELEPORT_HACK_REPORT)
return false;
return true; return true;
} }
@@ -392,7 +423,7 @@ void AnticheatMgr::BuildReport(Player* player, uint8 reportType)
{ {
if (!m_Players[key].GetDailyReportState()) if (!m_Players[key].GetDailyReportState())
{ {
CharacterDatabase.Execute("REPLACE INTO daily_players_reports (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_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()].GetCreationTime()); CharacterDatabase.Execute("REPLACE INTO daily_players_reports (guid,average,total_reports,speed_reports,fly_reports,jump_reports,waterwalk_reports,teleportplane_reports,climb_reports,teleporthack_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()].GetCreationTime());
m_Players[key].SetDailyReportState(true); m_Players[key].SetDailyReportState(true);
} }
} }

View File

@@ -35,6 +35,7 @@ enum ReportTypes
JUMP_HACK_REPORT, JUMP_HACK_REPORT,
TELEPORT_PLANE_HACK_REPORT, TELEPORT_PLANE_HACK_REPORT,
CLIMB_HACK_REPORT, CLIMB_HACK_REPORT,
TELEPORT_HACK_REPORT,
// MAX_REPORT_TYPES // MAX_REPORT_TYPES
}; };
@@ -46,7 +47,8 @@ enum DetectionTypes
WALK_WATER_HACK_DETECTION = 4, WALK_WATER_HACK_DETECTION = 4,
JUMP_HACK_DETECTION = 8, JUMP_HACK_DETECTION = 8,
TELEPORT_PLANE_HACK_DETECTION = 16, TELEPORT_PLANE_HACK_DETECTION = 16,
CLIMB_HACK_DETECTION = 32 CLIMB_HACK_DETECTION = 32,
TELEPORT_HACK_DETECTION = 64
}; };
// GUID is the key. // GUID is the key.
@@ -86,7 +88,7 @@ class AnticheatMgr
void JumpHackDetection(Player* player, MovementInfo movementInfo,uint32 opcode); void JumpHackDetection(Player* player, MovementInfo movementInfo,uint32 opcode);
void TeleportPlaneHackDetection(Player* player, MovementInfo); void TeleportPlaneHackDetection(Player* player, MovementInfo);
void ClimbHackDetection(Player* player,MovementInfo movementInfo,uint32 opcode); void ClimbHackDetection(Player* player,MovementInfo movementInfo,uint32 opcode);
void TeleportHackDetection(Player* player, MovementInfo movementInfo);
void BuildReport(Player* player,uint8 reportType); void BuildReport(Player* player,uint8 reportType);
bool MustCheckTempReports(uint8 type); bool MustCheckTempReports(uint8 type);

View File

@@ -209,12 +209,13 @@ public:
uint32 waterwalk_reports = sAnticheatMgr->GetTypeReports(guid, 2); uint32 waterwalk_reports = sAnticheatMgr->GetTypeReports(guid, 2);
uint32 teleportplane_reports = sAnticheatMgr->GetTypeReports(guid, 4); uint32 teleportplane_reports = sAnticheatMgr->GetTypeReports(guid, 4);
uint32 climb_reports = sAnticheatMgr->GetTypeReports(guid, 5); uint32 climb_reports = sAnticheatMgr->GetTypeReports(guid, 5);
uint32 teleporthack_reports = sAnticheatMgr->GetTypeReports(guid, 6);
handler->PSendSysMessage("Information about player %s",player->GetName().c_str()); handler->PSendSysMessage("Information about player %s",player->GetName().c_str());
handler->PSendSysMessage("Average: %f || Total Reports: %u ",average,total_reports); handler->PSendSysMessage("Average: %f || Total Reports: %u ",average,total_reports);
handler->PSendSysMessage("Speed Reports: %u || Fly Reports: %u || Jump Reports: %u ",speed_reports,fly_reports,jump_reports); handler->PSendSysMessage("Speed Reports: %u || Fly Reports: %u || Jump Reports: %u ",speed_reports,fly_reports,jump_reports);
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("Climb Reports: %u", climb_reports); handler->PSendSysMessage("Climb Reports: %u || Teleport Hack Reports: %u", climb_reports, teleporthack_reports);
return true; return true;
} }