Active Member Koray 2011 Posted November 23, 2014 Active Member Share Posted November 23, 2014 (edited) M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Hi devs, I created simple wait hack detection and ban system open "battle.cpp" and add ths include #include "db.h" Result; search "bool IS_SPEED_HACK(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time)" and replace with this #define ENABLE_SYSCHAT_NOTICE #define ENABLE_SYSLOG_NOTICE #define ENABLE_BAN_WAITHACK bool IS_SPEED_HACK(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time) { if (ch->m_kAttackLog.dwVID == victim->GetVID()) { if (current_time - ch->m_kAttackLog.dwTime < GET_ATTACK_SPEED(ch)) { INCREASE_SPEED_HACK_COUNT(ch); if (test_server) { sys_log(0, "%s attack hack! time (delta, limit)=(%u, %u) hack_count %d", ch->GetName(), current_time - ch->m_kAttackLog.dwTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); ch->ChatPacket(CHAT_TYPE_INFO, "%s attack hack! time (delta, limit)=(%u, %u) hack_count %d", ch->GetName(), current_time - ch->m_kAttackLog.dwTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); } SET_ATTACK_TIME(ch, victim, current_time); SET_ATTACKED_TIME(ch, victim, current_time); return true; } } SET_ATTACK_TIME(ch, victim, current_time); if (victim->m_AttackedLog.dwPID == ch->GetPlayerID()) { if (current_time - victim->m_AttackedLog.dwAttackedTime < GET_ATTACK_SPEED(ch)) { INCREASE_SPEED_HACK_COUNT(ch); if (ch->m_speed_hack_count > 50) { #ifdef ENABLE_SYSLOG_NOTICE sys_log(0, "%s Attack Speed HACK! time (delta, limit)=(%u, %u), hack_count = %d", ch->GetName(), current_time - victim->m_AttackedLog.dwAttackedTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); #endif #ifdef ENABLE_SYSCHAT_NOTICE ch->ChatPacket(CHAT_TYPE_INFO, "Attack Speed Hack(%s), (delta, limit)=(%u, %u), hack_count = %d", ch->GetName(), current_time - victim->m_AttackedLog.dwAttackedTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); #endif #ifdef ENABLE_BAN_WAITHACK std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("UPDATE account.account SET status= 'BLOCK' WHERE id = %d", ch->GetDesc()->GetAccountTable().id)); #endif ch->GetDesc()->DelayedDisconnect(3); } SET_ATTACKED_TIME(ch, victim, current_time); return true; } } SET_ATTACKED_TIME(ch, victim, current_time); return false; } Before: https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif After: https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif Final: Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal 33 1 10 1 3 49 Link to comment Share on other sites More sharing options...
MORTE 79 Posted November 23, 2014 Share Posted November 23, 2014 thanks 1 Link to comment Share on other sites More sharing options...
Former Staff flygun 304 Posted November 23, 2014 Former Staff Share Posted November 23, 2014 can you explain more ??? //can't open youtube right now Link to comment Share on other sites More sharing options...
Zeta 11 Posted November 23, 2014 Share Posted November 23, 2014 THANKS 1 Link to comment Share on other sites More sharing options...
Premium Galet 514 Posted November 23, 2014 Premium Share Posted November 23, 2014 Wow, thanks ! 1 Link to comment Share on other sites More sharing options...
Endymion 323 Posted November 23, 2014 Share Posted November 23, 2014 Bans by game are bad idea. It makes too many fake results. 2 Link to comment Share on other sites More sharing options...
Active Member Koray 2011 Posted November 23, 2014 Author Active Member Share Posted November 23, 2014 Bans by game are bad idea. It makes too many fake results. for that reason avarage 50 > still you're right ban,log and notice selectable uses wanting Link to comment Share on other sites More sharing options...
Endymion 323 Posted November 23, 2014 Share Posted November 23, 2014 (edited) I did it like this: Works fine. If game detected using hack 5 times in minute It will notice that in logs. Edited August 18, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
zw0w 3 Posted November 24, 2014 Share Posted November 24, 2014 Edit, sorry for post. Link to comment Share on other sites More sharing options...
YukiPowa 5 Posted December 20, 2014 Share Posted December 20, 2014 player no use cheat => banned Link to comment Share on other sites More sharing options...
Premium Cataclismo 86 Posted December 25, 2014 Premium Share Posted December 25, 2014 Ride a horse and make sure you have maximum attack speed that can be made on a server. Test it now. Please, let me (us) know if it's still working ok. Link to comment Share on other sites More sharing options...
Destiny 12 Posted December 31, 2014 Share Posted December 31, 2014 I changed if (ch->m_speed_hack_count > 50) with if (ch->m_speed_hack_count > 5) And works verry good . I work on mainline sg ,pvm hard server ; This protection can cause fake result and ban a fair player ? Link to comment Share on other sites More sharing options...
ScreamMyName 100 Posted January 1, 2015 Share Posted January 1, 2015 I'm pretty sure if you play ninja with daggers you will get banned Link to comment Share on other sites More sharing options...
Destiny 12 Posted January 1, 2015 Share Posted January 1, 2015 Wasn't a good ideea , but with >50 works fine now ; I'm pretty sure if you play ninja with daggers you will get banned The ninja character is the most secured , even you use hack you won't get ban so fast . i dont know why... Link to comment Share on other sites More sharing options...
Premium Galet 514 Posted January 1, 2015 Premium Share Posted January 1, 2015 Does anyone had a false positive that do ban a player not cheating? Link to comment Share on other sites More sharing options...
Destiny 12 Posted January 1, 2015 Share Posted January 1, 2015 Metod log > more secure : #define ENABLE_SYSCHAT_NOTICE #define ENABLE_SYSLOG_NOTICE #define ENABLE_BAN_WAITHACK bool IS_SPEED_HACK(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time) { if (ch->m_kAttackLog.dwVID == victim->GetVID()) { if (current_time - ch->m_kAttackLog.dwTime < GET_ATTACK_SPEED(ch)) { INCREASE_SPEED_HACK_COUNT(ch); if (test_server) { sys_log(0, "%s attack hack! time (delta, limit)=(%u, %u) hack_count %d", ch->GetName(), current_time - ch->m_kAttackLog.dwTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); ch->ChatPacket(CHAT_TYPE_INFO, "%s attack hack! time (delta, limit)=(%u, %u) hack_count %d", ch->GetName(), current_time - ch->m_kAttackLog.dwTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); } SET_ATTACK_TIME(ch, victim, current_time); SET_ATTACKED_TIME(ch, victim, current_time); return true; } } SET_ATTACK_TIME(ch, victim, current_time); if (victim->m_AttackedLog.dwPID == ch->GetPlayerID()) { if (current_time - victim->m_AttackedLog.dwAttackedTime < GET_ATTACK_SPEED(ch)) { INCREASE_SPEED_HACK_COUNT(ch); if (ch->m_speed_hack_count > 100) { #ifdef ENABLE_SYSLOG_NOTICE sys_log(0, "%s Attack Speed HACK! time (delta, limit)=(%u, %u), hack_count = %d", ch->GetName(), current_time - victim->m_AttackedLog.dwAttackedTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); #endif #ifdef ENABLE_SYSCHAT_NOTICE ch->ChatPacket(CHAT_TYPE_INFO, "A hack was detected , close it!", ch->GetName(), current_time - victim->m_AttackedLog.dwAttackedTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); #endif #ifdef ENABLE_BAN_WAITHACK DBManager::instance().Query("INSERT INTO log.wait_hack SET login='%s', nickname='%s', ip='%s', time=NOW(), map_index=%d, server='%s';", ch->GetDesc()->GetAccountTable().login, ch->GetName(), ch->GetDesc()->GetHostName(), ch->GetMapIndex(), g_stHostname.c_str()); #endif ch->GetDesc()->DelayedDisconnect(3); } SET_ATTACKED_TIME(ch, victim, current_time); return true; } } SET_ATTACKED_TIME(ch, victim, current_time); return false; } Create in database log a table with name : wait_hack /* Navicat MySQL Data Transfer Source Server : test Source Server Version : 50613 Source Host : Source Database : log Target Server Type : MYSQL Target Server Version : 50613 File Encoding : 65001 Date: 2015-01-02 12:54:57 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for wait_hack -- ---------------------------- DROP TABLE IF EXISTS `wait_hack`; CREATE TABLE `wait_hack` ( `login` varchar(50) COLLATE big5_bin DEFAULT NULL, `nickname` varchar(50) COLLATE big5_bin DEFAULT NULL, `ip` varchar(50) COLLATE big5_bin DEFAULT NULL, `time` time DEFAULT NULL, `map_index` varchar(30) COLLATE big5_bin DEFAULT NULL, `server` varchar(30) COLLATE big5_bin DEFAULT NULL, `playtime` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=big5 COLLATE=big5_bin; It is more secure now . 1 6 Link to comment Share on other sites More sharing options...
skill178 19 Posted July 14, 2015 Share Posted July 14, 2015 player no use cheat => banned HELPPP 1 Link to comment Share on other sites More sharing options...
MORTE 79 Posted August 3, 2015 Share Posted August 3, 2015 Metod log > more secure : #define ENABLE_SYSCHAT_NOTICE #define ENABLE_SYSLOG_NOTICE #define ENABLE_BAN_WAITHACK bool IS_SPEED_HACK(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time) { if (ch->m_kAttackLog.dwVID == victim->GetVID()) { if (current_time - ch->m_kAttackLog.dwTime < GET_ATTACK_SPEED(ch)) { INCREASE_SPEED_HACK_COUNT(ch); if (test_server) { sys_log(0, "%s attack hack! time (delta, limit)=(%u, %u) hack_count %d", ch->GetName(), current_time - ch->m_kAttackLog.dwTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); ch->ChatPacket(CHAT_TYPE_INFO, "%s attack hack! time (delta, limit)=(%u, %u) hack_count %d", ch->GetName(), current_time - ch->m_kAttackLog.dwTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); } SET_ATTACK_TIME(ch, victim, current_time); SET_ATTACKED_TIME(ch, victim, current_time); return true; } } SET_ATTACK_TIME(ch, victim, current_time); if (victim->m_AttackedLog.dwPID == ch->GetPlayerID()) { if (current_time - victim->m_AttackedLog.dwAttackedTime < GET_ATTACK_SPEED(ch)) { INCREASE_SPEED_HACK_COUNT(ch); if (ch->m_speed_hack_count > 100) { #ifdef ENABLE_SYSLOG_NOTICE sys_log(0, "%s Attack Speed HACK! time (delta, limit)=(%u, %u), hack_count = %d", ch->GetName(), current_time - victim->m_AttackedLog.dwAttackedTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); #endif #ifdef ENABLE_SYSCHAT_NOTICE ch->ChatPacket(CHAT_TYPE_INFO, "A hack was detected , close it!", ch->GetName(), current_time - victim->m_AttackedLog.dwAttackedTime, GET_ATTACK_SPEED(ch), ch->m_speed_hack_count); #endif #ifdef ENABLE_BAN_WAITHACK DBManager::instance().Query("INSERT INTO log.wait_hack SET login='%s', nickname='%s', ip='%s', time=NOW(), map_index=%d, server='%s';", ch->GetDesc()->GetAccountTable().login, ch->GetName(), ch->GetDesc()->GetHostName(), ch->GetMapIndex(), g_stHostname.c_str()); #endif ch->GetDesc()->DelayedDisconnect(3); } SET_ATTACKED_TIME(ch, victim, current_time); return true; } } SET_ATTACKED_TIME(ch, victim, current_time); return false; } Create in database log a table with name : wait_hack /* Navicat MySQL Data Transfer Source Server : test Source Server Version : 50613 Source Host : Source Database : log Target Server Type : MYSQL Target Server Version : 50613 File Encoding : 65001 Date: 2015-01-02 12:54:57 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for wait_hack -- ---------------------------- DROP TABLE IF EXISTS `wait_hack`; CREATE TABLE `wait_hack` ( `login` varchar(50) COLLATE big5_bin DEFAULT NULL, `nickname` varchar(50) COLLATE big5_bin DEFAULT NULL, `ip` varchar(50) COLLATE big5_bin DEFAULT NULL, `time` time DEFAULT NULL, `map_index` varchar(30) COLLATE big5_bin DEFAULT NULL, `server` varchar(30) COLLATE big5_bin DEFAULT NULL, `playtime` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=big5 COLLATE=big5_bin; It is more secure now . I used for 10 minutes at a pro damage and did not create any log help me 1 Link to comment Share on other sites More sharing options...
avertuss 48 Posted July 14, 2016 Share Posted July 14, 2016 Once it worked. Now it does not work XD Do not save logs in the database. Link to comment Share on other sites More sharing options...
Guest Anonymous Posted August 15, 2021 Share Posted August 15, 2021 aleluia Link to comment Share on other sites More sharing options...
qrzy00 0 Posted August 19, 2021 Share Posted August 19, 2021 aleluia Link to comment Share on other sites More sharing options...
Recommended Posts