Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 17:23

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

Advertisement



[HELP] Error when in AuthServer.cs

Discussion on [HELP] Error when in AuthServer.cs within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2007
Posts: 187
Received Thanks: 45
[HELP] Error when in AuthServer.cs

IM gettin this an error on line 31 of Auth Server

This is my AuthServer.cs

Code:
/*
 * Created by SharpDevelop.
 * User: sams
 * Date: 3/8/2009
 * Time: 2:19 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.IO;
using System.Net.Sockets;

namespace CoEmu_v2_LoginServer.Connections
{
	/// <summary>
	/// Description of AuthSocket.
	/// </summary>
	public static class AuthSocket
	{
		private static Socket Auth;
        private const string SERVER_IP = "127.0.0.1";
        public const string NANO_IP = "86.149.255.50";
		private const int AUTH_PORT = 5817;
		
		public static bool Authorize(string user, uint key, bool nano)
		{
			try{
				Auth = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
				if(!nano)
				{
					[COLOR="Red"]Auth.Connect(SERVER_IP, AUTH_PORT);[/COLOR]				}
				else{
					Auth.Connect(NANO_IP, AUTH_PORT);
				}
				Auth.Send(System.Text.Encoding.ASCII.GetBytes("(A)" + user + "," + key));
				Auth.Close();
			}
			catch(Exception e)
			{
				Console.WriteLine(e.ToString());
				return false;
			}
			return true;
		}
	}
}
However when i open this i manage to log in after a few tries?

Help????

I this it has something to do with this....
Code:
/*
 * Created by SharpDevelop.
 * User: sams
 * Date: 3/8/2009
 * Time: 12:38 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using CoEmu_v2_LoginServer.Connections;
using CoEmu_v2_LoginServer.Database;

namespace CoEmu_v2_LoginServer
{
	/// <summary>
	/// Allows for handling of packets from the client->loginserver or client->gameserver.
	/// </summary>
	public static class PacketProcessor
	{
		public static void ProcessPacket(byte[] Data, ClientSocket CSocket)
		{
			int Type = (Data[3] << 8) + Data[2];
			switch(Type)
			{
				case 1086:
					{
						RequestLogin(Data, CSocket);
						break;
					}
				default:
					{
						Console.WriteLine("[LoginServer] Unknown packet type: " + Type);
						break;
					}
			}
		}
		public static void RequestLogin(byte[] Data, ClientSocket CSocket)
		{
			string AccountName = "";
	        string Password = "";
	        string ServerName = "";
	        if(Data.Length >= 276)
	        {
		        for (int i = 4; i < 0x114; i++)
		        {
		            if (i >= 0x14 && i < 0xf9)
		            {
		            	if(Data[i] != 0x00)
		                Password += (Convert.ToString(Data[i], 16)).PadLeft(2, '0');
		            }
		            if (i < 0x14)
		                if (Data[i] != 0x00)
		                    AccountName += Convert.ToChar(Data[i]);
		            if (i > 0xfa)
		            	if (Data[i] != 0x00)
		                    ServerName += Convert.ToChar(Data[i]);
		        }
	        }
	        else
	        {
	        	return;
	        }
	       /* if(AccountName != "dsfreak")
	        {
	        	CSocket.Disconnect();
	        	return;
	        }*/
	        System.Random Random = new System.Random();
	        Console.WriteLine("[LoginServer] " + AccountName + " logging in to " + ServerName);
	        string DBPass = Database.Database.Password(AccountName);
	        //TODO: Check for ban.
	        if(DBPass != "ERROR")
	        {
	        	if(DBPass == Password)
	        	{
	        		//OKAY to login!
	        		uint Key = (uint)(Random.Next(10000000) << 32);
	        		Key = Key << 32;
        			Key = (uint)(Key | (uint)Random.Next(10000000));
        			byte[] Key1 = new byte[4];
			        byte[] Key2 = new byte[4];
			        Key1[0] = (byte)(((ulong)Key & 0xff00000000000000L) >> 56);
			        Key1[1] = (byte)((Key & 0xff000000000000) >> 48);
			        Key1[2] = (byte)((Key & 0xff0000000000) >> 40);
			        Key1[3] = (byte)((Key & 0xff00000000) >> 32);
			        Key2[0] = (byte)((Key & 0xff000000) >> 24);
			        Key2[1] = (byte)((Key & 0xff0000) >> 16);
			        Key2[2] = (byte)((Key & 0xff00) >> 8);
			        Key2[3] = (byte)(Key & 0xff);
[COLOR="red"]			        if(ServerName == "PixelEmpire")
			        {
                        /*if(AuthSocket.Authorize(AccountName, Key, false))
                        {
                            CSocket.Send(Packets.AuthResponse("127.0.0.1", Key1, Key2));
                        }
                        else
                        {
                            CSocket.Disconnect();
                        }*/
                        if (AuthSocket.Authorize(AccountName, Key, false))
				        {
                            CSocket.Send(Packets.AuthResponse("127.0.0.1", Key1, Key2));
				        }
				        else
				        {
				        	CSocket.Disconnect();
				        }
			        }
			        else if(ServerName == "CoEmu.Nano")
			        {
			        	if(AuthSocket.Authorize(AccountName, Key, true))
				        {
                            CSocket.Send(Packets.AuthResponse("127.0.0.1", Key1, Key2));
				        }
				        else
				        {
				        	CSocket.Disconnect();
				        }
			        }
	        	}[/COLOR]	        	else if(DBPass == "")
	        	{
	        		Console.WriteLine("[LoginServer](Diagnostic) Set password for " + AccountName);
	        		Database.Database.SetPass(AccountName, Password);
	        		//OKAY to login!
	        		uint Key = (uint)(Random.Next(10000000) << 32);
	        		Key = Key << 32;
        			Key = (uint)(Key | (uint)Random.Next(10000000));
        			byte[] Key1 = new byte[4];
			        byte[] Key2 = new byte[4];
			        Key1[0] = (byte)(((ulong)Key & 0xff00000000000000L) >> 56);
			        Key1[1] = (byte)((Key & 0xff000000000000) >> 48);
			        Key1[2] = (byte)((Key & 0xff0000000000) >> 40);
			        Key1[3] = (byte)((Key & 0xff00000000) >> 32);
			        Key2[0] = (byte)((Key & 0xff000000) >> 24);
			        Key2[1] = (byte)((Key & 0xff0000) >> 16);
			        Key2[2] = (byte)((Key & 0xff00) >> 8);
			        Key2[3] = (byte)(Key & 0xff);
[COLOR="RoyalBlue"]			        if(ServerName == "PixelEmpire")
			        {
                        /*if(AuthSocket.Authorize(AccountName, Key, false))
                        {
                            CSocket.Send(Packets.AuthResponse("86.149.255.50", Key1, Key2));
                        }
                        else
                        {
                            CSocket.Disconnect();
                        }*/
                        if (AuthSocket.Authorize(AccountName, Key, false))
				        {
                            CSocket.Send(Packets.AuthResponse("86.149.255.50", Key1, Key2));
				        }
				        else
				        {
				        	CSocket.Disconnect();
				        }
			        }
			        else if(ServerName == "CoEmu.Nano")
			        {
			        	if(AuthSocket.Authorize(AccountName, Key, true))
				        {
                            CSocket.Send(Packets.AuthResponse("86.149.255.50", Key1, Key2));
				        }
				        else
				        {
				        	CSocket.Disconnect();
				        }
			        }
	        	}
	        	else
	        	{
	        		CSocket.Send(Packets.WrongPass());
	        		CSocket.Disconnect();
	        	}
	        }
	        else
	        {
	        	Console.WriteLine("DBPass equals ERROR: " + DBPass);
	        	CSocket.Disconnect();
	        }
		}
	}
}[/COLOR]
I did that to see If it would let both on at the same time but im confused now Help please.
Andrew.A is offline  
Old 06/07/2009, 21:03   #2
 
elite*gold: 0
Join Date: Sep 2008
Posts: 490
Received Thanks: 595
Quote:
Originally Posted by Andrew.A View Post
IM gettin this an error on line 31 of Auth Server

This is my AuthServer.cs

Code:
/*
 * Created by SharpDevelop.
 * User: sams
 * Date: 3/8/2009
 * Time: 2:19 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.IO;
using System.Net.Sockets;

namespace CoEmu_v2_LoginServer.Connections
{
	/// <summary>
	/// Description of AuthSocket.
	/// </summary>
	public static class AuthSocket
	{
		private static Socket Auth;
        private const string SERVER_IP = "127.0.0.1";
        public const string NANO_IP = "86.149.255.50";
		private const int AUTH_PORT = 5817;
		
		public static bool Authorize(string user, uint key, bool nano)
		{
			try{
				Auth = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
				if(!nano)
				{
					[COLOR="Red"]Auth.Connect(SERVER_IP, AUTH_PORT);[/COLOR]				}
				else{
					Auth.Connect(NANO_IP, AUTH_PORT);
				}
				Auth.Send(System.Text.Encoding.ASCII.GetBytes("(A)" + user + "," + key));
				Auth.Close();
			}
			catch(Exception e)
			{
				Console.WriteLine(e.ToString());
				return false;
			}
			return true;
		}
	}
}
However when i open this i manage to log in after a few tries?

Help????

I this it has something to do with this....
Code:
/*
 * Created by SharpDevelop.
 * User: sams
 * Date: 3/8/2009
 * Time: 12:38 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using CoEmu_v2_LoginServer.Connections;
using CoEmu_v2_LoginServer.Database;

namespace CoEmu_v2_LoginServer
{
	/// <summary>
	/// Allows for handling of packets from the client->loginserver or client->gameserver.
	/// </summary>
	public static class PacketProcessor
	{
		public static void ProcessPacket(byte[] Data, ClientSocket CSocket)
		{
			int Type = (Data[3] << 8) + Data[2];
			switch(Type)
			{
				case 1086:
					{
						RequestLogin(Data, CSocket);
						break;
					}
				default:
					{
						Console.WriteLine("[LoginServer] Unknown packet type: " + Type);
						break;
					}
			}
		}
		public static void RequestLogin(byte[] Data, ClientSocket CSocket)
		{
			string AccountName = "";
	        string Password = "";
	        string ServerName = "";
	        if(Data.Length >= 276)
	        {
		        for (int i = 4; i < 0x114; i++)
		        {
		            if (i >= 0x14 && i < 0xf9)
		            {
		            	if(Data[i] != 0x00)
		                Password += (Convert.ToString(Data[i], 16)).PadLeft(2, '0');
		            }
		            if (i < 0x14)
		                if (Data[i] != 0x00)
		                    AccountName += Convert.ToChar(Data[i]);
		            if (i > 0xfa)
		            	if (Data[i] != 0x00)
		                    ServerName += Convert.ToChar(Data[i]);
		        }
	        }
	        else
	        {
	        	return;
	        }
	       /* if(AccountName != "dsfreak")
	        {
	        	CSocket.Disconnect();
	        	return;
	        }*/
	        System.Random Random = new System.Random();
	        Console.WriteLine("[LoginServer] " + AccountName + " logging in to " + ServerName);
	        string DBPass = Database.Database.Password(AccountName);
	        //TODO: Check for ban.
	        if(DBPass != "ERROR")
	        {
	        	if(DBPass == Password)
	        	{
	        		//OKAY to login!
	        		uint Key = (uint)(Random.Next(10000000) << 32);
	        		Key = Key << 32;
        			Key = (uint)(Key | (uint)Random.Next(10000000));
        			byte[] Key1 = new byte[4];
			        byte[] Key2 = new byte[4];
			        Key1[0] = (byte)(((ulong)Key & 0xff00000000000000L) >> 56);
			        Key1[1] = (byte)((Key & 0xff000000000000) >> 48);
			        Key1[2] = (byte)((Key & 0xff0000000000) >> 40);
			        Key1[3] = (byte)((Key & 0xff00000000) >> 32);
			        Key2[0] = (byte)((Key & 0xff000000) >> 24);
			        Key2[1] = (byte)((Key & 0xff0000) >> 16);
			        Key2[2] = (byte)((Key & 0xff00) >> 8);
			        Key2[3] = (byte)(Key & 0xff);
[COLOR="red"]			        if(ServerName == "PixelEmpire")
			        {
                        /*if(AuthSocket.Authorize(AccountName, Key, false))
                        {
                            CSocket.Send(Packets.AuthResponse("127.0.0.1", Key1, Key2));
                        }
                        else
                        {
                            CSocket.Disconnect();
                        }*/
                        if (AuthSocket.Authorize(AccountName, Key, false))
				        {
                            CSocket.Send(Packets.AuthResponse("127.0.0.1", Key1, Key2));
				        }
				        else
				        {
				        	CSocket.Disconnect();
				        }
			        }
			        else if(ServerName == "CoEmu.Nano")
			        {
			        	if(AuthSocket.Authorize(AccountName, Key, true))
				        {
                            CSocket.Send(Packets.AuthResponse("127.0.0.1", Key1, Key2));
				        }
				        else
				        {
				        	CSocket.Disconnect();
				        }
			        }
	        	}[/COLOR]	        	else if(DBPass == "")
	        	{
	        		Console.WriteLine("[LoginServer](Diagnostic) Set password for " + AccountName);
	        		Database.Database.SetPass(AccountName, Password);
	        		//OKAY to login!
	        		uint Key = (uint)(Random.Next(10000000) << 32);
	        		Key = Key << 32;
        			Key = (uint)(Key | (uint)Random.Next(10000000));
        			byte[] Key1 = new byte[4];
			        byte[] Key2 = new byte[4];
			        Key1[0] = (byte)(((ulong)Key & 0xff00000000000000L) >> 56);
			        Key1[1] = (byte)((Key & 0xff000000000000) >> 48);
			        Key1[2] = (byte)((Key & 0xff0000000000) >> 40);
			        Key1[3] = (byte)((Key & 0xff00000000) >> 32);
			        Key2[0] = (byte)((Key & 0xff000000) >> 24);
			        Key2[1] = (byte)((Key & 0xff0000) >> 16);
			        Key2[2] = (byte)((Key & 0xff00) >> 8);
			        Key2[3] = (byte)(Key & 0xff);
[COLOR="RoyalBlue"]			        if(ServerName == "PixelEmpire")
			        {
                        /*if(AuthSocket.Authorize(AccountName, Key, false))
                        {
                            CSocket.Send(Packets.AuthResponse("86.149.255.50", Key1, Key2));
                        }
                        else
                        {
                            CSocket.Disconnect();
                        }*/
                        if (AuthSocket.Authorize(AccountName, Key, false))
				        {
                            CSocket.Send(Packets.AuthResponse("86.149.255.50", Key1, Key2));
				        }
				        else
				        {
				        	CSocket.Disconnect();
				        }
			        }
			        else if(ServerName == "CoEmu.Nano")
			        {
			        	if(AuthSocket.Authorize(AccountName, Key, true))
				        {
                            CSocket.Send(Packets.AuthResponse("86.149.255.50", Key1, Key2));
				        }
				        else
				        {
				        	CSocket.Disconnect();
				        }
			        }
	        	}
	        	else
	        	{
	        		CSocket.Send(Packets.WrongPass());
	        		CSocket.Disconnect();
	        	}
	        }
	        else
	        {
	        	Console.WriteLine("DBPass equals ERROR: " + DBPass);
	        	CSocket.Disconnect();
	        }
		}
	}
}[/COLOR]
I did that to see If it would let both on at the same time but im confused now Help please.
Try using a different port for the second server.
(thats a guess if it works for the first and not for the second.)
_fobos_ is offline  
Old 06/07/2009, 23:06   #3
 
elite*gold: 0
Join Date: Feb 2008
Posts: 668
Received Thanks: 160
I think your ports are blocked?
YukiXian is offline  
Old 06/08/2009, 09:57   #4
 
elite*gold: 0
Join Date: Aug 2007
Posts: 187
Received Thanks: 45
It has nothing to do with port forwarding as ALL ports are forwarded
Andrew.A is offline  
Reply


Similar Threads Similar Threads
[Fehler] Patch? Error? Hier Hilfe! [Error]
12/02/2010 - Combat Arms - 14 Replies
Da ich keine Werbung machen möchte muss ich wohl alles abkopieren... Ich entschuldige mich das ich alles zuspoilern musste aber bei soviel Text....;) 1.Error Codes und ähnliches Da es nach einem neuen Update immer wieder Probleme auftreten, empfehlen wir Euch folgende Liste mit den häufigsten Fehlern durchzugehen: 1. Deinstalliere Combat Arms über Arbeitsplatz-->Software 2. Prüfe ob alle Ordner von Nexon auf der Festplatte gelöscht sind. Wenn nicht lösche...
MySro Error~>Microsoft Error Visual C++ Runtime...
08/18/2009 - SRO Private Server - 3 Replies
Hello, i have got a problem: http://image.cp-g.net/pics/4a8971bd15c0d.jpg. I have already installed Microsoft Visual C++ Runtime Library 2005 and after that i installed 2007. It didn´t work. Who can help me? thanks Alucard15
AuthServer password encryption
04/26/2009 - CO2 Private Server - 1 Replies
Well thought it would fit in this section. Most of the sources I seen works this way: the first time an account login, it takes the "encrypted" password received and set it in the database. I've been trying to figure the encryption used, but with no success, my ASM skills just sucks. So, could anyone decent with assembler/debugging help me with this?



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


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.