AuthStart Problem

10/24/2010 08:06 FuriousFang#1
Hey everyone...
I have a question.

I'm helping a friend with a server and he's getting:
Code:
®Pø¡|(×ä
'ûôÂc
as the account name when I type in "Fang".

The offsets are correct. What could be the cause of this?

Thanks in advance,
Fang
10/24/2010 13:11 _DreadNought_#2
Are you do this(From the top of my head)
Code:
Username.Split("/0");
or are you trying to decrypt the username when its not needed?

#edit
Code:
                        [B]Username = Encoding.ASCII.GetString(BR.ReadBytes(16));
                        Username = Username.Replace("\0", "");[/B]
                        BR.ReadBytes(112);
                        Password = Encoding.ASCII.GetString(BR.ReadBytes(16));
                        BR.ReadBytes(112);
                        Server = Encoding.ASCII.GetString(BR.ReadBytes(16));
                        Server = Server.Replace("\0", "");
10/24/2010 19:49 FuriousFang#3
It's not as new as those codes. It's Conquer 1.0 Alpha.
The codes are:

Code:
//Determine Username
            int x = 0x04;
            while (x < 0x14 && Data[x] != 0x00)
            {
                AccountName += Convert.ToChar(Data[x]);
                x++;
            }
Code:
//Determine Password
            x = 0x14;
            int y = 0;
            byte[] Pass = new byte[16];
            while (x < 0x24)
            {
                Pass[y] = Data[x];
                Password += (Convert.ToString(Data[x], 16)).PadLeft(2, '0');
                x++;
                y++;
            }
Code:
//Determine Server - For future implementation eg. multiple servers
            x = 0x24;
            while (x < 0x34 && Data[x] != 0x00)
            {
                Server += Convert.ToChar(Data[x]);
                x++;
            }
            ServerIP = Database.LookupServer(Server);
All of which contain the right offsets. I did a watch test to confirm that. They just show up as weird characters (except for the password).
10/24/2010 20:11 _DreadNought_#4
Ah sorry, erm, Better of asking someone like Ali(HA!) who has experiance with 1.0 (CPX)
10/24/2010 21:17 _tao4229_#5
Code:
struct ClientLoginPacket {
	ushort size;
	ushort type;
	char[16] account;
	char[16] password;
	char[16] server;
}
Code:
case 0x41b:
			ClientLoginPacket* login = cast(ClientLoginPacket*)pBuffer;
			writeln("login: " ~ login.account);
			break;
Your encryption's probably bad; the same principle works fine for me.
10/25/2010 01:15 Korvacs#6
See if you get different results from this:

Code:
            accountName = Encoding.ASCII.GetString(Data.Buffer, 4, 16).TrimEnd('\0');
            password = Encoding.ASCII.GetString(Data.Buffer, 20, 16).TrimEnd('\0');
            serverName = Encoding.ASCII.GetString(Data.Buffer, 36, 16).TrimEnd('\0');
Its unlikely, its just for confirmation really. Does the rest of the packet decrypt correctly (Type, Length)? Does the password decrypt correctly to plain text (This should be unlikely given the info you've given so far)?

Sounds like a crypto problem to me aswell.
10/25/2010 03:45 FuriousFang#7
Quote:
Originally Posted by Korvacs View Post
See if you get different results from this:

Code:
            accountName = Encoding.ASCII.GetString(Data.Buffer, 4, 16).TrimEnd('\0');
            password = Encoding.ASCII.GetString(Data.Buffer, 20, 16).TrimEnd('\0');
            serverName = Encoding.ASCII.GetString(Data.Buffer, 36, 16).TrimEnd('\0');
Its unlikely, its just for confirmation really. Does the rest of the packet decrypt correctly (Type, Length)? Does the password decrypt correctly to plain text (This should be unlikely given the info you've given so far)?

Sounds like a crypto problem to me aswell.
Ok, so I'm working with packet 11147 (1051 in patch 4267).
When I use the code you provided Korvacs, it unfortunately gives me this:
Code:
Acc: ?P??|(??
'????c
Server: ??????(?U??(?8
IP: Invalid
The length and offsets are set correctly. The password (now that I compare it) is not the same as what it should be. It's all messed up using weird characters.

The problem could be with the authpacket handler:
Code:
ushort Type = *(ushort*)(Ptr + 2);
ushort Length = *(ushort*)(Ptr + 0);
I doubt that the above is right. I'm experimenting with values to see if it is or not.

EDIT: Trying to get them from different offsets:
Code:
type  offset
5892 0
35607 1
11147 2
44587 3
20654 4
63568 5
41464 6
31905 7
10364 8
55080 9
58583 10
2788 11
9994 12
64295 13
33275 14
62593 15
49908 16
25538 17
7779 18
19230 19
59979 20
31978 21
53116 22
30927 23
34680 24
26503 25
43111 26
60328 27
45291 28
44208 29
26796 30
23144 31
2906 32
8715 33
45602 34
48306 35
51900 36
3786 37
16142 38
35903 39
45452 40
16305 41
3647 42
10254 43
36136 44
21901 45
43861 46
37547 47
10386 48
50472 49
14533 50
56 51
0 52
0 53
10/25/2010 04:58 _tao4229_#8
The packet type should still be 0x41b(1051) in CO1. They didn't change.
10/25/2010 08:04 FuriousFang#9
Quote:
Originally Posted by _tao4229_ View Post
The packet type should still be 0x41b(1051) in CO1. They didn't change.
Hm... I wonder what's happening then.
I tried using other means of using the data to find the type.
Anyone wanta pm me and give it a try themselves?
(I'm really interested to see what Conquer Online looked like then!)
10/25/2010 10:10 tanelipe#10
Do you mind posting your cryptography which is used during authentication? The packet looks like it hasn't been decrypted at all/properly, like Saint and Korvacs pointed out.
10/25/2010 11:51 Korvacs#11
Its definately a crypto problem, take a look at that.