Upgrading version

10/15/2013 17:15 ryuchetval#1
Hello everybody.

I am trying to upgrade a 5165 version (from the sticky thread started by Arco I believe) to 5730 or something close to it.

I am not a guru in programming and it took me a while just to get past the server accepting my socket connection from the client.

The point I am at is this:

The server accepts the connection.
The server sends the PasswordSeed (type 1059)
The client sends back the authentication user and password.

Here is the part where I should send the "go forward / wrong info packet"

From what I've seen the packet should consist of header 1055 , the type (2 - ready, 0-banned, 1-invalid info), a random int indentifier, server ip and game port.

The client sends back a packet 1100 of size 80 (?? I have no idea what this should mean, nor found any useful information that could brighten my eyes ??)

This is where my client crashes, it does not matter if I input random account/password or fill in with correct information.

I dunno if I gave enough information for anyone to pinpoint what I'm doing wrong but if anyone has any ideas please let me know. I ran out of ideas and now I really don't know what to do.

I appreciate any answers :)

Best regards,

Vali.
10/16/2013 21:24 -impulse-#2
Quote:
Originally Posted by ryuchetval View Post
...
On the latest patches TQ added more banned IPs for localhost. If you try to send an IP from 192.168.0.1/24 or 127.0.0.1 the client will crash. You can either force an IP on a random network adapter or use Hamachi.
10/17/2013 14:40 .Beatz#3
Quote:
Originally Posted by -impulse- View Post
On the latest patches TQ added more banned IPs for localhost. If you try to send an IP from 192.168.0.1/24 or 127.0.0.1 the client will crash. You can either force an IP on a random network adapter or use Hamachi.
Really? I have not had this problem and I use 192.168.0.4 for my servers and clients when testing right from 42xx > 57xx
10/17/2013 21:42 ryuchetval#4
I believe that the authorization packet is wrong as I tried using hamachi and it's the same problem.

I am using the old "wrong auth" packet when wrong acc/info is input and it tells me that the acc/user is wrong. But when I go for the right user/pass input it crashes the client.

Now I'm wondering if my packet is correct the way it is written.

I tried with a packet found on a 5700 source but it didn't work (the one mentioned in the first post) and then I tried with this packet by here:
[Only registered and activated users can see links. Click Here To Register...]

Code:
byte[] Packet = new byte[54];//32
            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)Packet.Length);
            P.WriteInt16(0x41f);
            P.WriteInt32((uint)Program.Rnd.Next(int.MaxValue));//acc unique id (don't have a list so I just generate one)
           
            P.WriteInt32(Type); //2 - ready 0 - banned 1- invalid info (login token ? )
            P.WriteInt16(5816); // port
            P.WriteInt32((uint)Program.Rnd.Next(int.MaxValue));//hash (dunno what for)
            P.WriteString(ip);
            P.Move(16 - ip.Length);
Is the packet wrong or I'm sending something wrong inside the packet?
10/17/2013 23:57 U2_Caparzo#5
Quote:
Originally Posted by ryuchetval View Post
I believe that the authorization packet is wrong as I tried using hamachi and it's the same problem.

I am using the old "wrong auth" packet when wrong acc/info is input and it tells me that the acc/user is wrong. But when I go for the right user/pass input it crashes the client.

Now I'm wondering if my packet is correct the way it is written.

I tried with a packet found on a 5700 source but it didn't work (the one mentioned in the first post) and then I tried with this packet by here:
[Only registered and activated users can see links. Click Here To Register...]

Code:

Is the packet wrong or I'm sending something wrong inside the packet?
Try writing the port as an Int32, so the IP will be in the offset 20, or just use Move, this is structure that i'm using, patch 5740, the length aren't the same, but maybe because we are working on different patchs.

Code:
            Stream = new Packet(58);
            Stream.Write<ushort>(58);//0
            Stream.Write<ushort>(1055);//2
            Stream.Write<uint>(UId);//4
            Stream.Write<uint>((uint)ResponseType);//8
            Stream.Write<ushort>(GamePort);//12
            //i don't write the hash, like u i don't know what is the use of it
            Stream.Seek(20, Origin.Begin);
            Stream.Write<string>(GameServerIP);//20
10/19/2013 13:39 ryuchetval#6
Seems like it adcanced a little by skypping the hash and puttin the IP at postion 20.

Now It stops at logging in game server after it receives the announce new connection from the server and it receives the packet from the DH KEY exchange. It is really strange as it gives no error and the client just hands in there for about 20 secconds before it says failed to connect.

The server postion adcances to the game announ e receiver and it stops after reading the lenght of the junk leght and few more bytes before setting the new client's game crypto . After setting it nothing happens therefore I am stuck at a new problem but I'm glad that I adcanced a little bit from crashing to actually getting into the echange of DH packet. Now I have to figure out what's wrong with the client crypto.
10/19/2013 18:18 U2_Caparzo#7
Quote:
Originally Posted by ryuchetval View Post
Seems like it adcanced a little by skypping the hash and puttin the IP at postion 20.

Now It stops at logging in game server after it receives the announce new connection from the server and it receives the packet from the DH KEY exchange. It is really strange as it gives no error and the client just hands in there for about 20 secconds before it says failed to connect.

The server postion adcances to the game announ e receiver and it stops after reading the lenght of the junk leght and few more bytes before setting the new client's game crypto . After setting it nothing happens therefore I am stuck at a new problem but I'm glad that I adcanced a little bit from crashing to actually getting into the echange of DH packet. Now I have to figure out what's wrong with the client crypto.

not completly sure but i remember seeing changes changes in the position of some values in that packet, and u have to change the GameCryptography, download any trinity source out there to take the Crypto., i'm not sure if CptSky implemented it in his CO2_CORE_DLL..
10/25/2013 14:51 ryuchetval#8
Well I managed to get past the DH key exchange and setting the client's game crypto but now the first packet that is sent by the client is not 1052 (login) as it should be and instead it is any random number 10k-60k and it differs every single time.

Could it be from the game crypto that it does not encrypt/decrypt accordingly and that could be the problem why it doesn't get the 1052 packet the first time after the DH key exchange?
10/25/2013 23:15 U2_Caparzo#9
Quote:
Originally Posted by ryuchetval View Post
Well I managed to get past the DH key exchange and setting the client's game crypto but now the first packet that is sent by the client is not 1052 (login) as it should be and instead it is any random number 10k-60k and it differs every single time.

Could it be from the game crypto that it does not encrypt/decrypt accordingly and that could be the problem why it doesn't get the 1052 packet the first time after the DH key exchange?
Looks pretty much like a crypto. problem, look for it in {Angelius}'s threads, he coded a library to use instead the Libeay32.dll and the instructions to use it
10/27/2013 20:05 ryuchetval#10
Well thanks for your help. I finally managed to log-in. Now I'm having trouble seeing the character, npcs, anything I input (chat) and so forth but this is probably normal since most packets differ from 5165 to 5730 and I'll have to re-make all packets so they can fit in the new version. At least I was able to log-in which is something good. :)