Anyone who is interested, this is the little biatche of a code that caused WPE
to stop working on any server.
Dunno if there are still people out there willing to offer up time to crack it. .
Have a look nonetheless.
___________________________
Index: src/game/ItemHandler.cpp
===================================================================
--- src/game/ItemHandler.cpp (revision 2630)
+++ src/game/ItemHandler.cpp (working copy)
@@ -360,7 +360,7 @@
sLog.outDetail( "WORLD: Received CMSG_BUY_ITEM_IN_SLOT" );
uint64 vendorguid, bagguid;
uint32 item;
- uint8 bag, slot, count, vendorslot;
+ uint8 bag, slot, count, vendorslot=0;
recv_data >> vendorguid >> item >> bagguid >> slot >> count;
recv_data.hexlike();
@@ -371,8 +371,7 @@
Creature *pCreature = ObjectAccessor::Instance().GetCreature(*_player, vendorguid);
if( pCreature )
{
- vendorslot = 0;
- for(int i = 0; i < pCreature->GetItemCount(); i++)
+ for(int i = 0; i < pCreature->GetItemCount(); i++)
{
if ( pCreature->GetItemId(i) == item )
{
@@ -380,10 +379,29 @@
break;
}
}
+ if( sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) && (count == 0 || !vendorslot) )
+ {
+ sLog.outCheat("CHEAT: player '%s' [Acc: %u] tried to buy item '%d',count=%u. pos: x=%f y=%f z=%f map=%u. GM=%u", _player->GetName(),_player->GetSession()->GetAccountId(),item,count,_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetMapId(),_player->GetSession()->GetSecurity());
+ if ( _player->GetSession()->GetSecurity() == 0 )
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' tried to cheat item #" << item;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ _player->BanAccount(7);
+ if( sWorld.getConfig(CONFIG_CHEAT_KICK) )
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ }
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK) || sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ return;
+ }
if( !vendorslot )
{
- _player->SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
- return;
+ _player->SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
+ return;
}
else
vendorslot -= 1;
@@ -447,7 +465,7 @@
sLog.outDetail( "WORLD: Received CMSG_BUY_ITEM" );
uint64 vendorguid;
uint32 item;
- uint8 count, unk1, vendorslot;
+ uint8 count, unk1, vendorslot=0;
recv_data >> vendorguid >> item >> count >> unk1;
recv_data.hexlike();
@@ -458,8 +476,7 @@
Creature *pCreature = ObjectAccessor::Instance().GetCreature(*_player, vendorguid);
if( pCreature )
{
- vendorslot = 0;
- for(int i = 0; i < pCreature->GetItemCount(); i++)
+ for(int i = 0; i < pCreature->GetItemCount(); i++)
{
if ( pCreature->GetItemId(i) == item )
{
@@ -467,6 +484,25 @@
break;
}
}
+ if( sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) && (count == 0 || !vendorslot) )
+ {
+ sLog.outCheat("CHEAT: player '%s' [Acc: %u] tried to buy item '%d',count=%u. pos: x=%f y=%f z=%f map=%u. GM=%u", _player->GetName(),_player->GetSession()->GetAccountId(),item,count,_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetMapId(),_player->GetSession()->GetSecurity());
+ if ( _player->GetSession()->GetSecurity() == 0 )
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' tried to cheat item #" << item;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ _player->BanAccount(7);
+ if( sWorld.getConfig(CONFIG_CHEAT_KICK) )
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ }
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK) || sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ return;
+ }
if( !vendorslot )
{
_player->SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
Index: src/game/MovementHandler.cpp
===================================================================
--- src/game/MovementHandler.cpp (revision 2630)
+++ src/game/MovementHandler.cpp (working copy)
@@ -116,7 +116,8 @@
}
void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
-{
+{
+ static uint16 cons_overspeeds = 0;
uint32 flags, time;
float x, y, z, orientation;
@@ -161,9 +162,50 @@
bool isJumping = GetPlayer()->HasMovementFlags(MOVEMENT_JUMPING);
uint16 opcode = recv_data.GetOpcode();
+ // this measures the number of ticks between 2 MSG_MOVE_HEARBEAT. usually it is 500,
+ // if the client got speeded up it is adequate lower. disabled for GMs.
+ if (opcode == MSG_MOVE_HEARTBEAT && sWorld.getConfig(CONFIG_CHEAT_ANTISPEEDHACK) && sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) && GetSecurity() == 0)
+ {
+ clock_t cnow = clock();
+ clock_t diff = cnow - GetPlayer()->GetLastMovHeartBeat();
+ GetPlayer()->SetLastMovHeartBeat(cnow);
+ if (diff<420 && diff>0) // should be 500, little tolerance because the lowest diff i got was 458. (at normal speed, over localhost)
+ {
+ cons_overspeeds++;
+ if(cons_overspeeds>4) // give 4 chances (if it works well it can be set down)
+ {
+ cons_overspeeds = 0;
+ std::stringstream wmsg;
+ wmsg << "CHEAT: Player '" << GetPlayer()->GetName() << "' is moving too fast. It seems the Client has been speeded up [diff=" << diff << "]";
+ if (sWorld.getConfig(CONFIG_CHEAT_BROADCAST))
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ sLog.outCheat(wmsg.str().c_str());
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK))
+ {
+ Terminate(true); // session is invalid after!!
+ return;
+ }
+ if (sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ {
+ // root until relog
+ WorldPacket data;
+ data.Initialize( SMSG_FORCE_MOVE_ROOT );
+ data << (uint0xFF << GetPlayer()->GetGUID() << (uint32)2;
+ SendPacket( &data );
+ return;
+ }
+ }
+ }
+ else
+ if(cons_overspeeds>0)
+ cons_overspeeds--;
+
+ }
+
//Movement flag
if (opcode == MSG_MOVE_HEARTBEAT && isJumping)
GetPlayer( )->SetMovementFlags(GetPlayer( )->GetMovementFlags() & ~MOVEMENT_JUMPING);
+
else
GetPlayer( )->SetMovementFlags(flags);
Index: src/game/Player.cpp
===================================================================
--- src/game/Player.cpp (revision 2630)
+++ src/game/Player.cpp (working copy)
@@ -6355,6 +6355,8 @@
if( pItem->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM), item, const_cast<Player*>(this)) )
{
pItem->SetCount( count );
+ Quest *pQuest = objmgr.NewQuest(pProto->StartQuest);
+ pItem->addQuest(pQuest);
return pItem;
}
else
@@ -10118,6 +10120,8 @@
Item *item = NewItemOrBag(proto);
item->SetSlot(slot);
+ Quest *pQuest = objmgr.NewQuest(proto->StartQuest);
+ item->addQuest(pQuest);
if(!item->LoadFromDB(item_guid, GetGUID()))
{
@@ -11039,6 +11043,16 @@
GetSession()->SendPacket (&data);
}
+void Player::SetBindPointInDB(uint32 mapId, uint32 zoneId, float x, float y, float z)
+{
+ sDatabase.PExecute("UPDATE `character_homebind` SET `map` = %d,`zone` = %d,`position_x` = %f,`position_y` = %f,`position_z` = %f WHERE `guid` = '%u'", mapId, zoneId, x, y, z, GetGUIDLow());
+}
+
+void Player::BanAccount(uint8 num)
+{
+ loginDatabase.PExecute("UPDATE `account` SET `banned` = %u WHERE `id` = %d", num, GetSession()->GetAccountId() );
+}
+
void Player::RemovePetitionsAndSigns(uint64 guid)
{
QueryResult *result = sDatabase.PQuery("SELECT `ownerguid`,`charterguid` FROM `guild_charter_sign` WHERE `playerguid` = '%u'", guid);
@@ -11093,3 +11107,5 @@
//RestTickUpdate
SetUInt32Value(PLAYER_REST_STATE_EXPERIENCE, rest_bonus);
}
+
+
Index: src/game/Player.h
===================================================================
--- src/game/Player.h (revision 2630)
+++ src/game/Player.h (working copy)
@@ -685,6 +685,8 @@
void SetBindPoint(uint64 guid);
void SendTalentWipeConfirm(uint64 guid);
+ void SetBindPointInDB(uint32 mapId, uint32 zoneId, float x, float y, float z);
+ void BanAccount(uint8 num);
void CalcRage( uint32 damage,bool attacker );
void RegenerateAll();
void Regenerate(Powers power);
@@ -991,6 +993,8 @@
void UpdateMaxSkills();
void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
void ModifySkillBonus(uint32 skillid,int32 val);
+ clock_t GetLastMovHeartBeat(void) { return m_lastMovHeartBeat; }
+ void SetLastMovHeartBeat(clock_t t) { m_lastMovHeartBeat = t; }
/*********************************************************/
/*** HONOR SYSTEM ***/
@@ -1286,6 +1290,7 @@
uint32 m_ArmorProficiency;
bool m_canParry;
bool m_canDualWield;
+ clock_t m_lastMovHeartBeat;
////////////////////Rest System/////////////////////
int time_inn_enter;
float inn_pos_x;
Index: src/game/QuestHandler.cpp
===================================================================
--- src/game/QuestHandler.cpp (revision 2630)
+++ src/game/QuestHandler.cpp (working copy)
@@ -86,13 +86,35 @@
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
- Object* pObject = ObjectAccessor::Instance().GetObjectByTypeMask(*_player, guid,TYPE_UNIT|TYPE_GAMEOBJECT|TYPE_ITEM);
+ Object* pObject = ObjectAccessor::Instance().GetObjectByTypeMask(*_player, guid,TYPE_UNIT+TYPE_GAMEOBJECT+TYPE_ITEM+TYPE_PLAYER);
if(!pObject||!pObject->hasQuest(quest))
{
_player->PlayerTalkClass->CloseGossip();
return;
}
+ if( (!pObject||!pObject->hasQuest(quest)) && sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) && pObject->GetTypeId()!=4 )
+ {
+ //_player->PlayerTalkClass->CloseGossip();
+ sLog.outCheat("CHEAT: player '%s' [Acc: %u] tried to spoof accept of quest '%d'. pos: x=%f y=%f z=%f map=%u. GM=%u", _player->GetName(),_player->GetSession()->GetAccountId(),quest,_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetMapId(),_player->GetSession()->GetSecurity());
+ if ( _player->GetSession()->GetSecurity() == 0)
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' spoofed accept of quest #" << quest;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ _player->BanAccount(;
+ if( sWorld.getConfig(CONFIG_CHEAT_KICK) )
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+
+ }
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK) || sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ return;
+ }
+
QuestInfo const* qInfo = objmgr.GetQuestInfo(quest);
if ( qInfo )
{
@@ -149,10 +171,25 @@
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
Object* pObject = ObjectAccessor::Instance().GetObjectByTypeMask(*_player, guid,TYPE_UNIT|TYPE_GAMEOBJECT|TYPE_ITEM);
- if(!pObject||!pObject->hasQuest(quest) && !pObject->hasInvolvedQuest(quest))
+ if( (!pObject||!pObject->hasQuest(quest)) && !pObject->hasInvolvedQuest(quest) && pObject->GetTypeId()!=4 && sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION))
{
- _player->PlayerTalkClass->CloseGossip();
- return;
+ //_player->PlayerTalkClass->CloseGossip();
+ sLog.outCheat("CHEAT: player '%s' [Acc: %u] tried to spoof query of quest '%d'. pos: x=%f y=%f z=%f map=%u. GM=%u", _player->GetName(),_player->GetSession()->GetAccountId(),quest,_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetMapId(),_player->GetSession()->GetSecurity());
+ if ( _player->GetSession()->GetSecurity() == 0)
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' spoofed query of quest #" << quest;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ _player->BanAccount(;
+ if( sWorld.getConfig(CONFIG_CHEAT_KICK) )
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK) || sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ return;
+ }
}
Quest *pQuest = objmgr.NewQuest(quest);
@@ -223,12 +260,31 @@
recv_data >> guid >> quest >> reward;
sLog.outDetail( "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u",uint32(GUID_LOPART(guid)),quest,reward );
-
+
Object* pObject = ObjectAccessor::Instance().GetObjectByTypeMask(*_player, guid,TYPE_UNIT|TYPE_GAMEOBJECT);
- if(!pObject||!pObject->hasInvolvedQuest(quest))
- return;
- Quest *pQuest = objmgr.NewQuest(quest);
+ if( (!pObject||!pObject->hasInvolvedQuest(quest)) && sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION))
+ {
+ //_player->PlayerTalkClass->CloseGossip();
+ sLog.outCheat("CHEAT: player '%s' [Acc: %u] tried to spoof reward of quest '%d'. pos: x=%f y=%f z=%f map=%u. GM=%u", _player->GetName(),_player->GetSession()->GetAccountId(),quest,_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetMapId(),_player->GetSession()->GetSecurity());
+ if ( _player->GetSession()->GetSecurity() == 0)
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' spoofed reward of quest #" << quest;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ _player->BanAccount(;
+ if( sWorld.getConfig(CONFIG_CHEAT_KICK) )
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK) || sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ return;
+ }
+ }
+
+ Quest *pQuest = objmgr.NewQuest( quest );
if( pQuest )
{
if( _player->CanRewardQuest( pQuest, reward, true ) )
@@ -267,15 +323,34 @@
sLog.outDetail( "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
Object* pObject = ObjectAccessor::Instance().GetObjectByTypeMask(*_player, guid,TYPE_UNIT|TYPE_GAMEOBJECT);
- if(!pObject||!pObject->hasInvolvedQuest(quest))
- return;
+
+ if ( (!pObject||!pObject->hasInvolvedQuest(quest)) && sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) )
+ {
+ //_player->PlayerTalkClass->CloseGossip();
+ sLog.outCheat("CHEAT: player '%s' [Acc: %u] tried to spoof reward-request of quest '%d'. pos: x=%f y=%f z=%f map=%u. GM=%u", _player->GetName(),_player->GetSession()->GetAccountId(),quest,_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetMapId(),_player->GetSession()->GetSecurity());
+ if ( _player->GetSession()->GetSecurity() == 0)
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' spoofed reward-request of quest #" << quest;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ _player->BanAccount(;
+ if( sWorld.getConfig(CONFIG_CHEAT_KICK) )
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK) || sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ return;
+ }
+ }
Quest *pQuest = objmgr.NewQuest( quest );
if( pQuest )
- {
- if ( _player->CanCompleteQuest( quest ) )
+ {
+ if ( _player->CanCompleteQuest( quest ) )
_player->PlayerTalkClass->SendQuestReward( quest, guid, true, NULL, 0);
- delete pQuest;
+ delete pQuest;
}
}
@@ -348,6 +423,28 @@
sLog.outDetail( "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
+
+ Object* pObject = ObjectAccessor::Instance().GetObjectByTypeMask(*_player, guid,TYPE_UNIT+TYPE_GAMEOBJECT);
+ if ( (!pObject || !pObject->hasInvolvedQuest(quest)) && sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) )
+ {
+ sLog.outCheat("CHEAT: player '%s' [Acc: %u] tried to spoof completion of quest '%d'. pos: x=%f y=%f z=%f map=%u. GM=%u", _player->GetName(),_player->GetSession()->GetAccountId(),quest,_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetMapId(),_player->GetSession()->GetSecurity());
+ if ( _player->GetSession()->GetSecurity() == 0)
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' spoofed completion of quest #" << quest;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ _player->BanAccount(;
+ if( sWorld.getConfig(CONFIG_CHEAT_KICK) )
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK) || sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ return; // do not complete quest
+ }
+ }
+
Quest *pQuest = objmgr.NewQuest( quest );
if( pQuest )
{
Index: src/game/SpellHandler.cpp
===================================================================
--- src/game/SpellHandler.cpp (revision 2630)
+++ src/game/SpellHandler.cpp (working copy)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
*
* This program is free software; you can redistribute it and/or modify
@@ -303,12 +303,71 @@
return;
}
- if ( !_player->HasSpell (spellId) )
- {
- //cheater? kick? ban?
- return;
- }
+ // for basic spell anticheat:
+ if ( sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) )
+ {
+ bool isSpellCheat = false;
+ uint32 req_GM, req_Level, req_Class;
+ std::string desc;
+ // check if the player owns the spell. this blocks cheats like WoWc or Wpe pro spell packet editing
+ if (
+ ((!_player->HasSpell(spellId)) && _player->GetSession()->GetSecurity() == 0) && // only GMs may cast spells they don't own
+ _player->IsInWorld() // the player has to be in the world to be treated as cheater. (on login spell 836 is casted, another one is casted on char enum, forgot the id.)
+ )
+ {
+ isSpellCheat = true;
+ }
+ if( (!isSpellCheat) && _player->IsInWorld() && sWorld.getConfig(CONFIG_CHEAT_CHECKSPELLDB) ) // player has spell, now lets check if the player may cast it
+ {
+ QueryResult *result = sDatabase.PQuery("SELECT `Req_GM`,`Req_Level`,`Req_Class`,`Description` FROM `Spell_Anticheat` WHERE `SpellID` = %d", spellId);
+ if (result)
+ {
+ req_GM = (*result)[0].GetUInt32();
+ req_Level = (*result)[1].GetUInt32();
+ req_Class = (*result)[2].GetUInt32();
+ desc = (*result)[3].GetString();
+
+ if ( _player->GetSession()->GetSecurity() < req_GM )
+ {
+ isSpellCheat = true;
+ }
+
+ if ( _player->getLevel() < req_Level && _player->GetSession()->GetSecurity() == 0 )
+ {
+ isSpellCheat = true;
+ }
+
+ if ( req_Class != 0 && req_Class != _player->getClass() && _player->GetSession()->GetSecurity() == 0 )
+ {
+ isSpellCheat = true;
+ }
+ delete result;
+ }
+
+ }
+ if ( isSpellCheat )
+ {
+ sLog.outCheat("CHEAT: Player '%s' [Acc: %u] casted Spell '%d'. pos: x=%f y=%f z=%f map=%u. GM=%u", _player->GetName(),_player->GetSession()->GetAccountId(),spellId,_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetMapId(),_player->GetSession()->GetSecurity());
+ if ( _player->GetSession()->GetSecurity() == 0 ) // prevent GMs from beeing banned
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' tried to spoof spell #" << spellId;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ _player->BanAccount(9);
+ if( sWorld.getConfig(CONFIG_CHEAT_KICK) )
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+
+ }
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK) || sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ return;
+ }
+ }
+
Spell *spell;
spell = new Spell(_player, spellInfo, false, 0);
Index: src/game/World.cpp
===================================================================
--- src/game/World.cpp (revision 2630)
+++ src/game/World.cpp (working copy)
@@ -243,6 +243,15 @@
m_configs[CONFIG_GM_WISPERING_TO] = sConfig.GetIntDefault("GM.WhisperingTo",0);
m_configs[CONFIG_GM_IN_WHO_LIST] = sConfig.GetIntDefault("GM.InWhoList",0);
+ m_configs[CONFIG_CHEAT_BROADCAST] = sConfig.GetBoolDefault("Cheat.Broadcast",1);
+ m_configs[CONFIG_CHEAT_BAN] = sConfig.GetBoolDefault("Cheat.Ban",1);
+ m_configs[CONFIG_CHEAT_ENABLEPROTECTION] = sConfig.GetBoolDefault("Cheat.EnableProtection",0);
+ m_configs[CONFIG_CHEAT_CHECKSPELLDB] = sConfig.GetBoolDefault("Cheat.CheckSpellDB",0);
+ m_configs[CONFIG_CHEAT_PREVENT] = sConfig.GetBoolDefault("Cheat.Prevent",1);
+ m_configs[CONFIG_CHEAT_KICK] = sConfig.GetBoolDefault("Cheat.Kick",1);
+ m_configs[CONFIG_CHEAT_ANTISPEEDHACK] = sConfig.GetBoolDefault("Cheat.AntiSpeedHack",0);
+ m_configs[CONFIG_CHEAT_CHECKPING] = sConfig.GetBoolDefault("Cheat.CheckPing",0);
+ m_configs[CONFIG_SEPARATE_FACTION] = sConfig.GetIntDefault("SeparateFaction",1);
m_gameTime = time(NULL);
Index: src/game/World.h
===================================================================
--- src/game/World.h (revision 2630)
+++ src/game/World.h (working copy)
@@ -66,6 +66,15 @@
CONFIG_MIN_PETITION_SIGNS,
CONFIG_GM_WISPERING_TO,
CONFIG_GM_IN_WHO_LIST,
+ CONFIG_CHEAT_ENABLEPROTECTION,
+ CONFIG_CHEAT_BAN,
+ CONFIG_CHEAT_BROADCAST,
+ CONFIG_CHEAT_CHECKSPELLDB,
+ CONFIG_CHEAT_PREVENT,
+ CONFIG_CHEAT_KICK,
+ CONFIG_CHEAT_ANTISPEEDHACK,
+ CONFIG_CHEAT_CHECKPING,
+ CONFIG_SEPARATE_FACTION,
CONFIG_VALUE_COUNT
};
Index: src/game/WorldSession.cpp
===================================================================
--- src/game/WorldSession.cpp (revision 2630)
+++ src/game/WorldSession.cpp (working copy)
@@ -530,3 +530,52 @@
uint32 spellid;
recv_data >> spellid;
}
+
+void WorldSession::Terminate( bool save )
+{
+ LogoutPlayer(save);
+ _socket->SetCloseAndDelete(true);
+}
+
+// this measures the number of ticks between 2 CMSG_PINGs. usually it is 30000,
+// if the client got speeded up it is adequate lower. disabled for GMs.
+void WorldSession::CheckPingSpeed(void)
+{
+ static uint16 cons_overspeed_ping = 0;
+ if(GetSecurity()>0)
+ return;
+ clock_t cnow = clock();
+ clock_t diff = cnow - GetLastPingClock();
+ SetLastPingClock(cnow);
+ if(diff<27000 && diff>0) // should be 30000 (=30 secs), add little tolerance
+ {
+ cons_overspeed_ping++;
+ if(cons_overspeed_ping>2) // give 2 chances (if it works well it can be set down)
+ {
+ cons_overspeed_ping = 0;
+ std::stringstream wmsg;
+ wmsg << "CHEAT: Player '" << GetPlayer()->GetName() << "' is pinging too fast. It seems the Client has been speeded up [diff=" << diff << "]";
+ if (sWorld.getConfig(CONFIG_CHEAT_BROADCAST))
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ sLog.outCheat(wmsg.str().c_str());
+ if(sWorld.getConfig(CONFIG_CHEAT_KICK))
+ {
+ Terminate(true); // session is invalid after!!
+ return;
+ }
+ if (sWorld.getConfig(CONFIG_CHEAT_PREVENT))
+ {
+ // root until relog
+ WorldPacket data;
+ data.Initialize( SMSG_FORCE_MOVE_ROOT );
+ data << (uint0xFF << GetPlayer()->GetGUID() << (uint32)2;
+ SendPacket( &data );
+ return;
+ }
+ }
+ }
+ else
+ if(cons_overspeed_ping>0)
+ cons_overspeed_ping--;
+
+}
Index: src/game/WorldSession.h
===================================================================
--- src/game/WorldSession.h (revision 2630)
+++ src/game/WorldSession.h (working copy)
@@ -58,6 +58,9 @@
void SetSecurity(uint32 security) { _security = security; }
void SetSocket(WorldSocket *sock);
void SetPlayer(Player *plr) { _player = plr; }
+ void SetLastPingClock(clock_t c) { _lastPing = c; }
+ clock_t GetLastPingClock(void) { return _lastPing; }
+ void CheckPingSpeed(void);
bool isLogingOut()
{
@@ -78,6 +81,7 @@
void QueuePacket(WorldPacket& packet);
bool Update(uint32 diff);
+ void Terminate(bool save);
void SendTestCreatureQueryOpcode( uint32 entry, uint64 guid, uint32 testvalue );
void SendNameQueryOpcode(Player* p, bool to_less_security = false);
@@ -423,6 +427,7 @@
uint32 _accountId;
time_t _logoutTime;
+ clock_t _lastPing;
ZThread::LockedQueue<WorldPacket*,ZThread::FastMutex> _recvQueue;
};
Index: src/game/WorldSocket.cpp
===================================================================
--- src/game/WorldSocket.cpp (revision 2630)
+++ src/game/WorldSocket.cpp (working copy)
@@ -403,7 +403,10 @@
packet.Initialize( SMSG_PONG );
packet << ping;
SendPacket(&packet);
-
+
+ if(sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) && sWorld.getConfig(CONFIG_CHEAT_CHECKPING) )
+ _session->CheckPingSpeed();
+
return;
}
____________________
Sucks, doesnt it :P
Avatar
----(please leave the copyright info below intact)----
This post is copyright by the user posting it and MMOwned.com - World of Warcraft Exploits,Hacks, Bots and Guides, where it was posted. You may not copy or reproduce the above on any other site without written permission from both the poster and MMOwned.com