[Help] Trivia Event Bot

02/02/2017 01:32 bilal_v#1
Hello everyone,
The point of this topic is I want to create a Trivia Event Bot and make it public including source codes.

The steps of the bot is;
  1. Create proxy and redirect packets to it.
  2. Read packets and find packets with chatting opcode (0x3026).
  3. Check the type of the packet (It must be global chat).
  4. Check if the user is [Bot]System or counterpart.
  5. Try to find the question in saved questions.
  6. If bot has the question in its database, send the answer via PM to [Bot]System.

Creating question database, how to store questions in database (in a file or DB, table rows etc.), when to save/update database or searching for answer (hash questions to find faster or string comparison for all the questions) etc. is not mentioned above. This is just some kind of pseudo code.

The first of all, I did some digging in this forum and I have found pushedx's guides.
Firstly, I read [Only registered and activated users can see links. Click Here To Register...]
Quote:
Originally Posted by pushedx View Post
When the client connects to the proxy, the proxy then creates its own client to connect to the server. The reason for this is because the proxy must establish a connection to the server to be able to pass the data from the server back to the client and from the client to the server. The setup looks like this in ASCII art: Client <-> Proxy <-> Server.
As far as I understood, the logic is simply create a proxy then use it like a man-in-the-middle to sniff/drop/send packets.

My system is Windows 10 x64 and my IDE is Visual Studio 2015.

I downloaded the Silkroad Security API and tried to build [Only registered and activated users can see links. Click Here To Register...] When I run the code with the parameters in [Only registered and activated users can see links. Click Here To Register...], it doesn't go any further after this line near 62.
Code:
//Check image for how did I set parameters.
//My parameters are,
//127.0.0.1 16000 37.156.246.19 15779
local_context.Socket = server.Accept();
So, I thought that this was a module of a bigger application and I was trying to run this application without hooking the .exe or something else. That is why I tried to run [Only registered and activated users can see links. Click Here To Register...] that mentioned in [Only registered and activated users can see links. Click Here To Register...], created by Devsome.
All I wanted to do with that application was to run it and see if it sends any message to the [BOT]System.
The application extracted the server IP wrong (I checked IP, port and division from mBot 1.12b), so I hardcoded the IP, port and division.

Code:
private void fMain_Load(object sender, EventArgs e)
{
        //The following 3 lines are my code.
        Framework.Global.ProxyGlobal.Server_Address = "37.156.246.19";
        Framework.Global.ProxyGlobal.Server_Gateway_Port = 15779;
        Framework.Global.ProxyGlobal.Server_Division = "DIV01";

        coBoLoginServer.Items.Insert(0, Framework.Global.ProxyGlobal.Server_Address);
        coBoLoginServer.SelectedIndex = 0;
        onLogMsg("* Successfully started VEGA");
        }
It did a fine job but couldn't do the part that I am interested. I was able to launch sro_client via GUI but I couldn't send PM to [BOT]System (The server has [BOT]System and it was online).
I opened it in debug mode and I found out that I had the similar problem with pushedx's program. The program doesn't go any further from the last line that is shown below.

Code:
//In Main.cs

ag_local_server = new TcpListener(IPAddress.Parse(Global.ProxyGlobal.Proxy_IPAddress), Global.ProxyGlobal.Proxy_Agent_Port);
//ag_local_server = new TcpListener(IPAddress.Any, Global.ProxyGlobal.Proxy_Agent_Port);
ag_local_server.Start();

Console.WriteLine("* Waiting for a connection... ");
OnLogMsg("* Waiting for a connection... ");

ag_local_client = ag_local_server.AcceptTcpClient(); //Line 433, doesn't go further after this line.
After two unsuccessful attempts, I gave up tweaking codes and downloaded [Only registered and activated users can see links. Click Here To Register...]. I ran .exe, set the .pk2 and proxy as in [Only registered and activated users can see links. Click Here To Register...].

I have a strange error and have no idea about why this error occurs.
[Only registered and activated users can see links. Click Here To Register...]

I checked the forum a little about this problem and saw [Only registered and activated users can see links. Click Here To Register...]. I gave it a shot.

I set the config file and ran it.
HTML Code:
[phConnector]

GatewayIP=37.156.246.19

GatewayPort=15779



BindPort=16000

BotBind=22580



DataMaxSize=16384
After that I ran edxSilkroadLoader5, [Only registered and activated users can see links. Click Here To Register...] and launched. I had no error and was able to login to the server.


Now I wonder what is wrong with the codes/programs that was unable to work fully functional. To more be specific,
  1. Why did pushedx's "Simplest Proxy" get stuck at that line?
  2. Why did Devsome's program get stuck at that line?
  3. Why did edxSilkroadLoader5 throw error?
  4. Why did my last attempt (phConnector + edxSilkroadLoader5) work?

Also, can I send/receive packets with proxy without injecting to sro_client and launch it?
For example, if I put these lines of code to Simplest Proxy and compile-and-run it, does it work when I connect to the game?
Or should I do some injection to the game and open it then use proxy?

[Only registered and activated users can see links. Click Here To Register...]
Code:
if (packet.Opcode == 0x3026)
{
	int chat = packet.ReadUInt8();

	switch (chat)
	{
		case 6: //Global
			string name = packet.ReadAscii();
			string message = packet.ReadAscii();
			if(name == "XXX" && message.StartsWith("WTB"))
			{
				Packet pm = new Packet(0x7025);
				pm.WriteUInt16(02);
				pm.WriteAscii(name);
				pm.WriteAscii("AutoMessage");
				//Send(pm);
                                context.Security.Send(pm);
			}
			break;
	}
}
I am at the beginning of coding for injection, packet management and Silkroad, so everything about my steps and my ideas may be wrong.

Any kind of help is appreciated.
02/02/2017 13:02 florian0#2
Quote:
1. Why did pushedx's "Simplest Proxy" get stuck at that line?
2. Why did Devsome's program get stuck at that line?
Because the client never connected to it. See 3.

Quote:
3.Why did edxSilkroadLoader5 throw error?

After two unsuccessful attempts, I gave up tweaking codes and downloaded edxSilkroadLoader5. I ran .exe, set the .pk2 and proxy as in this picture.

I have a strange error and have no idea about why this error occurs.
[Only registered and activated users can see links. Click Here To Register...]
접속 실패(9) aka. Connection failure(9). This error occurs when the connection could not be established aka. no response from server.

Quote:
4. Why did my last attempt (phConnector + edxSilkroadLoader5) work?
These tools are well known to work fine with vSRO. It prooved that edxLoader's redirection works fine.
So its obivously a problem at your code.
I would guess, based on this line:
Code:
ag_local_server = new TcpListener(IPAddress.Parse(Global.ProxyGlobal.Proxy_IPAddress), Global.ProxyGlobal.Proxy_Agent_Port);
//ag_local_server = new TcpListener(IPAddress.Any, Global.ProxyGlobal.Proxy_Agent_Port);
ag_local_server.Start();
You're listening on the wrong IP. IPAddress.Any is fine, most of the time. What ever you are listening on, it needs to match the IP you put into edxLoader.
02/02/2017 14:11 "Abner"#3
Hey Bilal,
you could just use one of the previously released silkroad open source clientless bots to learn from it, or even upgrade it to fit your needs.
a simple example for this is an open source released here before (dunno whom the credits go to, but here is it anyways).
ps: you will need a working SilkroadSecurityApi to make it get to work again... (it can basically do anything including having an sql integration.)
Link: [Only registered and activated users can see links. Click Here To Register...]
press thanks if i helped. If you needed any help you could message me here.
02/22/2017 00:01 Revolutionary-Network#4
Quote:
Originally Posted by "Abner" View Post
Hey Bilal,
you could just use one of the previously released silkroad open source clientless bots to learn from it, or even upgrade it to fit your needs.
a simple example for this is an open source released here before (dunno whom the credits go to, but here is it anyways).
ps: you will need a working SilkroadSecurityApi to make it get to work again... (it can basically do anything including having an sql integration.)
Link: [Only registered and activated users can see links. Click Here To Register...]
press thanks if i helped. If you needed any help you could message me here.
you're right but what if I wanted to send HWID in logging process?
02/22/2017 08:39 mxii#5
Quote:
Originally Posted by Revolutionary-Network View Post
you're right but what if I wanted to send HWID in logging process?
feel free to implement it?! :)
02/23/2017 13:35 Revolutionary-Network#6
Quote:
Originally Posted by mxii View Post
feel free to implement it?! :)
:rolleyes: still trying to implement it when I have some free time, I'm still beginner dealing with those packets and such stuff.
02/27/2017 17:52 "Abner"#7
you could completely bypass hwid on login with the selected usernames :)


best,
03/03/2017 12:17 NyxOnline#8
did u implement successfully ?
03/04/2017 21:19 bilal_v#9
Quote:
Originally Posted by NyxOnline View Post
did u implement successfully ?
I had no time to implement it from scratch, I used some tools that I mentioned above and I haven't try anything that isn't mentioned above.
I did every part except proxy thing. I'll try to make it work with additional tools (phConnector + edxLoader) later.
[Only registered and activated users can see links. Click Here To Register...]

I also checked out [Only registered and activated users can see links. Click Here To Register...] for proxy but couldn't achieve much.
I think I'm failing because of HWID limit .dll files, but I'm not sure.
04/04/2017 15:33 LoLBoostie#10
feel free to implement it?!