GUIDE:HOW TO SEND A PACKET WITH THE HELP OF PHCONNECTOR AND EDXLOADER
In order to make a packet sender to work, we need to send the connection through a proxy, which will take care of the encryption and decryption of the packets(the security basically, except the hackshield, that’s why you can’t use it on isro). And in order to make the proxy work, we need to use a loader(edx loader in the example) which will redirect all the traffic through the proxy.
[Only registered and activated users can see links. Click Here To Register...]
*This is an example, we will cover setting the ports and selecting the server you like.
To send a packet to silkroad server with phconnector/nuconnector(going to use phconnector in examples, but there shouldn't be any difference), we need to set the configuration files of the phconnector, so it knows where the data is coming from and where to send it to.
To do that we need to know the IP address and PORT of the server. To get the IP and the PORT, we need to open up edxLoader and add the sro_client to it. After that the edxloader should display the IP address and the port of the server. While the edxloader is still open go ahead and tick “Multiclient” and “Redirect Gateway Server” and set the port to 18000(will cover why we did this). Our edxLoader should look something like this now:
[Only registered and activated users can see links. Click Here To Register...]
Open up the phconnector configuration file and you should see something like this:
[Only registered and activated users can see links. Click Here To Register...]
Place your private server's (silkroad europe private server in my example) IP address and port into the config file. You may also enter a host name, or convert the host name into an ip address(google: convert host name into IP address).
Now we need to tell the phconnector, which port the exloader will redirect all the traffic, so the phconnector can listen and accept all the packets. For that we use ListenPort. You can set it to your liking as longs as you have set the edxloader to redirect the traffic to the same port.
Next, we need to set the port that the phconnector will listen and accept a bot connection(and later exchange data). For that we need to configure the BotPort. You can also set it to your liking, because this will be the port that the bot has to connect to, and when you code your own bot, you can tell it which port it needs to connect to. Finally our example configuration file should look like this:
[Only registered and activated users can see links. Click Here To Register...]
Note: Bot->phconnector and Client(loader)->phconnector communication is done through localhost (127.0.0.1), and that's the reason, why we only set the ip for the private server and not for the bot and edxloader.
Next, we need to understand the basics of Socket programming and sro packet structure. A packet is an array of bytes, which in the case of sro consists of:
size(of the data only) (2bytes)
opcode (2bytes)
direction(some say security byte) (2bytes)
data (x bytes)
And you'll have to place those bytes in the array accordingly: size->opcode->direction->data.
For example, the sit packet:
size 00 01 (because the data is 04)
opcode 70 4f
direction 00 01 (0001 represents client to server (c->s) unencrypted(you can send encrypted packets too)*)
data 04
Which in byte array looks like 00 01 70 4f 00 01 04 . That is what we are going to send to the phconnector. Once we send it, phconnector encrypts it, sends to the server, and makes our character sit.
*Note: Security byte can be either 1,2,3 or 4, but most of the time, you want to use 1.
0x0001 Unencrypted to the Server
0x0002 Unencrypted to the Client
0x0003 Encrypted to the Server
0x0004 Encrypted to the Client
To send the array you need to establish a connection to the phconnector through the localhost and port(which in this example is set to 23580). Then use the Socket.Send method to send the packet. I can't explain any further, because this is the limit of my knowledge. To fully understand this you need to examine the source code provided by qkuh (2 posts up) and become familiar with socket programming.
GOOD ARTICLES ABOUT ASYNCHRONOUS SOCKET CONNECTION:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
If you want to know how to sniff the packets, let me know(hint: it can be done with phAnalyzer). Report my mistakes too, please. :)