• Welcome to Valhalla Legends Archive.
 

SEXP login failing with BNLS?

Started by Joe[x86], February 09, 2007, 12:08 AM

Previous topic - Next topic

Joe[x86]

I've tried with both 0x09 and 0x1A, on both USEast and USWest, each time failing. Here's a packet-log from a USEast attempt with 0x09. [Note that the packet data starts at 0x36]

Client to BNET
0000   00 14 6c a6 ed b8 00 0d 56 64 36 9f 08 00 45 00  ..l.....Vd6...E.
0010   00 29 02 f2 40 00 80 06 2b c0 c0 a8 01 02 3f f0  .)..@...+.....?.
0020   ca 82 0e 48 17 e0 b5 f6 a5 2e 22 29 4c 60 50 18  ...H......")L`P.
0030   45 10 ad c7 00 00 01                             E......

Client to BNLS
0000   00 14 6c a6 ed b8 00 0d 56 64 36 9f 08 00 45 00  ..l.....Vd6...E.
0010   00 2f 02 f6 40 00 80 06 3e ba c0 a8 01 02 3f a1  ./..@...>.....?.
0020   b7 cd 0e 49 24 97 24 7b 40 08 4c e2 45 23 50 18  ...I$.${@.L.E#P.
0030   45 10 71 31 00 00 07 00 10 02 00 00 00           E.q1.........

BNLS to Client
0000   00 0d 56 64 36 9f 00 14 6c a6 ed b8 08 00 45 00  ..Vd6...l.....E.
0010   00 33 e4 66 40 00 6f 06 6e 45 3f a1 b7 cd c0 a8  [email protected]?.....
0020   01 02 24 97 0e 49 4c e2 45 23 24 7b 40 0f 50 18  ..$..IL.E#${@.P.
0030   ff f8 b1 6e 00 00 0b 00 10 02 00 00 00 cf 00 00  ...n............
0040   00                                               .

Client to BNET
0000   00 14 6c a6 ed b8 00 0d 56 64 36 9f 08 00 45 00  ..l.....Vd6...E.
0010   00 5b 02 f7 40 00 80 06 2b 89 c0 a8 01 02 3f f0  .[..@...+.....?.
0020   ca 82 0e 48 17 e0 b5 f6 a5 2f 22 29 4c 60 50 18  ...H...../")L`P.
0030   45 10 c1 af 00 00 ff 50 33 00 00 00 00 00 36 38  E......P3.....68
0040   58 49 50 58 45 53 cf 00 00 00 00 00 00 00 00 00  XIPXES..........
0050   00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 41  ..............CA
0060   4e 00 63 61 6e 61 64 61 00                       N.canada.

BNET to Client
0000   00 0d 56 64 36 9f 00 14 6c a6 ed b8 08 00 45 00  ..Vd6...l.....E.
0010   00 30 e4 6b 00 00 73 06 97 3f 3f f0 ca 82 c0 a8  .0.k..s..??.....
0020   01 02 17 e0 0e 48 22 29 4c 60 b5 f6 a5 62 50 18  .....H")L`...bP.
0030   ff cb 20 a0 00 00 ff 25 08 00 e0 bd eb 4c        .. ....%.....L

Client to BNET
0000   00 14 6c a6 ed b8 00 0d 56 64 36 9f 08 00 45 00  ..l.....Vd6...E.
0010   00 30 02 fa 40 00 80 06 2b b1 c0 a8 01 02 3f f0  .0..@...+.....?.
0020   ca 82 0e 48 17 e0 b5 f6 a5 62 22 29 4c 68 50 18  ...H.....b")LhP.
0030   45 08 db 5b 00 00 ff 25 08 00 e0 bd eb 4c        E..[...%.....L

BNET to Client
0000   00 0d 56 64 36 9f 00 14 6c a6 ed b8 08 00 45 00  ..Vd6...l.....E.
0010   00 66 e4 6c 00 00 73 06 97 08 3f f0 ca 82 c0 a8  .f.l..s...?.....
0020   01 02 17 e0 0e 48 22 29 4c 68 b5 f6 a5 62 50 18  .....H")Lh...bP.
0030   ff cb 80 8d 00 00 ff 50 3e 00 00 00 00 00 9b 21  .......P>......!
0040   7c 94 ef 63 21 00 00 6e bc de 72 fc c6 01 6c 6f  |..c!..n..r...lo
0050   63 6b 64 6f 77 6e 2d 49 58 38 36 2d 31 35 2e 6d  ckdown-IX86-15.m
0060   70 71 00 3d 24 c7 41 b7 21 70 e8 63 84 b0 9e 61  pq.=$.A.!p.c...a
0070   5d 31 ef 00                                      ]1..

Client to BNLS
0000   00 14 6c a6 ed b8 00 0d 56 64 36 9f 08 00 45 00  ..l.....Vd6...E.
0010   00 44 03 03 40 00 80 06 3e 98 c0 a8 01 02 3f a1  .D..@...>.....?.
0020   b7 cd 0e 4a 24 97 d9 b5 41 ba d8 62 cd 33 50 18  ...J$...A..b.3P.
0030   45 10 b7 2d 00 00 1c 00 09 02 00 00 00 0f 00 00  E..-............
0040   00 3d 24 3f 41 3f 21 70 3f 63 3f 3f 3f 61 5d 31  .=$?A?!p?c???a]1
0050   3f 00                                            ?.

BNLS to Client
0000   00 0d 56 64 36 9f 00 14 6c a6 ed b8 08 00 45 00  ..Vd6...l.....E.
0010   00 48 e4 7b 40 00 6f 06 6e 1b 3f a1 b7 cd c0 a8  .H.{@.o.n.?.....
0020   01 02 24 97 0e 4a d8 62 cd 33 d9 b5 41 d6 50 18  ..$..J.b.3..A.P.
0030   ff e3 f2 fa 00 00 20 00 09 01 00 00 00 01 00 0e  ...... .........
0040   01 bc d5 d0 40 04 39 44 01 ef 4f 7c 98 c4 2b 6c  [email protected]|..+l
0050   81 09 c3 25 3c 00                                ...%<.

Client to BNET
0000   00 14 6c a6 ed b8 00 0d 56 64 36 9f 08 00 45 00  ..l.....Vd6...E.
0010   00 84 03 04 40 00 80 06 2b 53 c0 a8 01 02 3f f0  ....@...+S....?.
0020   ca 82 0e 48 17 e0 b5 f6 a5 6a 22 29 4c a6 50 18  ...H.....j")L.P.
0030   44 ca 4d 25 00 00 ff 51 5c 00 d9 4f 2f 27 01 00  D.M%...Q\..O/'..
0040   0e 01 bc d5 d0 40 01 00 00 00 00 00 00 00 0d 00  .....@..........
0050   00 00 02 00 00 00 25 51 4d 00 00 00 00 00 83 13  ......%QM.......
0060   5b fd 59 24 4a a2 c0 20 e9 36 d0 05 8d ff 7d 0b  [.Y$J.. .6....}.
0070   19 6d 04 39 44 01 ef 4f 7c dc c4 2b 6c fd 09 c3  .m.9D..O|..+l...
0080   25 3c 00 77 77 77 2e 4a 61 76 61 4f 70 2e 63 6f  %<.www.JavaOp.co
0090   6d 00                                            m.

BNET to Client
0000   00 0d 56 64 36 9f 00 14 6c a6 ed b8 08 00 45 00  ..Vd6...l.....E.
0010   00 31 e4 7f 00 00 73 06 97 2a 3f f0 ca 82 c0 a8  .1....s..*?.....
0020   01 02 17 e0 0e 48 22 29 4c a6 b5 f6 a5 c6 50 18  .....H")L.....P.
0030   ff 67 ea 36 00 00 ff 51 09 00 01 01 00 00 00     .g.6...Q.......


I am completely confused as to what is going wrong. If you'd like a packet log of me using 0x1A, I'll get you one on request.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Barabajagal

I'm a bit confused... the server sends you a request of 3d 24 c7 41 b7 21 70 e8 63 84 b0 9e 61 5d 31 ef, right? When you send it to BNLS, you send something similar... 3d 24 3f 41 3f 21 70 3f 63 3f 3f 3f 61 5d 31 3f... Unless I'm reading the packets wrong, you did something wrong there...

Joe[x86]

You're completely right. But how the fuck did I do that, though?...
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

UserLoser

Quote from: Joex86] link=topic=16285.msg164377#msg164377 date=1171003620]
You're completely right. But how the fuck did I do that, though?...

You're Joe, so...I suppose it's not hard for anything that requires basic logic to go wrong ;)

Barabajagal

Quote from: UserLoser on February 09, 2007, 12:54 AM
Quote from: Joex86] link=topic=16285.msg164377#msg164377 date=1171003620]
You're completely right. But how the fuck did I do that, though?...

You're Joe, so...I suppose it's not hard for anything that requires basic logic to go wrong ;)

Ouch... My guess is you retrieved the value incorrectly somehow... remember it's one long null terminated string usually from 15 to 17 characters long.

Hdx

He's useing Ron's Buffer class. (He is working on adding BNLS to JavaOp)
It looks fine, all he is doing basically:
while(i != 0){
i = removeByte();
retBuff.addByte(i);
}

Which should work...
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Barabajagal


Joe[x86]

Quote from: [RealityRipple] on February 09, 2007, 01:02 AM
...UTF-8 problem maybe?

That's what I'm guessing. I'm thinking that what's really a byte is overflowing in the byte type, or something. Kinda like how 0xFF won't work, you need to use -1 or something.

In one login, I printed the formula four times. Ethereal packet log of the BNCS incoming, the data after being parsed, the data before being sent to BNLS (in the BNLS code), and the data as it's being sent to BNLS, again by Ethereal. The first three were the correct value and the last wasn't, so I'm guessing it's in my BNLS buffer code somewhere.

pkt.addBytes(formula); // (STRING) Formula
// The formula is corrupted somewhere between these two lines.
out.write(pkt.getChars());
out.flush();
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

ShadowDancer

Quote
I'm a bit confused... the server sends you a request of 3d 24 c7 41 b7 21 70 e8 63 84 b0 9e 61 5d 31 ef, right? When you send it to BNLS, you send something similar... 3d 24 3f 41 3f 21 70 3f 63 3f 3f 3f 61 5d 31 3f... Unless I'm reading the packets wrong, you did something wrong there...

lol ^^ it is beging parsed as string so unsoported characters bcome 3f ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^
Quote from: MyndFyre-vL
No. We help people who help themselves.
http://sourceforge.net/projects/d2gs
http://assembla.com/space/d2gs

Barabajagal

Since the values that went bad are c7, b7, e8, 84, b0, 9e, and ef, which are all above 80 (the halfway point), I'd say you either have a Signed byte somewhere, and since they're all being changed to 3f (63), which is 1/4 a byte, I'd say you're definitely having a read problem... See what type of values it's being stored as.

ShadowDancer

Quote from: MyndFyre-vL
No. We help people who help themselves.
http://sourceforge.net/projects/d2gs
http://assembla.com/space/d2gs

Joe[x86]

#11
Quote from: [RealityRipple] on February 09, 2007, 01:40 AM
Since the values that went bad are c7, b7, e8, 84, b0, 9e, and ef, which are all above 80 (the halfway point), I'd say you either have a Signed byte somewhere, and since they're all being changed to 3f (63), which is 1/4 a byte, I'd say you're definitely having a read problem... See what type of values it's being stored as.

The problem is that I was naive enough to cast it all to a char array so I could use it with a BufferedWriter. This just goes to show that it never pays to try reusing code, if it was written for a text-based protocol (RCRS) and you're implementing a binary-based protocol (BNLS).

Ethereal confirms that it's now being sent to BNLS correctly, but I'm still failing. The obvious assumption is that I'm also doing the same thing on the other send (Server 0x09, Client 0x51), so hang on while I check that out.

EDIT -
Check this out:
28 00 1a
01 00 00 00
01 00 0e 01
9e 17 c6 36
fa f5 88 3e ee 4a 0a b6 f9 66 b3 76 98 47 c4 b8 00
00 00 00 00
cf 00 00 00

ff 51 5c 00
a0 f4 b3 54
01 00 0e 01
7e 17 c6 36
01 00 00 00
00 00 00 00
0d 00 00 00
02 00 00 00
25 51 4d 00
00 00 00 00
98 f3 dc 3a
2e 9a 81 72
05 f0 d7 85
ce c1 f3 aa
0f 8d 00 75
fa f5 c6 3e ee 4a 0a b6 f9 66 b3 76 dc 47 c4 b8 00
77 77 77 2e 4a 61 76 61 4f 70 2e 63 6f 6d 00


That BNLS S>C 0x1A (I switched back) and BNET C>S 0x51, each chunked out into each part. The fourth row in both is the EXE Checksum. Notice a difference? How the hell did that happen? :-\

EDIT -
I've confirmed that it's the checksum that keeps changing. Here's another log:
28 00 1a
01 00 00 00
01 00 0e 01
12 9b 21 20
10 fc 30 08 c2 52 0b d9 91 ea c7 85 85 fd dd 10 00
00 00 00 00
cf 00 00 00

ff 51 5c 00
09 46 a3 6f
01 00 0e 01
12 3a 21 20
01 00 00 00
00 00 00 00
0d 00 00 00
02 00 00 00
25 51 4d 00
00 00 00 00
7c c1 05 c7
57 3a 27 10
58 1b 00 07
0a 94 41 72
06 a4 18 32
10 fc 30 08 c2 52 0b d9 18 ea c7 26 26 fd dd 10 00
77 77 77 2e 4a 61 76 61 4f 70 2e 63 6f 6d 00
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Joe[x86]

Quote from: UserLoser on February 09, 2007, 12:54 AM
Quote from: Joex86] link=topic=16285.msg164377#msg164377 date=1171003620]
You're completely right. But how the fuck did I do that, though?...

You're Joe, so...I suppose it's not hard for anything that requires basic logic to go wrong ;)

It's not hard for me to mess up something that doesn't require basic logic, either. :P

Anyhow, I finally got it all fixed. Thanks guys!
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.