AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   orpheu (https://forums.alliedmods.net/showthread.php?t=337192)

lexzor 04-07-2022 07:05

orpheu
 
hello. i m using orpheu and i made my own signatures for functions.

so if i have this output is good
Code:

Parsing file "SV_GetIDString_internal" started
                                Argument type "pointer" validated
                                Return type "char *" validated
                                Searching for signature "[0x55][0x8b][0xec][0x83][*](...)" ... FOUND
                Parsing file "SV_GetIDString_internal" ended

but i have a problem with my plugin. i'm trying to output player steamid in server console but don t work.

Code:

char* EXT_FUNC SV_GetIDString_internal(USERID_t *id)
PHP Code:

#include <amxmodx>
#include <orpheu>


public plugin_precache()
{
    
OrpheuRegisterHook(OrpheuGetFunction("SV_GetIDString_internal"),"OnSV_GetIDString",OrpheuHookPost)
}

public 
OnSV_GetIDString(steamid[])
{
    
server_print("%s"steamid);



Shadows Adi 04-07-2022 07:09

Re: orpheu
 
PHP Code:

public OnSV_GetIDString(steamid[])
{
    new 
szID[32]
    
OrpheuGetReturn(szIDcharsmax(szID))



lexzor 04-07-2022 09:27

Re: orpheu
 
i get segmentation fault when the function is called

Code:

{
    "name"      : "SV_GetIDString",
    "library"  : "engine",
    "arguments" :
    [
        {
            "type" : "pointer"
        }
    ],
    "return" :
    {
        "type" : "char *"
    },
    "identifiers":
    [
        {
            "os" : "windows",
            "value" : [0x55,0x8B,0xEC,0x83,0xEC,0x30,0x8B,0x4D,0x08,0xC6,"*","*","*","*","*","*",0x85,0xC9,0x0F,"*","*","*","*","*",0x8B,0x01,0x48,0x0F]
        },
        {
            "os" : "linux",
            "value" : 0x47C50 
        }
    ]
}

even if i output a debug message in console

debug file

Code:

Stack level 0, frame at 0xff063d39:
 eip = 0xf7489c5e in _Z14SV_GetIDStringP8USERID_s.; saved eip = 0x0
 called by frame at 0xff063d3d
 Arglist at 0xff063d31, args:
 Locals at 0xff063d31, Previous frame's sp is 0xff063d39
 Saved registers:
  eip at 0xff063d35
End of crash report


Natsheh 04-07-2022 15:35

Re: orpheu
 
Are you using linux or windows ?

Function name and file name assumingly, they should be the same.

Argument type is a pointer and you're using a string ?

lexzor 04-07-2022 16:34

Re: orpheu
 
i am using linux

Code:

char* SV_GetIDString(USERID_t *id)
{
        return g_RehldsHookchains.m_SV_GetIDString.callChain(SV_GetIDString_internal, id);
}

that's the function and i m using the same name in function file and amxx.

Natsheh 04-07-2022 16:59

Re: orpheu
 
PHP Code:

public OnSV_GetIDString( const id )
{
    
server_print("%d"id );


thats how the function parameters should look like, where id is a player index assumingly ?


also thats linux function address is too short ( 0x47C50 ) try finding a longer address, this address can be invalid.

also here's the function that you're trying catch.

Code:

char* EXT_FUNC SV_GetIDString_internal(USERID_t *id)
{
        static char idstr[64];

        idstr[0] = 0;

        if (!id)
        {
                return idstr;
        }

        switch (id->idtype)
        {
        case AUTH_IDTYPE_STEAM:
                if (sv_lan.value != 0.0f)
                {
                        Q_strncpy(idstr, "STEAM_ID_LAN", ARRAYSIZE(idstr) - 1);
                }
                else if (!id->m_SteamID)
                {
                        Q_strncpy(idstr, "STEAM_ID_PENDING", ARRAYSIZE(idstr) - 1);
                }
                else
                {
                        TSteamGlobalUserID steam2ID = Steam_Steam3IDtoSteam2(id->m_SteamID);
                        Q_snprintf(idstr, ARRAYSIZE(idstr) - 1, "STEAM_%u:%u:%u", steam2ID.m_SteamInstanceID, steam2ID.m_SteamLocalUserID.Split.High32bits, steam2ID.m_SteamLocalUserID.Split.Low32bits);
                }
                break;
        case AUTH_IDTYPE_VALVE:
                if (sv_lan.value != 0.0f)
                {
                        Q_strncpy(idstr, "VALVE_ID_LAN", ARRAYSIZE(idstr) - 1);
                }
                else if (!id->m_SteamID)
                {
                        Q_strncpy(idstr, "VALVE_ID_PENDING", ARRAYSIZE(idstr) - 1);
                }
                else
                {
                        TSteamGlobalUserID steam2ID = Steam_Steam3IDtoSteam2(id->m_SteamID);
                        Q_snprintf(idstr, ARRAYSIZE(idstr) - 1, "VALVE_%u:%u:%u", steam2ID.m_SteamInstanceID, steam2ID.m_SteamLocalUserID.Split.High32bits, steam2ID.m_SteamLocalUserID.Split.Low32bits);
                }
                break;
        case AUTH_IDTYPE_LOCAL:
                Q_strncpy(idstr, "HLTV", ARRAYSIZE(idstr) - 1);
                break;
        default:
                Q_strncpy(idstr, "UNKNOWN", ARRAYSIZE(idstr) - 1);
                break;
        }
        // Don't be paranoid
        //idstr[ARRAYSIZE(idstr) - 1] = 0;

        return idstr;
}


lexzor 04-08-2022 11:10

Re: orpheu
 
function:

Code:

{
    "name"      : "SV_GetIDString_internal",
    "library"  : "engine",
    "arguments" :
    [
        {
            "type" : "pointer"
        }
    ],
    "return" :
    {
        "type" : "char *"
    },
    "identifiers":
    [
        {
            "os" : "linux",
            "value" : - [0x55,0x8b,0xEC,0x83,"*",0xF0,0x83,"*","*","*","*",0x08,0xC6,0x05]
        }
    ]
}

now i get segmentation fault when the server start

PHP Code:

#include <amxmodx>
#include <orpheu>


public plugin_precache()
{
    
OrpheuRegisterHook(OrpheuGetFunction("SV_GetIDString_internal"),"OnSV_GetIDString_internal",OrpheuHookPost)
}

public 
OnSV_GetIDString(x)
{
    new 
szSteamid[32]
    
OrpheuGetReturn(szSteamid31);
    
server_print("%s"szSteamid);


Code:

Parsing file "SV_GetIDString_internal" started
                                Function is updated
                Parsing file "SV_GetIDString_internal" ended

actually i don t get any output. that function shouldn t be called when the engine is formating player authid ?

Natsheh 04-08-2022 13:04

Re: orpheu
 
are you sure thats the correct signature for linux ?


Here's the signature for linux for ReHLDS version 3.11

Code:

{
    "name"      : "SV_GetIDString",
    "library"  : "engine",
    "arguments" :
    [
        {
            "type" : "pointer"
        }
    ],
    "return" :
    {
        "type" : "char *"
    },
    "identifiers":
    [
        {
            "os" : "windows",
            "value" : [0x55,0x8B,0xEC,0x83,0xEC,0x30,0x8B,0x4D,0x08,0xC6,"*","*","*","*","*","*",0x85,0xC9,0x0F,"*","*","*","*","*",0x8B,0x01,0x48,0x0F]
        },
        {
            "os" : "linux",
            "value" : "_Z23SV_GetIDString_internalP8USERID_s"
        }
    ]
}


lexzor 04-08-2022 22:20

Re: orpheu
 
Code:

L 04/09/2022 - 05:15:39: [ORPHEU] Function "SV_GetIDString_internal" not found
still don't work. i m using the latest version from github for: rehlds, regamedll, metamod and orpheu.
should i add something else for a properly working of orpheu ?

edit: when i m using the last signature i posted, apparently orpheu find the function

Code:

Parsing file "SV_GetIDString_internal" started
                                Argument type "pointer" validated
                                Return type "char *" validated
                                Searching for signature "[0x55][0x8b][0xec][0x83][*](...)" ... FOUND
                Parsing file "SV_GetIDString_internal" ended

but somehow, the function is not called when a player connect


edit: when i'm using this signature
Code:

[0x55,0x8B,0xEC,"*","*","*",0x83,"*",0x20,"*","*","*","*",0x05,0xE0,0x9B]
i got segmentation fault when the server starts even if the hexadecimal signature matches with the right function
Code:

Searching down CASE-SENSITIVELY for binary pattern:
        55 8B EC ?? ?? ?? 83 ?? 20 ?? ?? ?? ?? 05 E0 9B
Search completed. Found at 00000000000396A0.

Code:

Stack level 0, frame at 0xffedd580:
 eip = 0xed1b2f12 in LibrariesManager::compareSignature(unsigned char*, unsigned char*, SignatureEntryType*, unsigned int); saved eip = 0xed1b3de3
 called by frame at 0xffedd5d0
 Arglist at 0xffedd578, args:
 Locals at 0xffedd578, Previous frame's sp is 0xffedd580
 Saved registers:
  ebx at 0xffedd56c, ebp at 0xffedd578, esi at 0xffedd570, edi at 0xffedd574, eip at 0xffedd57c
End of crash report


r0ma 04-10-2022 19:12

Re: orpheu
 
That hook already exists in the rehlds api, you can add that hook to reapi module and avoid orpheu


All times are GMT -4. The time now is 17:52.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.