|
You last visited: Today at 16:43
Advertisement
Client crash at login packet ...
Discussion on Client crash at login packet ... within the CO2 Private Server forum part of the Conquer Online 2 category.
08/12/2014, 13:17
|
#1
|
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
|
Client crash at login packet ...
Hey people as title says and i am sure it's will be stupid question but i failed at this point ...
i am working on Redux source 5065 i am changed log-in way to this :
PHP Code:
#region Receive Data private unsafe void Auth_OnReceive(ISocketWrapper arg2, byte[] arg1) { if (arg1.Length == 52) { AuthState player = arg2.Connector as AuthState; player.Cryptographer.Decrypt(arg1, arg1, arg1.Length); player.Info = new Authentication(); player.Info.Deserialize(arg1); player.Account = new Database.AccountTable(player.Info.Username); Forward Fw = new Forward(); if (player.Info.Password == player.Account.Password) { if (player.Account.State == Database.AccountTable.AccountState.Banned) Fw.Type = (uint)Forward.ForwardType.Banned; else Fw.Type = Forward.ForwardType.Ready; } else { Fw.Type = Forward.ForwardType.InvalidInfo; } if (Fw.Type != Forward.ForwardType.InvalidInfo) { Fw.Identifier = Forward.Incrementer.Next; ServerBase.Kernel.AwaitingPool.Add(Fw.Identifier, player.Account); } Fw.IP = "127.0.0.1"; Fw.Port = 5816; player.Send(Fw); } else { arg2.Socket.Disconnect(false); } } #endregion
and here is Forward packet class :
PHP Code:
public class Forward : Interfaces.IPacket { public static ServerBase.Counter Incrementer; public enum ForwardType : byte { Ready = 2, InvalidInfo = 1, Banned = 0 } byte[] Buffer; public Forward() { Buffer = new byte[32]; Network.Writer.WriteUInt16(32, 0, Buffer); Network.Writer.WriteUInt16(1055, 2, Buffer); } public uint Identifier { get { return BitConverter.ToUInt32(Buffer, 4); } set { Network.Writer.WriteUInt32(value, 4, Buffer); } } public ForwardType Type { get { return (ForwardType)(byte)BitConverter.ToUInt32(Buffer, 8); } set { Network.Writer.WriteUInt32((byte)value, 8, Buffer); } } public string IP { get { return Encoding.ASCII.GetString(Buffer, 12, 16); } set { Network.Writer.WriteString(value, 12, Buffer); } } public ushort Port { get { return BitConverter.ToUInt16(Buffer, 28); } set { Network.Writer.WriteUInt16(value, 28, Buffer); } } public void Deserialize(byte[] buffer) { //no implementation } public byte[] ToArray() { return Buffer; } }
and my problem i am facing is if the entered info is incorrect i get invalid info message , but if its correct or banned i get the client crashed.
it's only crash when it receive the type is ready or banned from the source , but if its invalid info type its show me the message successfully
|
|
|
08/12/2014, 14:19
|
#2
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
|
Most likely a cryptography issue.
|
|
|
08/12/2014, 14:35
|
#3
|
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
|
Quote:
Originally Posted by Super Aids
Most likely a cryptography issue.
|
here the AuthState.cs class :
and you can see i it's encrypt the packet before it be sent
PHP Code:
public class AuthState { #region Variables public ISocketWrapper Socket { get; private set; } public AuthCryptography Cryptographer { get; private set; } public Database.AccountTable Account; public Packets.Login.Authentication Info; private byte[] SendBuffer; public const int BaseSendBufferSize = 512; #endregion #region Constructor public AuthState(ISocketWrapper client) { Socket = client; Cryptographer = new AuthCryptography(); SendBuffer = new byte[BaseSendBufferSize]; } #endregion #region Methods public void Send(Interfaces.IPacket buffer) { Send(buffer.ToArray()); } public void Send(byte[] buffer) { Cryptographer.Encrypt(buffer, buffer, buffer.Length); Socket.Send(buffer); } public void Disconnect() { if(Socket.Alive) Socket.Disconnect(); } #endregion }
and this code shows that the packet decrypted before i use it :
PHP Code:
#region Receive Data private unsafe void Auth_OnReceive(ISocketWrapper arg2, byte[] arg1) { if (arg1.Length == 52) { AuthState player = arg2.Connector as AuthState; player.Cryptographer.Decrypt(arg1, arg1, arg1.Length); player.Info = new Authentication(); player.Info.Deserialize(arg1); player.Account = new Database.AccountTable(player.Info.Username); Forward Fw = new Forward(); if (player.Info.Password == player.Account.Password) { if (player.Account.State == Database.AccountTable.AccountState.Banned) Fw.Type = (uint)Forward.ForwardType.Banned; else Fw.Type = Forward.ForwardType.Ready; } else { Fw.Type = Forward.ForwardType.InvalidInfo; } if (Fw.Type != Forward.ForwardType.InvalidInfo) { Fw.Identifier = Forward.Incrementer.Next; ServerBase.Kernel.AwaitingPool.Add(Fw.Identifier, player.Account); } Fw.IP = "127.0.0.1"; Fw.Port = 5816; player.Send(Fw); } else { arg2.Socket.Disconnect(false); } } #endregion
and at least here is AuthCryptography.cs :
PHP Code:
public class AuthCryptography { private ushort InCounter; private ushort OutCounter; public void Decrypt(byte[] In, byte[] Out, int Length) { lock (this) { for (int i = 0; i < Length; i++) { Out[i] = (byte)(In[i] ^ 0xab); Out[i] = (byte)((Out[i] << 4) | (Out[i] >> 4)); Out[i] = (byte)(Key2[this.InCounter >> 8] ^ Out[i]); Out[i] = (byte)(Key1[this.InCounter & 0xff] ^ Out[i]); this.InCounter = (ushort)(this.InCounter + 1); } } } public unsafe void Encrypt(byte* In, byte[] Out, int Length) { lock (this) { for (int i = 0; i < Length; i++) { Out[i] = (byte)(In[i] ^ 0xab); Out[i] = (byte)((Out[i] << 4) | (Out[i] >> 4)); Out[i] = (byte)(Key2[this.OutCounter >> 8] ^ Out[i]); Out[i] = (byte)(Key1[this.OutCounter & 0xff] ^ Out[i]); this.OutCounter = (ushort)(this.OutCounter + 1); } } } public void Encrypt(byte[] In, byte[] Out, int Length) { lock (this) { for (int i = 0; i < Length; i++) { Out[i] = (byte)(In[i] ^ 0xab); Out[i] = (byte)((Out[i] << 4) | (Out[i] >> 4)); Out[i] = (byte)(Key2[this.OutCounter >> 8] ^ Out[i]); Out[i] = (byte)(Key1[this.OutCounter & 0xff] ^ Out[i]); this.OutCounter = (ushort)(this.OutCounter + 1); } } } #region Key 1 public static byte[] Key1 = new byte[] { 0x9d, 0x90, 0x83, 0x8a, 0xd1, 140, 0xe7, 0xf6, 0x25, 40, 0xeb, 130, 0x99, 100, 0x8f, 0x2e, 0x2d, 0x40, 0xd3, 250, 0xe1, 0xbc, 0xb7, 230, 0xb5, 0xd8, 0x3b, 0xf2, 0xa9, 0x94, 0x5f, 30, 0xbd, 240, 0x23, 0x6a, 0xf1, 0xec, 0x87, 0xd6, 0x45, 0x88, 0x8b, 0x62, 0xb9, 0xc4, 0x2f, 14, 0x4d, 160, 0x73, 0xda, 1, 0x1c, 0x57, 0xc6, 0xd5, 0x38, 0xdb, 210, 0xc9, 0xf4, 0xff, 0xfe, 0xdd, 80, 0xc3, 0x4a, 0x11, 0x4c, 0x27, 0xb6, 0x65, 0xe8, 0x2b, 0x42, 0xd9, 0x24, 0xcf, 0xee, 0x6d, 0, 0x13, 0xba, 0x21, 0x7c, 0xf7, 0xa6, 0xf5, 0x98, 0x7b, 0xb2, 0xe9, 0x54, 0x9f, 0xde, 0xfd, 0xb0, 0x63, 0x2a, 0x31, 0xac, 0xc7, 150, 0x85, 0x48, 0xcb, 0x22, 0xf9, 0x84, 0x6f, 0xce, 0x8d, 0x60, 0xb3, 0x9a, 0x41, 220, 0x97, 0x86, 0x15, 0xf8, 0x1b, 0x92, 9, 180, 0x3f, 190, 0x1d, 0x10, 3, 10, 0x51, 12, 0x67, 0x76, 0xa5, 0xa8, 0x6b, 2, 0x19, 0xe4, 15, 0xae, 0xad, 0xc0, 0x53, 0x7a, 0x61, 60, 0x37, 0x66, 0x35, 0x58, 0xbb, 0x72, 0x29, 20, 0xdf, 0x9e, 0x3d, 0x70, 0xa3, 0xea, 0x71, 0x6c, 7, 0x56, 0xc5, 8, 11, 0xe2, 0x39, 0x44, 0xaf, 0x8e, 0xcd, 0x20, 0xf3, 90, 0x81, 0x9c, 0xd7, 70, 0x55, 0xb8, 0x5b, 0x52, 0x49, 0x74, 0x7f, 0x7e, 0x5d, 0xd0, 0x43, 0xca, 0x91, 0xcc, 0xa7, 0x36, 0xe5, 0x68, 0xab, 0xc2, 0x59, 0xa4, 0x4f, 110, 0xed, 0x80, 0x93, 0x3a, 0xa1, 0xfc, 0x77, 0x26, 0x75, 0x18, 0xfb, 50, 0x69, 0xd4, 0x1f, 0x5e, 0x7d, 0x30, 0xe3, 170, 0xb1, 0x2c, 0x47, 0x16, 5, 200, 0x4b, 0xa2, 0x79, 4, 0xef, 0x4e, 13, 0xe0, 0x33, 0x1a, 0xc1, 0x5c, 0x17, 6, 0x95, 120, 0x9b, 0x12, 0x89, 0x34, 0xbf, 0x3e }; #endregion #region Key 2 public static byte[] Key2 = new byte[] { 0x62, 0x4f, 0xe8, 0x15, 0xde, 0xeb, 4, 0x91, 0x1a, 0xc7, 0xe0, 0x4d, 0x16, 0xe3, 0x7c, 0x49, 210, 0x3f, 0xd8, 0x85, 0x4e, 0xdb, 0xf4, 1, 0x8a, 0xb7, 0xd0, 0xbd, 0x86, 0xd3, 0x6c, 0xb9, 0x42, 0x2f, 200, 0xf5, 190, 0xcb, 0xe4, 0x71, 250, 0xa7, 0xc0, 0x2d, 0xf6, 0xc3, 0x5c, 0x29, 0xb2, 0x1f, 0xb8, 0x65, 0x2e, 0xbb, 0xd4, 0xe1, 0x6a, 0x97, 0xb0, 0x9d, 0x66, 0xb3, 0x4c, 0x99, 0x22, 15, 0xa8, 0xd5, 0x9e, 0xab, 0xc4, 0x51, 0xda, 0x87, 160, 13, 0xd6, 0xa3, 60, 9, 0x92, 0xff, 0x98, 0x45, 14, 0x9b, 180, 0xc1, 0x4a, 0x77, 0x90, 0x7d, 70, 0x93, 0x2c, 0x79, 2, 0xef, 0x88, 0xb5, 0x7e, 0x8b, 0xa4, 0x31, 0xba, 0x67, 0x80, 0xed, 0xb6, 0x83, 0x1c, 0xe9, 0x72, 0xdf, 120, 0x25, 0xee, 0x7b, 0x94, 0xa1, 0x2a, 0x57, 0x70, 0x5d, 0x26, 0x73, 12, 0x59, 0xe2, 0xcf, 0x68, 0x95, 0x5e, 0x6b, 0x84, 0x11, 0x9a, 0x47, 0x60, 0xcd, 150, 0x63, 0xfc, 0xc9, 0x52, 0xbf, 0x58, 5, 0xce, 0x5b, 0x74, 0x81, 10, 0x37, 80, 0x3d, 6, 0x53, 0xec, 0x39, 0xc2, 0xaf, 0x48, 0x75, 0x3e, 0x4b, 100, 0xf1, 0x7a, 0x27, 0x40, 0xad, 0x76, 0x43, 220, 0xa9, 50, 0x9f, 0x38, 0xe5, 0xae, 0x3b, 0x54, 0x61, 0xea, 0x17, 0x30, 0x1d, 230, 0x33, 0xcc, 0x19, 0xa2, 0x8f, 40, 0x55, 30, 0x2b, 0x44, 0xd1, 90, 7, 0x20, 0x8d, 0x56, 0x23, 0xbc, 0x89, 0x12, 0x7f, 0x18, 0xc5, 0x8e, 0x1b, 0x34, 0x41, 0xca, 0xf7, 0x10, 0xfd, 0xc6, 0x13, 0xac, 0xf9, 130, 0x6f, 8, 0x35, 0xfe, 11, 0x24, 0xb1, 0x3a, 0xe7, 0, 0x6d, 0x36, 3, 0x9c, 0x69, 0xf2, 0x5f, 0xf8, 0xa5, 110, 0xfb, 20, 0x21, 170, 0xd7, 240, 0xdd, 0xa6, 0xf3, 140, 0xd9 }; #endregion }
so where is my issue in the codes ??
|
|
|
08/12/2014, 14:44
|
#4
|
elite*gold: 0
Join Date: Apr 2011
Posts: 93
Received Thanks: 20
|
Fw.IP = "127.0.0.1"; make it your hamachi ip or 192.168.1.xx ip client will crash if you try to connect it to 127.0.0.1
|
|
|
08/12/2014, 16:47
|
#5
|
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
|
Quote:
Originally Posted by kakamankoko
Fw.IP = "127.0.0.1"; make it your hamachi ip or 192.168.1.xx ip client will crash if you try to connect it to 127.0.0.1
|
Thanks a lot its fixed now after i changed the ip to default gateway ip ...
|
|
|
|
Similar Threads
|
Client crash after login
08/08/2012 - SRO Private Server - 2 Replies
When i start my Client, login with my id/pw and enter the captcha code client crash ! i dont get any error or smt else ! what could it be ?
|
Client Crash on login screen
09/15/2011 - SRO Private Server - 50 Replies
So guys, I saw that many people are with this error, so I opened the topic
All files are running, Global Manager, Download Server, Gateway, Farm manager, Agent server, Sr_shard, Sr_gameserver.
After that I changed the ip media.pk2 with media patcher. Ip 127.0.0.1 Port: 32002. Start the launcher, the client began. At the login screen as the client closes a normal error (before login)
http://i52.tinypic.com/23j0bki.png
So anyone know how to fix?
|
New Login Packet for Client 5089+
10/31/2010 - CO2 Programming - 6 Replies
Does anybody have the new login packet structure for client 5089+? For example, if I use an older client and send the following login information using the CO client:
username : test
password : test
I receive the following encrypted packet (packet length is 52 bytes):
0x17 0x84 0x04 0x65 0xD7 0x13 0xC4 0xA5
0xDF 0x0F 0x33 0xA5 0x14 0xCB 0x75 0x6F
0x5F 0x89 0xB0 0x22 0xD5 0x64 0x7A 0x36
|
client crash be login
10/03/2010 - SRO Private Server - 1 Replies
hello English (not so good)
i have a problem,
i use db bot wenn i conect (use no dc) after 10 conects crash the client,
please hekp me
hallo Deutsch
ich habe ein problem
ich benutze den db bot wenn ich conecte (benutze no dc) stürzt der client noch so 10 conects ab,
bitte hilft mir
|
ZSZC Client Crash @LogIn
06/25/2010 - SRO Private Server - 3 Replies
Some People write Threats with the Theme:
My ZSZC Crashes @ Login/ Before i see my Char
->By the Message "...Requesting user confirmation...".
I tried:
-Sro-Db Bot v0.8/0.9a/0.9b/0.9c/1.0/1.0Beta
-I tried with normal Client/ and sometimes with Bot.
I have installed 2x times ZSZC in different Folders, when i try the "normal" all work, but when i try with:
-AutoLogin/Process Patcher/+a kind of Bot/something others...
|
All times are GMT +2. The time now is 16:43.
|
|