Codex anti-hack system - V4 (C++ Source code)

yes I use the exe MSVCR100.dll as shown in the tutorial I did put
ClasseWindow ("exe XU AutoClicker.v3 Codde name ...."); and TitleWindow ("# 32770"); so given me when I held the mouse handler and I no longer come into play at all Blocking // // ClasseWindow and TitleWindow and give the client debug copiex codex.dll why I come into play?
 
Galdino i don't think a good idea add ("# 32770") on your ClassName database detection, becouse a lot of programs use this name on ClassName, is somekind of "generic" ClassName.




its now working brother

Great!

is this work here? or not?

I don't understand what you mean, you need be more especific.
 
Last edited:
Galdino i don't think a good idea add ("# 32770") on your ClassName database detection, becouse a lot of programs use this name on ClassName, is somekind of "generic" ClassName.




its now working brother

Great!

is this work here? or not?

I don't understand what you mean, you need be more especific.
try to watch this video https://www.youtube.com/watch?v=-8tSy2B1R3s
he bypass gameguard..is that possible that they can also make it with this gameguard?
 
he bypass gameguard..is that possible that they can also make it with this gameguard?

If your Client / Server uses webzen checksum autentication i think there is no way to bypass it... I realy can't imagine a way to do that... If you change only a word, a dot in anyplace on your main main.exe, nobody will be able to reproduce that change.

Also, with some work on your main files and codex dll you can improve security.

Watch this tutorials and you will got general idea how it works:

https://www.youtube.com/watch?v=Y0MjSu2s3oo



And also, you can use ServerBan feature, but your MuServer Connectstat need work 100 % or everyone that leave game and STAY CONNECTED on your sql database ( with Connecstat = 1) will be banned on that.

But you can work with this with a temporary ban, i mean, ban character or account for some hours only. System allow ban and unban char or entire account.

I made this way, flexible, thinking that entire system can be adapted to be used for another games that uses sql databases.

Watch this about Serverban, Part 1 of 3


And also, this one about molebox pack:




Did you know how webzem checksum conference works? I looking for this and find this video about this.
 
Last edited:
Ok Guys, i try some tests to solve Muserver connectstat problem, that one: Users stay connected / your account are connected...

And this way, if it realy works for eveone, we can use BanServer features without any problem to solve any antihack kill / Freeze problem.

It seems to works to me. But i realy can't make real test using just one char... Someone can try to use that? And Tell us if it realy works?


MAKE A DATABASE BACKUP BEFORE!


///////////////// Deleting Procedures and tables



Open enterprise manager (I'm using SQL 2000)


Console Root > Microsoft SQL Servers > SQL Server Group > (local) (Windows NT) > Databases > MuOnline > Stored Procedure:


Delete:
WZ_CONNECT_MEMB
and
WZ_DISCONNECT_MEMB



Console Root > Microsoft SQL Servers > SQL Server Group > (local) (Windows NT) > Databases > MuOnline > Tables:


Delete:
MEMB_STAT


///////////////// creating Procedures and tables


Open SQL Query Analyzer


Select Database: MuOnline


Execute Query, Run this code:

Code:
CREATE PROCEDURE WZ_CONNECT_MEMB
@uid varchar(20),  [USER=412249]Server[/USER] varchar(20),
@uip varchar(20)
AS
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET ip = @uip , connectstat = 1 , servername =  [USER=412249]Server[/USER] , ConnectTM = (getdate())
WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,ip,connectstat,servername) valueS (
@uid,
@uip,
1,  [USER=412249]Server[/USER]
)
End
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO










CREATE PROCEDURE WZ_DISCONNECT_MEMB
@uid varchar(20)
AS
Begin
BEGIN TRANSACTION
SET NOCOUNT ON
IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED)
WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET DisConnectTM = (getdate()), connectstat = 0 WHERE memb___id = @uid
End
ELSE
Begin
INSERT INTO MEMB_STAT ( memb___id,DisConnectTM,connectstat) valueS (
@uid,
(getdate()),
0
)
End
IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
SET NOCOUNT OFF
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO










CREATE TABLE [dbo].[MEMB_STAT] (
[memb___id] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ConnectStat] [tinyint] NULL ,
[ServerName] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[IP] [nvarchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[ConnectTM] [smalldatetime] NULL ,
[DisConnectTM] [smalldatetime] NULL
) ON [PRIMARY]
GO



Lucila, That procedure to disconnect users, that one that guy says... Do you remember?

Don't work for me.
 
Hi friend,can you explain how this will protect server side?Because as I see there is nothing to hook on gameserver sorry for this very noob question.I am just thinking how this dll will protect lower version server like season 3 because lower version have bypasser.They use other main.exe that is unpack to enter the game without any gameguard hooked.Thank you.
 
Hi friend,can you explain how this will protect server side?Because as I see there is nothing to hook on gameserver sorry for this very noob question.I am just thinking how this dll will protect lower version server like season 3 because lower version have bypasser.They use other main.exe that is unpack to enter the game without any gameguard hooked.Thank you.

I made it very simple to use on any Muserver. Dll uses a php autentication, if IP (User on that IP) have no autentication after x minutes and user connectstat are equals to (1 connected), it means that user are connected on server without a working dll and that user uses bypass or suspend to kill antihack.

This way, char or acc ( you can choose) that are not autenticated by dll after some time can be banned on sql databases.

Only problem is, as you know, sometimes users stay connected on MuServer after leave it. This means connecstat are equals to 1 and, as expected, this users are banned too...



MU Server:

-Connectat don't works

-SQL Procedure to disconnect user don't works

-Move char to Map 5 on SQL don't works

Anyone of this solve our problem...





If someone, can try...

SQL Procedure to disconnect user:

Run this code just on time on Query Analyser:

Using MuOnline database:

Code:
[COLOR=#000000]GO[/COLOR]
[COLOR=#000000]SET ANSI_NULLS ON[/COLOR]
[COLOR=#000000]GO[/COLOR]
[COLOR=#000000]SET QUOTED_IDENTIFIER ON[/COLOR]
[COLOR=#000000]GO[/COLOR]
[COLOR=#000000]CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB][/COLOR]
[COLOR=#000000]@uid varchar(20)[/COLOR]
[COLOR=#000000]AS[/COLOR]

[COLOR=#000000]Begin[/COLOR]

[COLOR=#000000]BEGIN TRANSACTION[/COLOR]

[COLOR=#000000]SET NOCOUNT ON[/COLOR]

[COLOR=#000000]IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED) WHERE memb___id = @uid )[/COLOR]
[COLOR=#000000]Begin[/COLOR]
[COLOR=#000000]UPDATE MEMB_STAT[/COLOR]
[COLOR=#000000]SET connectstat = 0 , DisConnectTM = (getdate())[/COLOR]
[COLOR=#000000]WHERE memb___id = @uid[/COLOR]
[COLOR=#000000]End[/COLOR]

[COLOR=#000000]IF(@@Error <> 0 )[/COLOR]
[COLOR=#000000]ROLLBACK TRANSACTION[/COLOR]
[COLOR=#000000]ELSE[/COLOR]
[COLOR=#000000]COMMIT TRANSACTION[/COLOR]

[COLOR=#000000]SET NOCOUNT OFF[/COLOR]
[COLOR=#000000]End[/COLOR]

After that, to disconnet any user, you just select user id and run this code below on Query analizer to disconnect this user id:


Code:
[COLOR=#000000]DECLARE @RC int[/COLOR]
[COLOR=#000000]DECLARE @uid varchar(20)[/COLOR]
[COLOR=#000000]set @uid = '[/COLOR][SIZE=4][B]USER ID[/B][/SIZE][COLOR=#000000]';[/COLOR]
[COLOR=#000000]EXECUTE @RC = [MuOnline].[dbo].[WZ_DISCONNECT_MEMB] [/COLOR]
[COLOR=#000000]@uid[/COLOR]

To me, this just don't works...
 
Last edited:
I made it very simple to use on any Muserver. Dll uses a php autentication, if IP (User on that IP) have no autentication after x minutes and user connectstat are equals to (1 connected), it means that user are connected on server without a working dll and that user uses bypass or suspend to kill antihack.

This way, char or acc ( you can choose) that are not autenticated by dll after some time can be banned on sql databases.

Only problem is, as you know, sometimes users stay connected on MuServer after leave it. This means connecstat are equals to 1 and, as expected, this users are banned too...



MU Server:

-Connectat don't works

-SQL Procedure to disconnect user don't works

-Move char to Map 5 on SQL don't works

Anyone of this solve our problem...





If someone, can try...

SQL Procedure to disconnect user:

Run this code just on time on Query Analyser:

Using MuOnline database:

Code:
[COLOR=#000000]GO[/COLOR]
[COLOR=#000000]SET ANSI_NULLS ON[/COLOR]
[COLOR=#000000]GO[/COLOR]
[COLOR=#000000]SET QUOTED_IDENTIFIER ON[/COLOR]
[COLOR=#000000]GO[/COLOR]
[COLOR=#000000]CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB][/COLOR]
[COLOR=#000000]@uid varchar(20)[/COLOR]
[COLOR=#000000]AS[/COLOR]

[COLOR=#000000]Begin[/COLOR]

[COLOR=#000000]BEGIN TRANSACTION[/COLOR]

[COLOR=#000000]SET NOCOUNT ON[/COLOR]

[COLOR=#000000]IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED) WHERE memb___id = @uid )[/COLOR]
[COLOR=#000000]Begin[/COLOR]
[COLOR=#000000]UPDATE MEMB_STAT[/COLOR]
[COLOR=#000000]SET connectstat = 0 , DisConnectTM = (getdate())[/COLOR]
[COLOR=#000000]WHERE memb___id = @uid[/COLOR]
[COLOR=#000000]End[/COLOR]

[COLOR=#000000]IF(@@Error <> 0 )[/COLOR]
[COLOR=#000000]ROLLBACK TRANSACTION[/COLOR]
[COLOR=#000000]ELSE[/COLOR]
[COLOR=#000000]COMMIT TRANSACTION[/COLOR]

[COLOR=#000000]SET NOCOUNT OFF[/COLOR]
[COLOR=#000000]End[/COLOR]

After that, to disconnet any user, you just select user id and run this code below on Query analizer to disconnect this user id:


Code:
[COLOR=#000000]DECLARE @RC int[/COLOR]
[COLOR=#000000]DECLARE @uid varchar(20)[/COLOR]
[COLOR=#000000]set @uid = '[/COLOR][SIZE=4][B]USER ID[/B][/SIZE][COLOR=#000000]';[/COLOR]
[COLOR=#000000]EXECUTE @RC = [MuOnline].[dbo].[WZ_DISCONNECT_MEMB] [/COLOR]
[COLOR=#000000]@uid[/COLOR]

To me, this just don't works...

Thank you! Very clear and very detailed explanation.I might try it now,Can you link the correct video guide how to setup this version 4 sir?Thank you so much.



Hi Sir Is it necessary to run this query on the database
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[WZ_DISCONNECT_MEMB]
@uid varchar(20)
AS

Begin

BEGIN TRANSACTION

SET NOCOUNT ON

IF EXISTS ( SELECT memb___id FROM MEMB_STAT WITH (READUNCOMMITTED) WHERE memb___id = @uid )
Begin
UPDATE MEMB_STAT
SET connectstat = 0 , DisConnectTM = (getdate())
WHERE memb___id = @uid
End

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION

SET NOCOUNT OFF
End

To make this simple query to disconnect stock account to work?

DECLARE @RC int
DECLARE @uid varchar(20)
set @uid = 'USER ID';
EXECUTE @RC = [MuOnline].[dbo].[WZ_DISCONNECT_MEMB]
@uid

So it means sir if I didn't replace my old WZ_DISCONNECT_MEMB it means the query to disconnect stock accounts will not work?Thank you for answering because I tried it but it didn't work but I didn't changed my WZ_DISCONNECT_MEMB yet.
 
Hi Sir Is it necessary to run this query on the database

Are two diferent things Dev, this procedure to disconnect users there is no relation with the fist one codes for connectstat fix.

I'm not sure if that codes to fix connectat realy works, i made some test, but i find no way to reproduce this connectstat error as i need...

About this codes to disconnect users, for me, this just don't work. I have deleted
WZ_DISCONNECT_MEMB and after that, run first procedure to creat it again, after that, i run second code to disconnect user, but char disconnection just don't happens.

This codes don't work on my Muserver (1.01e) started to tests, maybe in another Mu server version thath works...

Sorry about my broken english, thats not my native language.
 
:thumbup1:



config.cfg
Code:
/Codex
Window = Mxmain
Class = ConsoleWindowClass
PID = Mxmain.exe



TESTE.cpp
Code:
// Video tutorial: http://www.youtube.com/user/vertexbrasil
#include "StdAfx.h"
#include <sstream>


class Convert
{
public:
    template <typename T>
    static std::string T_to_string(T const &val) 
    {
        std::ostringstream ostr;
        ostr << val;


        return ostr.str();
    }
        
    template <typename T>
    static T string_to_T(std::string const &val) 
    {
        std::istringstream istr(val);
        T returnVal;
        if (!(istr >> returnVal))
            exitWithError("CFG: Not a valid " + (std::string)typeid(T).name() + " received!\n");
        return returnVal;
    }
    template <>
    static std::string string_to_T(std::string const &val)
    {
        return val;
    }
};


void exitWithError(const std::string &error) 
{
    std::cout << error;
    std::cin.ignore();
    std::cin.get();
    exit(EXIT_FAILURE);
}


class ConfigFile
{
private:
    std::map<std::string, std::string> contents;
    std::string fName;


    void removeComment(std::string &line) const
    {
        if (line.find('/') != line.npos)
            line.erase(line.find('/'));
    }


    bool onlyWhitespace(const std::string &line) const
    {
        return (line.find_first_not_of(' ') == line.npos);
    }
    bool validLine(const std::string &line) const
    {
        std::string temp = line;
        temp.erase(0, temp.find_first_not_of("\t "));
        if (temp[0] == '=')
            return false;


        for (size_t i = temp.find('=') + 1; i < temp.length(); i++)
            if (temp[i] != ' ')
            return true;
            return false;
    }
    void extractKey(std::string &key, size_t const &sepPos, const std::string &line) const
    {
        key = line.substr(0, sepPos);
        if (key.find('\t') != line.npos || key.find(' ') != line.npos)
            key.erase(key.find_first_of("\t "));
    }
    void extractValue(std::string &value, size_t const &sepPos, const std::string &line) const
    {
        value = line.substr(sepPos + 1);
        value.erase(0, value.find_first_not_of("\t "));
        value.erase(value.find_last_not_of("\t ") + 1);
    }


    void extractContents(const std::string &line) 
    {
        std::string temp = line;
        temp.erase(0, temp.find_first_not_of("\t "));
        size_t sepPos = temp.find('=');


        std::string key, value;
        extractKey(key, sepPos, temp);
        extractValue(value, sepPos, temp);


        if (!keyExists(key))
            contents.insert(std::pair<std::string, std::string>(key, value));
        else
            exitWithError("CFG: Can only have unique key names!\n");
    }


    void parseLine(const std::string &line, size_t const lineNo)
    {
        if (line.find('=') == line.npos)
            exitWithError("CFG: Couldn't find separator on line: " + Convert::T_to_string(lineNo) + "\n");


        if (!validLine(line))
            exitWithError("CFG: Bad format for line: " + Convert::T_to_string(lineNo) + "\n");


        extractContents(line);
    }


    void ExtractKeys()
    {
        std::ifstream file;
        file.open(fName.c_str());
        if (!file)
            exitWithError("CFG: File " + fName + " couldn't be found!\n");


        std::string line;
        size_t lineNo = 0;
        while (std::getline(file, line))
        {
            lineNo++;
            std::string temp = line;


            if (temp.empty())
                continue;


            removeComment(temp);
            if (onlyWhitespace(temp))
                continue;


            parseLine(temp, lineNo);
        }


        file.close();
    }
public:
    ConfigFile(const std::string &fName)
    {
        this->fName = fName;
        ExtractKeys();
    }


    bool keyExists(const std::string &key) const
    {
        return contents.find(key) != contents.end();
    }


    template <typename ValueType>
    ValueType getValueOfKey(const std::string &key, ValueType const &defaultValue = ValueType()) const
    {
        if (!keyExists(key))
            return defaultValue;


        return Convert::string_to_T<ValueType>(contents.find(key)->second);
    }
};


int main2()
{
    ConfigFile cfg("config.cfg");


    bool exists = cfg.keyExists("Window");
    //std::cout << "Window: " << std::boolalpha << exists << "\n";
    std::string WindowValue = cfg.getValueOfKey<std::string>("Window");
    std::cout << "value of Window: " << WindowValue << "\n";


    exists = cfg.keyExists("Class");
    //std::cout << "Class: " << exists << "\n";
    std::string ClassValue = cfg.getValueOfKey<std::string>("Class");
    std::cout << "value of Class: " << ClassValue << "\n";


    exists = cfg.keyExists("PID");
    //std::cout << "Class: " << exists << "\n";
    std::string PIDValue = cfg.getValueOfKey<std::string>("PID");
    std::cout << "value of PID: " << PIDValue << "\n";
/////////////////////////////////
std::string str2 = WindowValue;
LPSTR WT = const_cast<char *>(str2.c_str());
HWND WinTitle = FindWindowA(NULL, WT);
if( WinTitle > 0){
SendMessage(WinTitle, WM_CLOSE,0,0);  // Close process
}
/////////////////////////////////
std::string str = ClassValue;
LPSTR CL = const_cast<char *>(str.c_str());
HWND WinClasse = FindWindowExA(NULL,NULL,CL,NULL);
if( WinClasse > 0){    
SendMessage(WinClasse, WM_CLOSE,0,0);  // Close process
}
/////////////////////////////////
std::string str3 = PIDValue;
LPSTR PID = const_cast<char *>(str3.c_str());
    //void GetProcId(char* u);
    PROCESSENTRY32 pe32;
    HANDLE hSnapshot = NULL;
    pe32.dwSize = sizeof( PROCESSENTRY32 );
    hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
    if( Process32First( hSnapshot, &pe32 )){
        do{
            if( strcmp( pe32.szExeFile, PID ) == 0 )
            {
            HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);  // Close process
            TerminateProcess(hProcess,NULL);
            ExitProcess(0);
            }
        }while( Process32Next( hSnapshot, &pe32 ) );
    }
    if( hSnapshot != INVALID_HANDLE_VALUE )
    CloseHandle( hSnapshot );
    return(0);
}


void main(){
    again:
    main2();
    Sleep(1000);
    goto again;
}


 void  TESTES(){
    CreateThread(NULL,NULL,LPTHREAD_START_ROUTINE(main),NULL,0,0);
}
 
Hola estube haciendole algunas modificaciones a la dll y ahora me sale este mensaje

No recuerdo bien que modifique, creo que desde el proyecto toque algo. Como lo podria solucionar?
 
Hola estube haciendole algunas modificaciones a la dll y ahora me sale este mensaje

No recuerdo bien que modifique, creo que desde el proyecto toque algo. Como lo podria solucionar?

Try: Codex > properties > configuration properties > c / c++ > code generation > runtime library > multi-threaded debug (MTd) to multi-threaded (/MT)
 
Back