AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Orpheu replace variable (https://forums.alliedmods.net/showthread.php?t=163927)

DarkGL 08-05-2011 07:54

Orpheu replace variable
 
I want to replace variable value in function for example
Code:

signed int __cdecl SV_CheckKeyInfo(int a1, int a2, int a3, int a4, int a5, char *s)
{
  int v6; // edi@1
  int v7; // eax@1
  signed int result; // eax@2
  int v9; // esi@3

  v7 = Info_ValueForKey(a2, "prot");
  v6 = Q_atoi(v7);
  if ( (unsigned int)(v6 - 1) <= 3 )
  {
    v9 = Info_ValueForKey(a2, "raw");
    if ( Q_strlen(v9) > 0 && (v6 != 2 || Q_strlen(v9) == 32) )
    {
      Q_strcpy(a5, v9);
      if ( v6 == 2 || (v9 = Info_ValueForKey(a2, "cdkey"), Q_strlen(v9) == 32) )
      {
        snprintf(s, 0x40u, "%s", v9);
        *(_WORD *)a3 = Q_atoi("27005");
        *(_DWORD *)a4 = v6;
        result = 1;
      }
      else
      {
        SV_RejectConnection(a1, "Invalid hashed CD key.\n");
        result = 0;
      }
    }
    else
    {
      SV_RejectConnection(a1, "Invalid authentication certificate length.\n");
      result = 0;
    }
  }
  else
  {
    SV_RejectConnection(a1, "Invalid connection.\n");
    result = 0;
  }
  return result;
}

and I want to set v6 to 2 and result to 5 it's possible ?

Arkshine 08-05-2011 08:06

Re: Orpheu replace variable
 
- Hook Q_atoi and change the returned value.
- Why 5 ? Returning 5 whatever the checks, I guess, hooking SV_CheckKeyInfo and returning such value would work. If hookable.

DarkGL 08-05-2011 08:08

Re: Orpheu replace variable
 
- how ?
- it's just for example :)

Arkshine 08-05-2011 08:11

Re: Orpheu replace variable
 
How ? You don't know how to make signature file ?

DarkGL 08-05-2011 08:15

Re: Orpheu replace variable
 
but Q_atoi is not function on engine or mod , or maybe I'm blind :D

Arkshine 08-05-2011 08:20

Re: Orpheu replace variable
 
If it's used into the engine library, it means, it's referenced there and it is, just checked.

jim_yang 08-05-2011 08:25

Re: Orpheu replace variable
 
change value is easy, but could u tell what exactly you are going to do?

DarkGL 08-05-2011 08:39

Re: Orpheu replace variable
 
I wana just learn how to do that.
how to change code in function no just return but set that some of the code is skipped , changing values of variables and others that give us a powerful capabilities

jim_yang 08-05-2011 08:53

Re: Orpheu replace variable
 
so, this is not a particular hacking demand. You just want to know how to patch memory?
well, then you need to know at least some asm operation first.
changing value is the easiest thing of patching memory, espeically a const.
sorry can't give u example with orpheu, cause I never use that module before.
I suggest u coding a module for hacking memory, that's an easy way to do that.

DarkGL 08-05-2011 09:04

Re: Orpheu replace variable
 
Ok I will read about it :)
maybe someone give example in orpheu , also how to check variable address in IDA if I have address I could use OrpheuMemoryReplaceAtAddress
some of the code is skipped - it can be done with memory patch ? or with orpheu ?


All times are GMT -4. The time now is 03:26.

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