diff --git a/sql/updates/characters/2023_11_12_00_characters.sql b/sql/updates/characters/2023_11_12_00_characters.sql index b10a4685d0..2eb4278f14 100644 --- a/sql/updates/characters/2023_11_12_00_characters.sql +++ b/sql/updates/characters/2023_11_12_00_characters.sql @@ -1,10 +1,3 @@ -CREATE TABLE IF NOT EXISTS `lua_cheaters` ( - `guid` int unsigned NOT NULL DEFAULT 0, - `account` int unsigned NOT NULL DEFAULT 0, - `macro` varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (`guid`,`account`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - DROP TABLE `daily_players_reports`; CREATE TABLE IF NOT EXISTS `daily_players_reports` ( `guid` int unsigned NOT NULL DEFAULT 0, diff --git a/sql/updates/world/2023_11_22_world.sql b/sql/updates/world/2023_11_22_world.sql index e142a5c8fe..b97a874fad 100644 --- a/sql/updates/world/2023_11_22_world.sql +++ b/sql/updates/world/2023_11_22_world.sql @@ -1,13 +1,3 @@ -DROP TABLE IF EXISTS `lua_private_functions`; -CREATE TABLE IF NOT EXISTS `lua_private_functions` ( - `function_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, - `enabled` tinyint(4) NOT NULL DEFAULT '1' -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -DELETE FROM `lua_private_functions`; -INSERT INTO `lua_private_functions` (`function_name`, `enabled`) VALUES - ('CastSpellByName', 1), - ('RunMacroText', 1); - DELETE FROM `skyfire_string` WHERE `entry`=11002; INSERT INTO `skyfire_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `content_loc9`, `content_loc10`, `content_loc11`)VALUES (11002, '|cFFFFBF00[%s]:|cFFFFFFFF|Hplayer:%s|h[%s]|h|cFF00FFFF potential |r|cFFFFFF00%s|r%s x %u|r', null, null, null, null, null, null, null, null, null, null, null); diff --git a/src/server/game/Anticheat/AnticheatMgr.cpp b/src/server/game/Anticheat/AnticheatMgr.cpp index 95d038c8e5..7d4e88283e 100644 --- a/src/server/game/Anticheat/AnticheatMgr.cpp +++ b/src/server/game/Anticheat/AnticheatMgr.cpp @@ -120,105 +120,6 @@ AnticheatMgr::~AnticheatMgr() { } -void AnticheatMgr::LoadBlockedLuaFunctions() -{ - if (!sWorld->GetBoolConfig(WorldBoolConfigs::CONFIG_LUABLOCKER_ENABLE)) - { - SF_LOG_INFO("server.loading", ">> Anticheat.LUAblocker conf is set to 0"); - return; - } - uint32 oldmsTime = getMSTime(); - auto pstmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ANTICHEAT_FUNCTIONS); - auto result = WorldDatabase.Query(pstmt); - if (!result) - { - SF_LOG_INFO("server.loading", ">> Anticheat loaded 0 LUA blocked private functions"); - return; - } - uint32 count = 0; - do - { - auto fields = result->Fetch(); - _luaBlockedFunctions[fields[0].GetString()] = fields[1].GetBool(); - ++count; - } while (result->NextRow()); - - SF_LOG_INFO("server.loading", ">> Anticheat loaded %u LUA blocked private functions in %u ms", count, GetMSTimeDiffToNow(oldmsTime)); -} - -void AnticheatMgr::SaveLuaCheater(uint32 guid, uint32 accountId, std::string macro) -{ - auto pstmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ANTICHEAT_LUA_CHEATERS); - pstmt->setUInt32(0, guid); - pstmt->setUInt32(1, accountId); - pstmt->setString(2, macro); - CharacterDatabase.Execute(pstmt); -} - -bool AnticheatMgr::CheckIsLuaCheater(uint32 accountId) -{ - auto pstmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ANTICHEAT_LUA_CHEATERS); - pstmt->setUInt32(0, accountId); - auto result = CharacterDatabase.Query(pstmt); - if (result) - return true; - - return false; -} - -bool AnticheatMgr::CheckBlockedLuaFunctions(AccountData accountData[uint8(AccountDataType::NUM_ACCOUNT_DATA_TYPES)], Player* player) -{ - for (auto& kv : _luaBlockedFunctions) - { - for (uint8 i = 0; i < uint8(AccountDataType::NUM_ACCOUNT_DATA_TYPES); ++i) - { - std::string currentData = accountData[i].Data; - std::size_t pos = currentData.find(kv.first); - if (pos != std::string::npos) - { - // Code inside this if statement block will only execute if the variable 'pos' is not equal to std::string::npos. - // std::string::npos is a special value indicating the absence of a valid position. - // The following below is all done to capture the macro used and stored it in the SaveLuaCheater - - const static std::size_t defaultLength = 200; - // Declares a constant variable 'defaultLength' with a value of 200. - // This variable represents the default length of a substring to be extracted. - - std::size_t minPos = int64(int(pos) - 50) < 0 ? 0 : pos - 50; - - // Calculates the minimum position from where the substring will be extracted. - // It subtracts 50 from the 'pos' value, casts it to int64, and checks if it's less than 0. - // If it is less than 0, sets 'minPos' to 0, otherwise sets 'minPos' to 'pos - 50'. - // With out the - 50 we will get a crash on certain substrings - - std::size_t length = defaultLength + minPos > currentData.length() - 1 ? currentData.length() - minPos : defaultLength; - // Calculates the length of the substring to be extracted. - // It adds 'defaultLength' to 'minPos' and checks if it's greater than the length of 'currentData' minus 1. - // If it is greater, sets 'length' to 'currentData.length() - minPos', otherwise sets it to 'defaultLength'. - - std::string macro = currentData.substr(minPos, length); - // Extracts a substring from 'currentData' starting at 'minPos' with a length of 'length' and assigns it to the variable 'macro'. - - if (player) - { - // Checks if the 'player' pointer is not null (i.e., it points to a valid object, aka The NULL CHECK). - - SF_LOG_INFO("anticheat", "ANTICHEAT COUNTER MEASURE::Player %s has inaccessible LUA MACRO, placing on watch list", player->GetName().c_str()); - // Outputs a log message indicating that the player has an inaccessible Lua macro and is being placed on a watch list. - - SaveLuaCheater(player->GetGUID(), player->GetSession()->GetAccountId(), macro); - // Calls the 'SaveLuaCheater' function, passing in the player's GUID, session account ID, and the 'macro' string. - // This function saves information about the Lua cheater, such as the id of the player account, character, and macro used, for further analysis or enforcement actions. - } - - return true; - } - } - } - - return false; -} - void AnticheatMgr::StartHackDetection(Player* player, MovementInfo& movementInfo, uint32 opcode) { if (!sWorld->GetBoolConfig(WorldBoolConfigs::CONFIG_ANTICHEAT_ENABLE)) diff --git a/src/server/game/Anticheat/AnticheatMgr.h b/src/server/game/Anticheat/AnticheatMgr.h index 6550ca92b7..9ea16b6e7f 100644 --- a/src/server/game/Anticheat/AnticheatMgr.h +++ b/src/server/game/Anticheat/AnticheatMgr.h @@ -96,10 +96,6 @@ class AnticheatMgr void AnticheatDeleteCommand(uint32 guid); void AnticheatPurgeCommand(ChatHandler* handler); void ResetDailyReportStates(); - void LoadBlockedLuaFunctions(); - void SaveLuaCheater(uint32 guid, uint32 accountId, std::string macro); - bool CheckIsLuaCheater(uint32 accountId); - bool CheckBlockedLuaFunctions(AccountData accountData[uint8(AccountDataType::NUM_ACCOUNT_DATA_TYPES)], Player* player); private: void SpeedHackDetection(Player* player, MovementInfo &movementInfo, AnticheatData& data); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 67b9a2cc36..6dac9cbfca 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -35,7 +35,6 @@ #include "WardenWin.h" #include "WardenMac.h" #include "CharacterBoost.h" -#include "AnticheatMgr.h" namespace { @@ -122,8 +121,6 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = %u;", GetAccountId()); // One-time query } - _isLuaCheater = false; - InitializeQueryCallbackParameters(); _compressionStream = new z_stream(); @@ -773,16 +770,6 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask) m_accountData[type].Data = fields[2].GetString(); } while (result->NextRow()); - - bool cheater = sAnticheatMgr->CheckIsLuaCheater(GetAccountId()); - if (!cheater) - { - cheater = sAnticheatMgr->CheckBlockedLuaFunctions(m_accountData, _player); - } - if (!_isLuaCheater) - { - _isLuaCheater = cheater; - } } void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string const& data) diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 8e3789b855..b736f0277e 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -520,8 +520,6 @@ class WorldSession z_stream_s* GetCompressionStream() { return _compressionStream; } - bool IsLuaCheater() const { return _isLuaCheater; } - public: // opcodes handlers void Handle_NULL(WorldPacket& recvPacket); // not used void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead @@ -1193,8 +1191,6 @@ class WorldSession rbac::RBACData* _RBACData; WorldSession(WorldSession const& right) = delete; WorldSession & operator=(WorldSession const& right) = delete; - - bool _isLuaCheater; }; #endif /// @} diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 3b40300b00..df9edc8d95 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -478,7 +478,6 @@ class Spell UsedSpellMods m_appliedMods; int32 GetCastTime() const { return m_casttime; } - int32 GetTimer() const { return m_timer; } bool IsAutoRepeat() const { return m_autoRepeat; } void SetAutoRepeat(bool rep) { m_autoRepeat = rep; } void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 23283139e7..543bc18cf0 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3227,20 +3227,6 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex) { if (Spell* spell = unitTarget->GetCurrentSpell(CurrentSpellTypes(i))) { - // if player is lua cheater dont interrupt cast until timer reached 600ms - if (auto player = m_caster->ToPlayer()) - { - if (player->GetSession()->IsLuaCheater()) - { - if (spell->GetCastTime() - spell->GetTimer() < 600) - { - std::string goXYZ = ".go xyz " + std::to_string(player->GetPositionX()) + " " + std::to_string(player->GetPositionY()) + " " + std::to_string(player->GetPositionZ() + 1.0f) + " " + std::to_string(player->GetMap()->GetId()) + " " + std::to_string(player->GetOrientation()); - SF_LOG_INFO("anticheat", "ANTICHEAT COUNTER MEASURE::Played %s attempted repeat LUA spell Casting - IP: %s - Flagged at: %s", player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), goXYZ.c_str()); - return; - } - } - } - SpellInfo const* curSpellInfo = spell->m_spellInfo; // check if we can interrupt spell if ((spell->getState() == SPELL_STATE_CASTING diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 275aa374d2..01d30fdca1 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -3141,7 +3141,6 @@ Anticheat.Reports.InGame.Max = 70 # Default: 0 - (Disabled) # 1 - (Enabled) -Anticheat.LUAblocker = 0 Anticheat.DetectFlyHack = 0 Anticheat.DetectWaterWalkHack = 0 Anticheat.DetectJumpHack = 0