[Question] Why do we need redirect IP for communicating with the client?

03/08/2013 00:07 intercsaki#1
Hey guys,

A guy here at epvp recently asked me this question, and I wondered why, too.
Can anyone explain IN DETAIL why do we need phconnector, nuconnector, and any other proxies to reach sro_client.exe? Yes, of course, bots and other programs, but why do THEY use localhost to communicate? It must have the reason...

Would help us a lot to understand the communication. :)


Thanks in advance. :)
03/08/2013 17:10 lesderid#2
A proxy like phConnector etc. usually has three sockets (i.e. network connections):

One socket connects to the GatewayServer (aka 'Login Server') and later it disconnects from the GatewayServer and can be reused to connect to the AgentServer (aka. 'Game Server').

The second socket is a server socket, usually listening on port 15779 and hostname localhost. This is the port that the client connects to.

The last socket is also a server socket, which listens on a user-defined port. The bot, alchemy tool or whatever (just called 'bot' after this) connects to this port. Using specially crafted packets (*) sent to this port, the bot can send packets to the client or the server via the proxy.

A schematic overview:

[Only registered and activated users can see links. Click Here To Register...]

* Example of a possible header format:
uint16 - total length
uint16 - opcode (real opcode)
byte (bool) - direction flag (00: client, 01: server)
byte[] - data

From this header the proxy can gather all the information needed to send the packet it received from the bot (obviously with the right SRO packet header) to the right socket.

Edit: I just realised that I didn't really answer your question. So, why do we need a proxy? Well, we don't, really. Instead of a proxy we could hook the clients winsock imports and use them directly.

However, this has disadvantages. For example, every bot would need to have its own loader (a proxy can be reused by basically all bots or alchemy tools) to hook the functions, and it wouldn't be possible to host the clients on one PC and run the bots on another.

Edit 2: This post is based on the idea that the proxy and the bot are two separate applications. These days, more advanced bots have a built-in proxy that the client connects to, so only one application is needed.
03/08/2013 17:19 PortalDark#3
in other words, the proxy is used as a way to get the connection(to read/write packets) between client and server
for example
mBot has his own built-in proxy, so you wont need another
03/08/2013 17:20 lesderid#4
Quote:
Originally Posted by PortalDark View Post
in other words, the proxy is used as a way to get the connection(to read/write packets) between client and server
for example
mBot has his own built-in proxy, so you wont need another
He asked to explain it in detail, so I did. :P
03/08/2013 17:22 PortalDark#5
Quote:
Originally Posted by lesderid View Post
He asked to explain it in detail, so I did. :P
i wanted to at the same time, what i read is what i think understood
03/08/2013 21:11 intercsaki#6
Wow, it IS detailed. :) Thanks for that.

In the meantime I heard the same what you wrote down, that proxy is unnecessary but greatly advised, so it's good to feel confirmed. :)


An actual question, because I don't really get it: Why do we need "0/22 0 0" as arguments when we're starting sro process?
03/08/2013 21:25 lesderid#7
Quote:
Originally Posted by intercsaki View Post
Wow, it IS detailed. :) Thanks for that.

In the meantime I heard the same what you wrote down, that proxy is unnecessary but greatly advised, so it's good to feel confirmed. :)


An actual question, because I don't really get it: Why do we need "0/22 0 0" as arguments when we're starting sro process?
I have no idea to be quite honest, never looked into that. I suspect it might have something to do with the selected division and the locale, but I could be totally wrong. :P

Edit: From pushedx's edxSilkroadLoader_Lite:
Code:
std::stringstream args;
args << "0 /" << (int)data.divInfo.locale << " " << divindex << " " << ipindex;
03/10/2013 13:16 LastThief*#8
Quote:
Originally Posted by intercsaki View Post
Wow, it IS detailed. :) Thanks for that.

In the meantime I heard the same what you wrote down, that proxy is unnecessary but greatly advised, so it's good to feel confirmed. :)


An actual question, because I don't really get it: Why do we need "0/22 0 0" as arguments when we're starting sro process?
locale stuff related to the client if you changed those arguments it'll never work