IPB

Welcome Guest ( Log In | Register )

> rcbot_const_mstr_offset needs updating?
JRob
post Aug 26 2015, 12:52 AM
Post #1


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



I tried playing around with rcbot again and it keeps crashing at

CTeamControlPointRound *CTeamControlPointMaster:: getCurrentRound ()

CBaseEntity *pent = m_ControlPointRounds[m_iCurrentRoundIndex];

So I took a look at what that was and apparently, CTeamControlPointRound is found through dark hackery and the magic number at rcbot_const_mstr_offset.

Can you update this? Or also tell people how to find these offsets?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topic
Replies
JRob
post Sep 11 2015, 10:55 PM
Post #2


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



Any update on this? I am starting to add it myself.

I noticed that you ripped out the sig scanning code from sourcemod, but you removed the symbol resolving code. It looks like you have some parts of it, but it doesn't work.

You can easily get this functionality with just 3 files.

https://github.com/alliedmodders/sourcemod/...MemoryUtils.cpp
https://github.com/alliedmodders/sourcemod/...k/MemoryUtils.h
https://github.com/alliedmodders/sourcemod/...k/sm_symtable.h

You need to edit MemoryUtils.h and remove "using namespace SourceMod" and add

#if defined __linux__
#define PLATFORM_LINUX
#endif

And done...

CODE


    MemoryUtils* sigscan = new MemoryUtils;
    void* server = dlopen("tf/bin/server_srv.so", RTLD_LAZY);
    dlclose(server);
    
#ifdef __linux__
    char* CTeamControlPointMaster_Spawn = (char*)sigscan->ResolveSymbol(server, "_ZN23CTeamControlPointMaster5SpawnEv");
#endif

    if(CTeamControlPointMaster_Spawn)
    {
        int CBaseEntityLength = *(int*)(CTeamControlPointMaster_Spawn + 0x1A) - sizeof(CUtlMap<int, CBaseEntity *>);
        rcbot_const_point_master_offset.SetValue(CBaseEntityLength);
    }
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post Oct 3 2015, 01:42 PM
Post #3


Admin
*****

Group: Admin
Posts: 3,018
Joined: 11-September 03
From: uk
Member No.: 1



I made a sigscan class which is included and works

bot_sigscan.h
CODE

class CSignatureFunction
{
public:
    CSignatureFunction() { m_func = 0x0; }
private:
    size_t decodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr);

    bool getLibraryInfo(const void *libPtr, DynLibInfo &lib);

    void *findPattern(const void *libPtr, const char *pattern, size_t len);

    void *findSignature ( void *addrInBase, const char *signature );
protected:
    void findFunc ( CRCBotKeyValueList *kv, const char *pKey, void *pAddrBase, const char *defaultsig );

    void *m_func;
};

// Examples
class CGameRulesObject : public CSignatureFunction
{
public:
    CGameRulesObject(CRCBotKeyValueList *list, void *pAddrBase);

    bool found() { return m_func != NULL; }

    void **getGameRules() { return reinterpret_cast<void **>(m_func); }
};

CGameRulesObject::CGameRulesObject(CRCBotKeyValueList *list, void *pAddrBase)
{
#ifdef _WIN32
    m_func = NULL;
#else
    findFunc(list, "g_pGameRules", pAddrBase, "@g_pGameRules");
#endif
}

void CSignatureFunction :: findFunc ( CRCBotKeyValueList *kv, const char*pKey, void *pAddrBase, const char *defaultsig )
{
    char *sig = NULL;

    if ( kv->getString(pKey,&sig) && sig )
        m_func = findSignature(pAddrBase,sig);
    else
        m_func = findSignature(pAddrBase,defaultsig);
}

// Sourcemod - Metamod - Allied Modders.net
void *CSignatureFunction::findSignature ( void *addrInBase, const char *signature )
{
    // First, preprocess the signature
    unsigned char real_sig[511];

    size_t real_bytes;

    real_bytes = decodeHexString(real_sig, sizeof(real_sig), signature);

    if (real_bytes >= 1)
    {
        return findPattern(addrInBase, (char*) real_sig, real_bytes);
    }

    return NULL;
}


CODE

CGameRulesObject *g_pGameRules_Obj;
...
g_pGameRules_Obj = new CGameRulesObject(pKVL, gameServerFactory);


I'll translate it into using this class for next version, cheers

PS , got a signature for windows?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
JRob
post Oct 20 2015, 01:08 AM
Post #4


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



Unless you changed it recently, the sigscan class you have doesn't resolve linux symbols which never change and is much better than a sigscan.

The Windows signature I presume would be the same one as the Linux sig scan I proposed earlier.

QUOTE(Cheeseh @ Oct 3 2015, 01:42 PM) *

I made a sigscan class which is included and works

bot_sigscan.h
CODE

class CSignatureFunction
{
public:
    CSignatureFunction() { m_func = 0x0; }
private:
    size_t decodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr);

    bool getLibraryInfo(const void *libPtr, DynLibInfo &lib);

    void *findPattern(const void *libPtr, const char *pattern, size_t len);

    void *findSignature ( void *addrInBase, const char *signature );
protected:
    void findFunc ( CRCBotKeyValueList *kv, const char *pKey, void *pAddrBase, const char *defaultsig );

    void *m_func;
};

// Examples
class CGameRulesObject : public CSignatureFunction
{
public:
    CGameRulesObject(CRCBotKeyValueList *list, void *pAddrBase);

    bool found() { return m_func != NULL; }

    void **getGameRules() { return reinterpret_cast<void **>(m_func); }
};

CGameRulesObject::CGameRulesObject(CRCBotKeyValueList *list, void *pAddrBase)
{
#ifdef _WIN32
    m_func = NULL;
#else
    findFunc(list, "g_pGameRules", pAddrBase, "@g_pGameRules");
#endif
}

void CSignatureFunction :: findFunc ( CRCBotKeyValueList *kv, const char*pKey, void *pAddrBase, const char *defaultsig )
{
    char *sig = NULL;

    if ( kv->getString(pKey,&sig) && sig )
        m_func = findSignature(pAddrBase,sig);
    else
        m_func = findSignature(pAddrBase,defaultsig);
}

// Sourcemod - Metamod - Allied Modders.net
void *CSignatureFunction::findSignature ( void *addrInBase, const char *signature )
{
    // First, preprocess the signature
    unsigned char real_sig[511];

    size_t real_bytes;

    real_bytes = decodeHexString(real_sig, sizeof(real_sig), signature);

    if (real_bytes >= 1)
    {
        return findPattern(addrInBase, (char*) real_sig, real_bytes);
    }

    return NULL;
}


CODE

CGameRulesObject *g_pGameRules_Obj;
...
g_pGameRules_Obj = new CGameRulesObject(pKVL, gameServerFactory);


I'll translate it into using this class for next version, cheers

PS , got a signature for windows?

User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 21st January 2020 - 01:17 AM