[Admin] tierrilopes Posted November 6, 2017 at 01:05 AM Share Posted November 6, 2017 at 01:05 AM Go to file root/intrologin.py Look for: "WRONGPWD" : localeInfo.LOGIN_FAILURE_WRONG_PASSWORD, Add this bellow: "HWBANNED" : "Login from this computer has been blocked", Client source Go to UserInterface/AccountConnector.cpp Look for: bool CAccountConnector::__AuthState_RecvEmpty() { BYTE byEmpty; Recv (sizeof (BYTE), &byEmpty); return true; } Add this bellow: //hardware ban revised #include <intrin.h> #include <Iphlpapi.h> #pragma comment(lib, "iphlpapi.lib") const char* GetMacAddress() { PIP_ADAPTER_INFO AdapterInfo; DWORD dwBufLen = sizeof(AdapterInfo); char *mac_addr = (char*)malloc(17); AdapterInfo = (IP_ADAPTER_INFO *)malloc(sizeof(IP_ADAPTER_INFO)); if (!AdapterInfo) { return ""; } if (GetAdaptersInfo(AdapterInfo, &dwBufLen) == ERROR_BUFFER_OVERFLOW) { AdapterInfo = (IP_ADAPTER_INFO *)malloc(dwBufLen); if (!AdapterInfo) { return ""; } } CHAR _MACFORMAT[] = { '%', '0', '2', 'X', ':', '%', '0', '2', 'X', ':', '%', '0', '2', 'X', ':', '%', '0', '2', 'X', ':', '%', '0', '2', 'X', ':', '%', '0', '2', 'X', 0x0 }; //"%02X:%02X:%02X:%02X:%02X:%02X" if (GetAdaptersInfo(AdapterInfo, &dwBufLen) == NO_ERROR) { PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; do { sprintf(mac_addr, _MACFORMAT, pAdapterInfo->Address[0], pAdapterInfo->Address[1], pAdapterInfo->Address[2], pAdapterInfo->Address[3], pAdapterInfo->Address[4], pAdapterInfo->Address[5]); return mac_addr; pAdapterInfo = pAdapterInfo->Next; } while (pAdapterInfo); } free(AdapterInfo); return NULL; } //hardware ban revised Inside: bool CAccountConnector::__AuthState_RecvPhase() Look for: strncpy (LoginPacket.name, m_strID.c_str(), ID_MAX_NUM); strncpy (LoginPacket.pwd, m_strPassword.c_str(), PASS_MAX_NUM); Add this bellow: //hardware ban revised strncpy(LoginPacket.cHWInfo, GetMacAddress(), sizeof(LoginPacket.cHWInfo) - 1); //hardware ban revised Look for: LoginPacket.name[ID_MAX_NUM] = '\0'; LoginPacket.pwd[PASS_MAX_NUM] = '\0'; Add this bellow: //hardware ban revised LoginPacket.cHWInfo[255] = '\0'; //hardware ban revised Go to file UserInterface/Packet.h Look for: typedef struct command_login3 { BYTE header; char name[ID_MAX_NUM + 1]; char pwd[PASS_MAX_NUM + 1]; DWORD adwClientKey[4]; } TPacketCGLogin3; Replace with: typedef struct command_login3 { BYTE header; char name[ID_MAX_NUM + 1]; char pwd[PASS_MAX_NUM + 1]; DWORD adwClientKey[4]; char cHWInfo[255 + 1]; //hardware ban revised } TPacketCGLogin3; Game source Go to file game/Packet.h Look for: typedef struct command_login3 { BYTE header; char login[LOGIN_MAX_LEN + 1]; char passwd[PASSWD_MAX_LEN + 1]; DWORD adwClientKey[4]; } TPacketCGLogin3; Replace with: typedef struct command_login3 { BYTE header; char login[LOGIN_MAX_LEN + 1]; char passwd[PASSWD_MAX_LEN + 1]; DWORD adwClientKey[4]; char cHWInfo[255 + 1]; // hardware ban revised } TPacketCGLogin3; Go to file game/input_auth.cpp Look for: if (false == FN_IS_VALID_LOGIN_STRING (login)) { sys_log (0, "InputAuth::Login : IS_NOT_VALID_LOGIN_STRING(%s) desc %p", login, get_pointer (d)); LoginFailure (d, "NOID"); return; } Add this bellow: //hardware ban revised char query[1024]; snprintf(query, sizeof(query),"SELECT hwid FROM account.hwid_ban WHERE hwid = '%s'", pinfo->cHWInfo); std::auto_ptr<SQLMsg> execquery(DBManager::instance().DirectQuery(query)); if (execquery->Get()->uiNumRows >= 1) { LoginFailure(d, "HWBANNED"); return; } //hardware ban revised Go to file game/db.cpp Look for: char szQuery[1024]; snprintf (szQuery, sizeof (szQuery), "UPDATE account SET last_play=NOW() WHERE id=%u", dwID); std::auto_ptr<SQLMsg> msg (DBManager::instance().DirectQuery (szQuery)); Add this bellow: //hardware ban revised char szHwid[255 * 2 + 1]; DBManager::instance().EscapeString(szHwid, sizeof(szHwid), pinfo->cHWInfo, strlen(pinfo->cHWInfo)); char szQuery2[1024]; snprintf (szQuery2, sizeof (szQuery2), "UPDATE account SET hwid='%s' WHERE id=%u", szHwid, dwID); //Updates hwid of the account std::auto_ptr<SQLMsg> msg2 (DBManager::instance().DirectQuery (szQuery2)); //hardware ban revised Run this queries inside account database: DROP TABLE IF EXISTS `hwid_ban`; CREATE TABLE `hwid_ban` ( `id` int(11) NOT NULL AUTO_INCREMENT, `hwid` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; ALTER TABLE `account` ADD COLUMN `hwid` text DEFAULT NULL; 4 Link to comment
F-Caneiras Posted November 6, 2017 at 01:35 AM Share Posted November 6, 2017 at 01:35 AM Muito bom isso serve para quando adicionamos o ip banido no srvidor mesmo que o jogador tente entrar o cliente vai receber automaticamente ordem de não abrir ? Link to comment
Metin2 Posted November 6, 2017 at 01:44 AM Share Posted November 6, 2017 at 01:44 AM pelo que vi o player poderá entrar no server se trocar a placa mãe para alterar o ip. Link to comment
[Admin] tierrilopes Posted November 6, 2017 at 01:45 AM Author Share Posted November 6, 2017 at 01:45 AM Jogador ao fazer login, irá aparecer na sua conta (account.account), na tabela hwid o endereço mac da placa de rede com que entrou. Ao adicionar esse valor à lista em account.hwid_ban, o jogador não conseguirá fazer login @Darkness ban permanece mesmo aquando de mudança de ip, no entanto sim, é possível modificar endereço mac sem muita dificuldade O que aconselho é utilizar como base para criarem o vosso próprio método de identificar o computador. Para tal basta criarem uma função nova e substituir onde está a ser chamada a GetMacAddress() pela vossa Link to comment
Metin2 Posted November 6, 2017 at 01:50 AM Share Posted November 6, 2017 at 01:50 AM Muito bom vou usar . Link to comment
LuizFernando Posted February 28, 2018 at 06:11 PM Share Posted February 28, 2018 at 06:11 PM Eu fiz tudo que me diz ai, quando eu logo grava o ip da placa mãe e coloco no hwid_ban e mesmo assim consigo logar. Link to comment
[Admin] tierrilopes Posted February 28, 2018 at 06:35 PM Author Share Posted February 28, 2018 at 06:35 PM Print do hwid da tabela account e da tabela hwid_ban sff Link to comment
LuizFernando Posted February 28, 2018 at 06:47 PM Share Posted February 28, 2018 at 06:47 PM 2 Link to comment
WLN Posted February 28, 2018 at 07:33 PM Share Posted February 28, 2018 at 07:33 PM (edited) fez algo mal, a minha está assim Edited February 28, 2018 at 07:34 PM by wery 1 Link to comment
LuizFernando Posted February 28, 2018 at 07:37 PM Share Posted February 28, 2018 at 07:37 PM (edited) Refiz todo o tutorial e ainda não grava o correto. Edited February 28, 2018 at 09:22 PM by LuizFernando Link to comment
Marcos Daniel Posted March 4, 2018 at 05:37 PM Share Posted March 4, 2018 at 05:37 PM 100% a funcionar +1 Link to comment
igoriap Posted April 17, 2018 at 07:52 PM Share Posted April 17, 2018 at 07:52 PM Fiz tudo e quando loga , sobe esse mac.. 1 Link to comment
WLN Posted May 1, 2018 at 09:25 PM Share Posted May 1, 2018 at 09:25 PM para quem tem o problema de registrar mac, usem este arquivo, creio que resolva qualquer problema de registrar mac AccountConnector.cpp 1 Link to comment
CAMBOJA Posted September 13, 2020 at 03:06 PM Share Posted September 13, 2020 at 03:06 PM Vou testar Link to comment
barros1985 Posted September 13, 2020 at 03:06 PM Share Posted September 13, 2020 at 03:06 PM vou testa! Link to comment
nissangtr Posted October 6, 2021 at 07:25 AM Share Posted October 6, 2021 at 07:25 AM Thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now