Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Extenders (https://postpacific.mmorpg-game.online/forumdisplay.php?f=72)
-   -   [Tutorial]Finding things in server exe (for newbies) (https://postpacific.mmorpg-game.online/showthread.php?t=10323)

roxaz 19.02.2008 21:53

[Tutorial]Finding things in server exe (for newbies)
 
I remember myself when i barely knew asm and i was always asking how do ppl find a place to hook in exe. It is so big and confusing.. So i decided i must share knowledge to our apprentice programmers.


So lets start:

1. get l2server.exe and disassemble it in IDA. No explanations for that, even an idiot would manage to do this.

2. get list of l2server functions. lots of them were posted around in this forum (so you will need to use your searching skills ofcourse)

3. you also need basic understanding of programming, assembler(x64) and brain. dont worry if you are not too good with asm, you shold know basic instructions and what they do and registers.


now when we got all we need lets think what we would like to find. why dont we find a place where *user holds his *socket? So where do we start looking? we obviously need pointer to user. lets go to functions list and seach for user pased as an argument to function, or better, function that belongs to user class (when we call method of an object in assembler we get passed object itself to that method in rcx register). Look what i found in the functions list:

Code:

Code:

007FE950  User::Set(CUserSocket*)
so we have method that sets socket to our user. lets go in IDA to see it at 0x007FE950. We see some variables declared, some registers stored in stack and finaly first interaction with our user and socket:

Code:

Code:

.text:00000000007FE97B                mov    rdi, rdx        ; socket
.text:00000000007FE97E                mov    rsi, rcx        ; user

remember, in rcx register was passed user itself. btw you should know that x64 uses __fastcall calling convention. this means that 4 first arguments are passed in registers (rcx, rdx, r8, r9) and remaining on stack. So back to the topic - as you see our user now is rsi, socket is rdi (so are rcx and rdx, but they are overwritten later). Click with mouse on rdi, IDA will mark all rdi's in function (you should be turned on graph view in right mouse button menu). scroll down the function and see where rdi is used. and what do we see:

Code:

Code:

.text:00000000007FE9F1                mov    [rsi+2670h], rdi
rdi is moved somewhere to memory place of rsi+2670h (h in the end of number indicates that number is hexadecimal). So we move pointer of socket (we know it is a pointer from functions list, see declaration of function) to a memory place user+2670h. This is where your socket is stored. Now in your extender whenever you have pointer to user you will be able to get socket from that user Wink

Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Дата оценена по относительному времени в снимке (4 Weeks Ago); точное время не сохранилось. Открыть источник.

sandeagle 19.02.2008 21:53

[Tutorial]Finding things in server exe (for newbies)
 
althongh i havenot understood it clearly. thx man,nice tutorail guide.

its helpfull for me...

+2dc

Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Дата оценена по относительному времени в снимке (4 Weeks Ago); точное время не сохранилось. Открыть источник.

Alakazam 19.02.2008 21:53

[Tutorial]Finding things in server exe (for newbies)
 
Really nice tutorial.

However, can you provide the C++ code for your example ?

thanks.

Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Дата оценена по относительному времени в снимке (4 Weeks Ago); точное время не сохранилось. Открыть источник.

roxaz 26.02.2008 21:53

[Tutorial]Finding things in server exe (for newbies)
 
Quote:


Originally Posted by sandeagle
View Post

althongh i havenot understood it clearly. thx man,nice tutorail guide.

its helpfull for me...


+2dc

well if you dont understand something feel free to ask. community is for helping each other Wink

Quote:


Originally Posted by Alakazam
View Post

Really nice tutorial.

However, can you provide the C++ code for your example ?


thanks.

well there is no c++ code. did you read tutorial at all? Smile it is about looking for things in asm. this is basic model of thinking while reverse-engineering stuff Wink

Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Дата оценена по относительному времени в снимке (3 Weeks Ago); точное время не сохранилось. Открыть источник.


All times are GMT. The time now is 01:58.