Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 06:17

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help C# clientless Problem

Discussion on Help C# clientless Problem within the SRO Coding Corner forum part of the Silkroad Online category.

Closed Thread
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2009
Posts: 46
Received Thanks: 5
Help C# clientless Problem

hey guys ,
i wanna to build an clientless based tool for one of the private servers , i alrdy made some Clientless tools by Autoit i got the concept but i faced some problems with the c# .

i think the problem in the 0xA102 packet or the TCP socket redirction method i used.
Here is the working Autoit code ;

And here is the non working C# code

i just read some others clientless sources and i Noticed that they use multiThreads for receiving.

The Question : my redirection mechanism is correct or i miss some thing or i must build receiving Multithreads ?

Thanks in advance .
theking200051 is offline  
Old 05/29/2015, 23:00   #2
 
elite*gold: 0
Join Date: Nov 2007
Posts: 959
Received Thanks: 602
I'd love to help you,but with this small piece of code I can't really say anything..
vorosmihaly is offline  
Thanks
1 User
Old 05/30/2015, 03:26   #3
 
elite*gold: 0
Join Date: Feb 2009
Posts: 46
Received Thanks: 5
ty for try helping ,the code is large so i just ignore some unimportant methods and unimportant OPcodes like 0xA100,0x2322,0xA103,0x6323.... and so on , if it still not enough i can upload the full project .

Ty again for response and sry for the bad design.


Code:
static private Socket s;
        static private TransferBuffer recv_buffer = new TransferBuffer(4096, 0, 0);
        static private Security security = new Security();
        static private List<Packet> packets = new List<Packet>();
public void beginconnect(string ips,int port)     \\ this method for intiate the TCP session ;
         {
              s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
             IPAddress ip = IPAddress.Parse(ips);
             bool stoploop = false;
             while (stoploop == false)
             {
                 try
                 {
                     s.Connect(ip, port);
                     s.Blocking = false;
                     s.NoDelay = true;
                     stoploop = true;
                     //GUI.Debugmsg("Intiate TCP Session ......");
                 }
                 catch 
                 {
                     GUI.Debugmsg("Intiate TCP Session Failed !");
                     Thread.Sleep(3000);
                      stoploop = false;
                 }
                 Thread.Sleep(1000);
             }
         }

public void DoRecv()                   \\\\ tell the program to start receving 
        {
            SocketError err;
            
            while (Stop_recv == false )
	       {
	        recv_buffer.Size = s.Receive(recv_buffer.Buffer, 0, recv_buffer.Buffer.Length, SocketFlags.None, out err);
               if (err !=SocketError.Success)
	             {
                     if (err !=SocketError.WouldBlock)
                     {
                         GUI.Debugmsg("TCP Disconnected !" + err);
                         Restartconnection();
                         break; 
                     }
	             }
                else
	             {
                   if (recv_buffer.Size > 0)
                        {
                            security.Recv(recv_buffer);
                        }
                        //else
                        //{
                        //    GUI.Debugmsg("TCP Not receiving Error !");
                        //    Restartconnection();             
                        //    break;
                        //}
	             }
               ///////////////////////////////////////////////////
                    List<Packet> tmp_packets = security.TransferIncoming();
                    if (tmp_packets != null)
                    {
                        packets.AddRange(tmp_packets);
                    }
                     if (packets.Count>0)
	                {
                       RX_login()                  
	                }
                   Thread.Sleep(10);    
           }

          }

 private void RX_login()                    \\\\\ contain the received packets and switch the opcode to find the response  
        {
            foreach (Packet packet in packets)
              {   
                switch (packet.Opcode)
                {
                    case 0x2001:
                        string gate = packet.ReadAscii();
                        if (gate =="GatewayServer")
                        {
                            TX_response(0x6100,true,false);
                            //GUI.Debugmsg("6100 !");
                        }
                        if (gate=="AgentServer")
	                     {
                             TX_response(0x6103, true, false);
                             GUI.Debugmsg("Redirected !");
	                     }
                    break;
                  
                    case 0xA102:
                    byte result = packet.ReadUInt8();
                    if (result==0x01)
                    {
                         ID = packet.ReadUInt32();
                         IP = packet.ReadAscii();
                         port = packet.ReadUInt16();
                       IPAdress _ip = IPAdress.parse(IP
                         s.connect(_ip,port);
                        GUI.Debugmsg("0XA102");
                    }
                    else
                    {
                        GUI.Debugmsg("Failed to Login !");
                    }
                    break;
                   
            }
            DoSend();
        }

 private void TX_response(ushort opcode,bool Encrypt,bool Massive)     ////// contain the response function to the received Packets 
        {
            Packet response = new Packet(opcode, Encrypt, Massive);

            switch (opcode)
            {
                case 0x6100 :
                     response.WriteUInt8(0x16);
                     response.WriteAscii("SR_Client");
                     response.WriteUInt32(0x2E01);
                    break;
               
                
                case 0x6103 :
                response.WriteUInt32(ID);
                response.WriteAscii(Globals.username);
                response.WriteAscii(Globals.Password);
                response.WriteUInt8(0x16);
                response.WriteUInt32(0);
                response.WriteUInt16(0);
                break;
            }

            security.Send(response);
        }

private void DoSend()                \\\\\\\\\\\ Transfer the packets from Silkroadsecurity APi to send it
        {
            List<KeyValuePair<TransferBuffer, Packet>> tmp_buffers = security.TransferOutgoing();
            if (tmp_buffers != null)
            {
                foreach (var kvp in tmp_buffers)
                {
                    TransferBuffer buffer = kvp.Key;
                    Packet packet = kvp.Value;

                    SocketError err = SocketError.Success;

                    while (buffer.Offset != buffer.Size)
                    {
                        byte[] packet_bytes = packet.GetBytes();
                       
                       
                        int sent = s.Send(buffer.Buffer, buffer.Offset, buffer.Size - buffer.Offset, SocketFlags.None, out err);
                        if (err != SocketError.Success)
                        {
                            if (err != SocketError.WouldBlock)
                            {
                                // error ///////////////////
                                break;
                            }
                        }
                        buffer.Offset += sent;
                        Thread.Sleep(10);
                        
                    }
                }
theking200051 is offline  
Old 06/07/2015, 09:42   #4
 
elite*gold: 0
Join Date: Feb 2009
Posts: 46
Received Thanks: 5
i Found the solution .
to redirect u must create a new socket not change the old one.
request to Close .
theking200051 is offline  
Old 06/07/2015, 19:39   #5


 
Nectix's Avatar
 
elite*gold: 26
The Black Market: 135/0/0
Join Date: Apr 2012
Posts: 23,017
Received Thanks: 3,061
#closed
Nectix is offline  
Closed Thread


Similar Threads Similar Threads
clientless problem
12/24/2010 - Silkroad Online - 10 Replies
if i have do the update they dont show more the server why ?
Clientless - Problem,Need HELP !
12/23/2008 - Silkroad Online - 0 Replies
Well its been a very long time that the Clientless's "trace" function is not working for everyone.Well,could someone sacrifice some time to fix this issue please,not just me,everyone would appreciate it.(Or you can explain me how to fix it) ps: Every other function is working normally(example:sit,move,leave and etc) Thanks
Clientless problem
09/22/2008 - Silkroad Online - 4 Replies
when i run silkroad client from Clientless i get CRASH ERROR why? some one can help??
Clientless problem
06/21/2008 - Silkroad Online - 2 Replies
Hi all, I tested the clientless software, made by Drew_Benton and it gave me an error after I typed in my code, I will show you the log. Attempting to connect to the login server. Connected to the login server. Now sending the login packet. Image code received. Please enter the image code. Sending image code "i7HQHh".
Clientless Bot Problem
11/22/2007 - Say Hello - 1 Replies
Hi leute, ich hab mal ne Frage beim clientless bot, also ich hab mir die neuste Version 1.75 runtergeladen und AppLocale .Hab beides gezipt und installiert. Jetzt drücke ich auf login und da kommen Chinesiche Schriftzeichen die ich mit Google translate übersetzt habe und die Übersetztung lautet "The authentication server disconnected". Bedeutet das dass die server down sind? Danke jetzt schon euer _SouleateR_



All times are GMT +1. The time now is 06:17.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.