Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Does anyone know how to get a list of all online characters/account programmatically?

Initiate Mage
Joined
Jul 17, 2013
Messages
90
Reaction score
18
This is kind of a dead subject it seams, but here is a couple of ways to go about doing this.

The first way is to create a client hook in htlauncher that will monitor when the user requests to select a character and send the name to a simple php script that records and marks the player online. Do the same when they terminate the client, logout, or switch characters. The problem with this method is if the client terminates by crashing or force closure it will not report the close to the php. Additionally you can use a heartbeat packet that sends an update challenge every few minutes to the web server to verify they are online.

The second way is to hook the login function server side and report to a php when a user logins. To get the logoff it would be best to get when the character object is destroyed.

If this is something you are offering to pay for, perhaps we could talk. I do not currently have stand alone code for the server side method created, hence paying for my time. The client side method is not something I would really recommend to attempt if you want it to be accurate.
 
Upvote 0
Joined
Jun 10, 2009
Messages
658
Reaction score
140
This is kind of a dead subject it seams, but here is a couple of ways to go about doing this.

The first way is to create a client hook in htlauncher that will monitor when the user requests to select a character and send the name to a simple php script that records and marks the player online. Do the same when they terminate the client, logout, or switch characters. The problem with this method is if the client terminates by crashing or force closure it will not report the close to the php. Additionally you can use a heartbeat packet that sends an update challenge every few minutes to the web server to verify they are online.

The second way is to hook the login function server side and report to a php when a user logins. To get the logoff it would be best to get when the character object is destroyed.

If this is something you are offering to pay for, perhaps we could talk. I do not currently have stand alone code for the server side method created, hence paying for my time. The client side method is not something I would really recommend to attempt if you want it to be accurate.

HTMessage actually has logout URL config just like game login URL but it is never called. If it was made to call then maybe work would be simple!
 
Upvote 0
Initiate Mage
Joined
Jul 17, 2013
Messages
90
Reaction score
18
HTMessage actually has logout URL config just like game login URL but it is never called. If it was made to call then maybe work would be simple!
Unless you have some way to pass an argument to the url this would not work without changes to the client, assuming the client does not already do that. Not to mention anyone could call the URL with the argument for someone elses account and the website would show that player online or offline.
 
Upvote 0
Joined
Jun 10, 2009
Messages
658
Reaction score
140
Unless you have some way to pass an argument to the url this would not work without changes to the client, assuming the client does not already do that. Not to mention anyone could call the URL with the argument for someone elses account and the website would show that player online or offline.
Logout link would obviosuly require username and password just like game login link!
 
Upvote 0
Initiate Mage
Joined
Jul 17, 2013
Messages
90
Reaction score
18
Logout link would obviosuly require username and password just like game login link!

Haha in a perfect world that would be the case, but I have no idea. If u want to paste to me the details for that URL entry you were talking about and I can see if I can find some info for you about it.
 
Upvote 0
Joined
Jan 4, 2011
Messages
83
Reaction score
21
I want to show the list of all players who are currently playing in my server on my website. Is there some way I get it from server and show?
cyberinferno: you can use the game_login.php for registering who is logged, but I do not recommend to use it, because you will not get accurate logins. As you may know that php what it does is check against the database if the password that was sent on the GET request to the web, matches the password stored in the database, and if so, it creates the .txt file that is used by DBSRV to create the socket for the client. But, as you may know too, that does not guarantees that the account will be login into the server. Why I say that? well consider this scenario: your server needs to run /openserver to allow users to get in, while you don't run /openserver players are stuck on the Server selection window, which is AFTER the login window, so the login passed (game_login.php) but you still not login into the server. Another common scenario will be when your server is under maintenance, you are not running any zone neither dbsrv, but your website is on (where you have the game_login.php) clients will pass the login verification and again will be stuck on server selection.

So if you want to be accurate with the info of the logged characters on the server, then, as dTantra said, hook server functions. Where is wrong dTantra, or at least he didn't said well, is that there is no login function on the server, what server have, is a function with a switch that process all client requirements, one of them is the Login request, another is the character selection, and so on.
And for the logout, just hook CUser::CloseUser(void) function. Im specific with the class because there are 2 CloseUser functions, one on CUser and the other in Server.cpp.

I saw in another of your post that you have the old c++ code of the zonesrv.exe, so go to ProcessClientMessage and find the value of the switch that you need for what you want to do, for example one of the switch is CSP_REQ_CHAR_INIT and another one is CSP_REQ_CHAR_SELECT or CSP_REQ_LOGIN, check what each does and which one gives what you want.

If you need more help let me know. I will not charge you any fees jajajajaj

Regards
 
Upvote 0
Joined
Jun 10, 2009
Messages
658
Reaction score
140
cyberinferno: you can use the game_login.php for registering who is logged, but I do not recommend to use it, because you will not get accurate logins. As you may know that php what it does is check against the database if the password that was sent on the GET request to the web, matches the password stored in the database, and if so, it creates the .txt file that is used by DBSRV to create the socket for the client. But, as you may know too, that does not guarantees that the account will be login into the server. Why I say that? well consider this scenario: your server needs to run /openserver to allow users to get in, while you don't run /openserver players are stuck on the Server selection window, which is AFTER the login window, so the login passed (game_login.php) but you still not login into the server. Another common scenario will be when your server is under maintenance, you are not running any zone neither dbsrv, but your website is on (where you have the game_login.php) clients will pass the login verification and again will be stuck on server selection.

So if you want to be accurate with the info of the logged characters on the server, then, as dTantra said, hook server functions. Where is wrong dTantra, or at least he didn't said well, is that there is no login function on the server, what server have, is a function with a switch that process all client requirements, one of them is the Login request, another is the character selection, and so on.
And for the logout, just hook CUser::CloseUser(void) function. Im specific with the class because there are 2 CloseUser functions, one on CUser and the other in Server.cpp.

I saw in another of your post that you have the old c++ code of the zonesrv.exe, so go to ProcessClientMessage and find the value of the switch that you need for what you want to do, for example one of the switch is CSP_REQ_CHAR_INIT and another one is CSP_REQ_CHAR_SELECT or CSP_REQ_LOGIN, check what each does and which one gives what you want.

If you need more help let me know. I will not charge you any fees jajajajaj

Regards

Reverse engineering and hooking functions is not my forte. But in my opinion wouldn't it easier if we edit SQLDAEMON would update database each time character logs in or logs out?
 
Upvote 0
Joined
Jan 4, 2011
Messages
83
Reaction score
21
If you have the old c++ code you really dont need to reverse engineering, reverse engineering is when you dont have the high level language code, so you need to go with a debugger and read the asm opcodes or use programs like for example IDA which will do a 80% reverse engineer for you.

About SQLDAEMON, i didnt ever use it to hook any, to be honest I never took time to reverse it, because what I think is it's function is to keep the god caste of the game, probably it does more, but for sure it is not in charge of players login and logout (login and logout is what I understand you want to control to show in your website who are online inside the game).

Hooking or codecaving are the same, or at least they have the same functionality, programmers use them to change the original behavior of a function w/o the need to rewrite all the code, so I will recommend you to enforce your skills on it.

So for example, if i were you, and want my website to show the characters that are inside the game, what i will do is a dll that I attach to my zone.exe, where I hook the ProcessClientMessage, and if the request I receive is to Init a character, then I send a GET or POST request to my web with the info of the character that i want to show and keep that in an list or dictionary, of course you can instead of sending a request to the web, create a record on a table in a DB, and configure your web to read that table info in a time interval, that is up to you the way you want to handle it , then when the user logs out again, hook the CloseUser function that is on the user, and when it is called by the server then my dll will send a request to the web or delete the record in the table.

And even I think is clear why I hook CloseUser instead of the client request of logout, is because server can disconnect any user w/o the explicit request of the user.

And BTW for those who dont know Hanbit did a dll (its on the client side) is called HTWeb.dll which its main purpose was to login the users on the game by using the web and not the login window of the client. I really don't know how it works, but is there for anyone who wants to reverse it and know its full functionality.

Regards
 
Last edited:
Upvote 0
Joined
Jun 10, 2009
Messages
658
Reaction score
140
If you have the old c++ code you really dont need to reverse engineering, reverse engineering is when you dont have the high level language code, so you need to go with a debugger and read the asm opcodes or use programs like for example IDA which will do a 80% reverse engineer for you.

About SQLDAEMON, i didnt ever use it to hook any, to be honest I never took time to reverse it, because what I think is it's function is to keep the god caste of the game, probably it does more, but for sure it is not in charge of players login and logout (login and logout is what I understand you want to control to show in your website who are online inside the game).

Hooking or codecaving are the same, or at least they have the same functionality, programmers use them to change the original behavior of a function w/o the need to rewrite all the code, so I will recommend you to enforce your skills on it.

So for example, if i were you, and want my website to show the characters that are inside the game, what i will do is a dll that I attach to my zone.exe, where I hook the ProcessClientMessage, and if the request I receive is to Init a character, then I send a GET or POST request to my web with the info of the character that i want to show and keep that in an list or dictionary, of course you can instead of sending a request to the web, create a record on a table in a DB, and configure your web to read that table info in a time interval, that is up to you the way you want to handle it , then when the user logs out again, hook the CloseUser function that is on the user, and when it is called by the server then my dll will send a request to the web or delete the record in the table.

And even I think is clear why I hook CloseUser instead of the client request of logout, is because server can disconnect any user w/o the explicit request of the user.

And BTW for those who dont know Hanbit did a dll (its on the client side) is called HTWeb.dll which its main purpose was to login the users on the game by using the web and not the login window of the client. I really don't know how it works, but is there for anyone who wants to reverse it and know its full functionality.

Regards

I just wanted to show online player names in my server website. if it takes so much effort why bother? I would rather add some other better feature if I knew adding ASM code into zone.exe :cool:
 
Upvote 0
Initiate Mage
Joined
Jul 17, 2013
Messages
90
Reaction score
18
If you need more help let me know. I will not charge you any fees jajajajaj

I don't charge people for "help", I charge people for "work". Clearly he wants more help, so your going to write it for him for free?

For processing server side packets, you can use the following addresses.

K4 = 0x49DE73

K6 = 0x49BD8A

Pop the size off the stack, followed by the Packet, cast the packet header to the HEADER struct, filter out the character selection in this case, record the character name as online.

Close user for k6 is 0x66E60, first item on the stack is the packet, second item on the stack is the connection id, use the connection id to find the character name and record is as offline.
 
Upvote 0
Joined
Jun 10, 2009
Messages
658
Reaction score
140
I don't charge people for "help", I charge people for "work". Clearly he wants more help, so your going to write it for him for free?

For processing server side packets, you can use the following addresses.

K4 = 0x49DE73

K6 = 0x49BD8A

Pop the size off the stack, followed by the Packet, cast the packet header to the HEADER struct, filter out the character selection in this case, record the character name as online.

Close user for k6 is 0x66E60, first item on the stack is the packet, second item on the stack is the connection id, use the connection id to find the character name and record is as offline.

Thanks. Will see what I can do!
 
Upvote 0
Joined
Jan 4, 2011
Messages
83
Reaction score
21
I don't charge people for "help", I charge people for "work". Clearly he wants more help, so your going to write it for him for free?

hahaha on you, you really make me laught a lot when i read you.

See what you have wrote: you dont charge for help, but then you said: he Clearly wants more help and then that you would not doit for free.

BTW my comment of not charging fee was not for you was for him.

and c'mon, writing that code for him will just take you few mins, because you well know that it does not take more than few lines of code.



... if I knew adding ASM code into zone.exe :cool:

I thought you were a C# programmer not a c++ or CLI/CLR programmer, where is common to use asm to handle and manipulate the contents of the stack and registers. While is not so common in c# to use ASM, you can still do it by for example using the Fasm.NET lib
 
Last edited:
Upvote 0
Joined
Jun 10, 2009
Messages
658
Reaction score
140
I thought you were a C# programmer not a c++ or CLI/CLR programmer, where is common to use asm to handle and manipulate the contents of the stack and registers. While is not so common in c# to use ASM, you can still do it by for example using the Fasm.NET lib

I am mainly a web developer who works on PHP and NodeJS. But I do code in C# if needed for building emulator and desktop applications. My C++ skill not too high to write good complex applications yet. As far as ASM goes, I just know basics and that would not help in this matter.
 
Upvote 0
Joined
Jan 4, 2011
Messages
83
Reaction score
21
Well probably you think you need ASM because you are following what other have shown. But as a C# programer I can tell you that you dont need coding in asm at all for doing what you mentioned you want to do, and for that is why I made the comment that I thought you were a C# programmer. For the only thing you need asm knowledge, is for understanding the code that you are going to replace/modify if you dont have the code sources and you are reversing from the .exe

You said that you wanted to add ASM code to the zone.exe (or at least that is what I understand of your comment), you don't need to add asm code if you attach a dll made on the language that you manage. (of course im not talking about php). You dont even have to bother changing code on the .exe to jump to your custom functions because there are a lot libs for c# out there that do that job for you.

for example see the videos of this guy

You dont need any of what he shows needed to hook if you are programming in c#, because as I said there are libs which does that work.
 
Last edited:
Upvote 0
Joined
Jun 10, 2009
Messages
658
Reaction score
140
Well probably you think you need ASM because you are following what other have shown. But as a C# programer I can tell you that you dont need coding in asm at all for doing what you mentioned you want to do, and for that is why I made the comment that I thought you were a C# programmer. For the only thing you need asm knowledge, is for understanding the code that you are going to replace/modify if you dont have the code sources and you are reversing from the .exe

You said that you wanted to add ASM code to the zone.exe (or at least that is what I understand of your comment), you don't need to add asm code if you attach a dll made on the language that you manage. (of course im not talking about php). You dont even have to bother changing code on the .exe to jump to your custom functions because there are a lot libs for c# out there that do that job for you.

for example see the videos of this guy

You dont need any of what he shows needed to hook if you are programming in c#, because as I said there are libs which does that work.

Beautiful tutorial! Thanks
 
Upvote 0
Initiate Mage
Joined
Jul 17, 2013
Messages
90
Reaction score
18
See what you have wrote: you dont charge for help, but then you said: he Clearly wants more help and then that you would not doit for free.
BTW my comment of not charging fee was not for you was for him.

That's precisely why I asked if you were going to write the code for him for free, because you made a comment about not charging for "help". As I stated, I do not charge for help, I don't mind answering questions or pointing in the right direction, but when it comes to providing a complete solution for something I do not already have, I do most certainly charge.
 
Upvote 0
Back
Top