PDA

View Full Version : How to patch bytes?


Empowers
06-22-2010, 10:21
you can manually patch engine_i686.so at offset 0x753C3 with bytes [0xb8][0x20][0x00][0x00][0x00].
With "IDA Pro Free" I've found offset 0x753C3. But I don't know how to patch bytes. Help me please.

Arkshine
06-22-2010, 11:17
See my plugins like Infinite Round or others ; you have just to create a file in memory/ then using the proper native. ( Orpheu[G|S]etMemory() )

Empowers
06-22-2010, 16:00
See my plugins like Infinite Round or others ; you have just to create a file in memory/ then using the proper native. ( Orpheu[G|S]etMemory() )
Arkshine can u make such a plugin that i need please =( I think it's just a couples of lines isn't that?

Arkshine
06-22-2010, 17:17
You are in the scripting section and I've already said too much to know how to do that. ^^

Empowers
06-23-2010, 10:07
You are in the scripting section and I've already said too much to know how to do that. ^^
I was trying but i know nothing about orpheu :(

Arkshine
06-23-2010, 10:17
See my plugins like Infinite Round or others

That's not the request section and I don't have the time to do it, please do some efforts.

Empowers
06-23-2010, 10:22
With "IDA Pro Free" I've found offset 0x753C3. But I don't know how to patch bytes. Help me please.
ok, then can you please tell me what should i press to patch bytes from given offset in "IDA Pro Free"

Alka
06-23-2010, 10:36
Oh wow, i really must post this? Just take a look at what Arkshine said and you will see is not so hard? *i think*

Some useful code ->

stock BytesToReplace ( /*identifier[]*/address, const bytes[], const bytesLength = sizeof bytes )
{
//new address; //this thing you have?
//OrpheuMemoryGet( identifier, address );

for ( new i; i < bytesLength; i++)
{
OrpheuMemorySetAtAddress( address, "roundTimeCheck|dummy", 1, bytes[ i ], address ); //patch bytes?
address++;
}


//| It needs to reiniatiliaze some things.
//server_cmd( "sv_restart 1" );
}So i guess you have the "address" and you must use "OrpheuMemorySetAtAddress" with custom values.
Using Arkshine stock, code will be like this? Don't know :-D


new iOffset = 0x753C3;
BytesToReplace( iOffset, { 0xb8, 0x20, 0x00, 0x00, 0x00 } );
Don't know about "roundTimeCheck|dummy", but w/e. As i can see from Arkshine plugins , that would be the name for Sructure from signature file.
I recommend you to take a look at his work, if you know a bit orpheu then you will understand, i dont! xD

Empowers
06-23-2010, 10:57
Oh wow, i really must post this? Just take a look at what Arkshine said and you will see is not so hard? *i think*

Some useful code ->

stock BytesToReplace ( /*identifier[]*/address, const bytes[], const bytesLength = sizeof bytes )
{
//new address; //this thing you have?
//OrpheuMemoryGet( identifier, address );

for ( new i; i < bytesLength; i++)
{
OrpheuMemorySetAtAddress( address, "roundTimeCheck|dummy", 1, bytes[ i ], address ); //patch bytes?
address++;
}


//| It needs to reiniatiliaze some things.
//server_cmd( "sv_restart 1" );
}So i guess you have the "address" and you must use "OrpheuMemorySetAtAddress" with custom values.
Using Arkshine stock, code will be like this? Don't know :-D


new iOffset = 0x753C3;
BytesToReplace( iOffset, { 0xb8, 0x20, 0x00, 0x00, 0x00 } );
Don't know about "roundTimeCheck|dummy", but w/e. As i can see from Arkshine plugins , that would be the name for Sructure from signature file.
I recommend you to take a look at his work, if you know a bit orpheu then you will understand, i dont! xD
This doesn't work :( Why ? I used signatures from Infinite Round Plugin.

#include <amxmodx>
#include <orpheu>
#include <orpheu_memory>


public plugin_init() {

new iOffset[] = 0x753C3;
BytesToReplace( iOffset, { 0xb8, 0x20, 0x00, 0x00, 0x00 } );
}

BytesToReplace( identifier[], const bytes[], const bytesLength = sizeof bytes )
{
new address; //this thing you have?
OrpheuMemoryGet( identifier, address );

for ( new i; i < bytesLength; i++)
{
OrpheuMemorySetAtAddress( address, "roundTimeCheck|dummy", 1, bytes[ i ], address ); //patch bytes?
address++;
}
}

Alka
06-23-2010, 11:16
No no no...it's wrong. I don't know exactly how it is, but that is wrong.
Just ask joaquim or learn more about Orpheu.

Arkshine
06-23-2010, 12:26
Using his stock :
stock BytesToReplace ( const mainIdentifier[], const dummyIdentifier[], const bytes[], const bytesLength = sizeof bytes )
{
new address;
OrpheuMemoryGet( mainIdentifier, address );

for ( new i = 0; i < bytesLength; i++)
{
OrpheuMemorySetAtAddress( address, dummyIdentifier, 1, bytes[ i ], address );
address++;
}
}

Like :
BytesToReplace( "maxSlots|Start", "maxSlots|Dummy", { 0xb8, 0x20, 0x00, 0x00, 0x00 } );

In a file in orpheu/memory/ :

[
{
"name" : "maxSlots|Start",
"library" : "engine",
"type" : "byte",
"memoryType" : "data",
"identifiers" :
[
{
"os" : "linux",
"mod" : "cstrike",
"value" : 0x753C3
}
]
},
{
"name" : "maxSlots|Dummy",
"library" : "engine",
"type" : "byte",
"memoryType" : "data",
"identifiers" :
[
{
"os" : "linux",
"mod" : "cstrike",
"value" : 0
}
]
}
]

It should work fine. Be aware if an update has been occured to the hl1 engine since the day joaquim has posted the offset, the offset could be wrong now.

Alka
06-23-2010, 12:53
Ah, i see...now i understand :-). Thank you for your reveal Arkshine.

Arkshine
06-23-2010, 13:13
I write dummy because I don't know how to call. We need to create such signature since we start at a know address and we don't want to change, that's why we create the same with 0 as value.

Empowers
06-23-2010, 13:21
Using his stock :
stock BytesToReplace ( const mainIdentifier[], const dummyIdentifier[], const bytes[], const bytesLength = sizeof bytes )
{
new address;
OrpheuMemoryGet( mainIdentifier, address );

for ( new i = 0; i < bytesLength; i++)
{
OrpheuMemorySetAtAddress( address, dummyIdentifier, 1, bytes[ i ], address );
address++;
}
}

Like :
BytesToReplace( "maxSlots|Start", "maxSlots|Dummy", { 0xb8, 0x20, 0x00, 0x00, 0x00 } );

In a file in orpheu/memory/ :

[
{
"name" : "maxSlots|Start",
"library" : "engine",
"type" : "byte",
"memoryType" : "data",
"identifiers" :
[
{
"os" : "linux",
"mod" : "cstrike",
"value" : 0x753C3
}
]
},
{
"name" : "maxSlots|Dummy",
"library" : "engine",
"type" : "byte",
"memoryType" : "data",
"identifiers" :
[
{
"os" : "linux",
"mod" : "cstrike",
"value" : 0
}
]
}
]

It should work fine. Be aware if an update has been occured to the hl1 engine since the day joaquim has posted the offset, the offset could be wrong now.
Thx a lot man. :) But i steel have "maxplayers cannot be changed while a server is running" message, i think new offsets -( Damn it

anna575
08-30-2010, 06:49
Hey, I read your thread, too great. All of these bytes are very efficient for us. You can download it. It's good to know there's helpful information like that on your website to ease the transition.:cry: