Valhalla Legends Forums Archive | Battle.net Bot Development | Login problems

AuthorMessageTime
soccerist
I'm trying to make a binary Bnet chat client, but I seem to be having problems logging in.  About a year ago, I made a multi-binary-bot program in Linux (C++) and now I'm trying to build a plain old chat client with a GUI frontend using Qt.  I didn't think it'd be too hard to create a client based on the bot I made before, but I've been experiencing some weirdness. 

First off, I'm using Linux, and I own two computers which to test it on.  The bot is called GiTMbot and the chat client is called GiTMchat.  GiTMbot has been running fine for about a year now.  But in recent testing on the computer that the bot hasn't been running on, it seems to be experiencing some problems logging on.  I keep getting "Invalid CD Key" error on packet 0x51 and then any attempts to connect to the server after that results in failed attempts to write to the socket.  The client experiences the same type of problem (Invalid CD Key and then poops out).  Is it possible that different underlying libraries in different Linux distributions is causing the problem?  (Kubuntu/Debian and Fedora Core 2). 

If any of you have Linux (and Qt/KDE), would you mind trying out my GiTMchat chat client?  The debug output to trace errors to source code lines is pretty good.  Also, feel free anyone, to take a look at my bot (With inter-gateway communications!).

My client can be downloaded here:  (tgz with source and linux binary)
http://www.filebox.vt.edu/users/rluu/stuff/GiTMchat.tgz

Dependencies: (Qt; If you have KDE, you can run it).
Qt

My bot can be downloaded here:  (tgz with source)
http://www.filebox.vt.edu/users/rluu/stuff/GiTMbot-1.16.tgz

Dependencies:  (sqlite, sqlite-dev)
http://www.filebox.vt.edu/users/rluu/stuff/sqlite-2.8.15-1.i386.rpm
http://www.filebox.vt.edu/users/rluu/stuff/sqlite-devel-2.8.15-1.i386.rpm



I don't know how helpful this will be but here's a packet log (in hex) of my login that's been giving me problems.  Thanks ahead of time for any help!  You guys have been really helpful in the past and I appreciate the help.

[pre]SENT:
00000000  01       

SENT:
00000001  ff 50 3a 00 00 00 00 00  36 38 58 49 50 58 45 53 .P:..... 68XIPXES
00000011  cb 00 00 00 00 00 00 00  00 00 00 00 2c 01 00 00 ........ ....,...
00000021  09 04 00 00 09 04 00 00  55 53 41 00 55 6e 69 74 ........ USA.Unit
00000031  65 64 20 53 74 61 74 65  73 00                  ed State s.

RECV:
00000000  ff 25 08 00 92 17 90 2f                          .%...../

SENT:
0000003B  ff 25 08 00 92 17 90 2f                          .%...../

RECV:
00000008  ff 50 62 00 00 00 00 00  fb b6 bd 2e ae c0 0a 00 .Pb..... ........
00000018  00 ac 41 43 25 0b c5 01  49 58 38 36 76 65 72 30 ..AC%... IX86ver0
00000028  2e 6d 70 71 00 41 3d 35  31 39 38 37 39 30 39 33 .mpq.A=5 19879093
00000038  20 42 3d 31 31 34 33 30  35 32 34 38 20 43 3d 31  B=11430 5248 C=1
00000048  34 34 30 39 37 35 31 20  34 20 41 3d 41 5e 53 20 4409751  4 A=A^S
00000058  42 3d 42 5e 43 20 43 3d  43 5e 41 20 41 3d 41 5e B=B^C C= C^A A=A^
00000068  42 00                                            B.

SENT:
00000043  ff 51 72 00 2e 97 a8 40  01 00 00 00 b5 85 35 29 .Qr....@ ......5)
00000053  01 00 00 00 00 00 00 00  0d 00 00 00 01 00 00 00 ........ ........
00000063  25 29 08 00 00 00 00 00  41 c7 86 94 46 29 3d f0 %)...... A...F)=.
00000073  08 63 46 df d2 53 78 bd  cf 76 02 0a 73 74 61 72 .cF..Sx. .v..star
00000083  63 72 61 66 74 2e 65 78  65 20 30 33 2f 32 31 2f craft.ex e 03/21/
00000093  30 35 20 31 34 3a 30 36  3a 35 31 20 31 30 39 33 05 14:06 :51 1093
000000A3  36 33 32 00 47 69 54 4d  63 68 61 74 20 75 73 65 632.GiTM chat use
000000B3  72 00                                            r.

RECV:
0000006A  ff 51 09 00 00 02 00 00  00                      .Q...... .[/pre]

[Kp edit: switched post from code tag to pre tag, makes the output dump much more readable.  Didn't we try setting code to imply pre quite a while ago, though?]
April 2, 2005, 8:54 AM
Maddox
Looks like you either entered an invalid cd-key or something is wrong with your cdkey decoding/hashing algorithm.

I made a Qt bot a while ago, but I didn't really like the look of KDE. I also wrote a library for connecting to battle.net that runs under windows and linux. It supports both login types (legacy and warcraft 3). If you're interested in using it, contact me.
April 4, 2005, 3:13 AM
soccerist
[quote author=Maddox link=topic=11155.msg107252#msg107252 date=1112584416]
Looks like you either entered an invalid cd-key or something is wrong with your cdkey decoding/hashing algorithm.
[/quote]
I think so too.  I can't seem to really pin down where though.  Even my old code isn't working anymore...  I developed it on Fedora Core 2.  Perhaps I'll try to reinstall FC2 and analyze it further. 

[quote author=Maddox link=topic=11155.msg107252#msg107252 date=1112584416]
I made a Qt bot a while ago, but I didn't really like the look of KDE.
[/quote]
You know you can set themes and pretty much tweak anything in KDE?  You can make it look exactly like windows if you'd like.  Just thought I'd let you know.  And also, Qt is cross platform... so if you write it in Linux, you can compile it to run on Windows to look exactly the same.

[quote author=Maddox link=topic=11155.msg107252#msg107252 date=1112584416]
I also wrote a library for connecting to battle.net that runs under windows and linux. It supports both login types (legacy and warcraft 3). If you're interested in using it, contact me.
[/quote]
I'd like to check it out, thanks.

If anyone else has any insight on this, don't be shy!
April 4, 2005, 11:48 PM
shout
[quote author=soccerist link=topic=11155.msg106927#msg106927 date=1112432069]
RECV:
0000006A  ff 51 09 00 00 02 00 00 00                      .Q...... .
[/quote]

0x200 is invalid cdkey, according to BnetDocs. Im guessing you should download BnetAuth.dll/BnetUTIL.dll and compare code.

Btw, where did the extra byte come from?
April 5, 2005, 12:16 AM
EpicOfTimeWasted
I glanced at the cdkey code, and it looked backwards.  The first loop should actually be the second, and the second the first.

[quote author=Shout link=topic=11155.msg107361#msg107361 date=1112660205]
Btw, where did the extra byte come from?
[/quote]

That extra byte is a null-terminated extra-info error message (such as the name of the person already using a cdkey).  Since there's no need for extra info for an invalid cdkey, the error message is JUST the null termination.
April 5, 2005, 12:28 AM
shout
Silly me!
April 5, 2005, 12:31 AM
Maddox
[quote author=soccerist link=topic=11155.msg107355#msg107355 date=1112658494]
You know you can set themes and pretty much tweak anything in KDE?  You can make it look exactly like windows if you'd like.  Just thought I'd let you know.  And also, Qt is cross platform... so if you write it in Linux, you can compile it to run on Windows to look exactly the same.
[/quote]

I haven't found a way to change KDE themes under fluxbox without installing kde itself.
April 5, 2005, 1:41 AM
Maddox
One thing I noticed, you shouldn't really use poll for checking the status of your socket. select() is more preferred.
April 5, 2005, 1:47 AM
soccerist
[quote author=Maddox link=topic=11155.msg107376#msg107376 date=1112665299]
I haven't found a way to change KDE themes under fluxbox without installing kde itself.
[/quote]
If you like fluxbox, by all means, keep using it.  :)  I believe most people have the Qt and GTK libraries even if they don't run KDE or Gnome.


[quote author=Maddox link=topic=11155.msg107378#msg107378 date=1112665636]
One thing I noticed, you shouldn't really use poll for checking the status of your socket. select() is more preferred.
[/quote]
Yeah.  You're right.  Poll is older... but quick question, can you check what events caused the function to return on the file descriptor with select() ?  Or can you only see that certain file descriptors are ready to read or ready to write?

It might be wiser to use select() as you said.  It's quite possible that poll is acting weird on my computer.

April 5, 2005, 5:50 PM
Maddox
Generally, you only use the exceptfd and writefd parameters for non-blocking sockets, but you would call FD_ISSET on each one to see what is needed to be done. Select provides basically the same functionality as  poll, but can be used to check the status of multiple sockets or fds, very useful for bot developers who often need to connect to multiple servers.
April 6, 2005, 2:36 AM
Adron
[quote author=soccerist link=topic=11155.msg107468#msg107468 date=1112723459]
Yeah.  You're right.  Poll is older...
[/quote]

Hmm, poll is older?

[quote]
      The poll() systemcall was introduced in Linux 2.1.23.  The
      poll()  library  call  was  introduced in libc 5.4.28 (and
      provides emulation using select if your  kernel  does  not
      have a poll syscall).
[/quote]

It sounds to me like poll is newer and select older?
April 6, 2005, 4:48 AM
Myndfyr
[quote author=Adron link=topic=11155.msg107577#msg107577 date=1112762921]
[quote author=soccerist link=topic=11155.msg107468#msg107468 date=1112723459]
Yeah.  You're right.  Poll is older...
[/quote]

Hmm, poll is older?

[quote]
       The poll() systemcall was introduced in Linux 2.1.23.  The
       poll()  library  call  was  introduced in libc 5.4.28 (and
       provides emulation using select if your  kernel  does  not
       have a poll syscall).
[/quote]

It sounds to me like poll is newer and select older?
[/quote]

The function in Linux appears newer; but, [hypothesis]wasn't polling devices to test for state common before the more advanced interrupt controllers and operating systems provided a more elegant way to handle device state callbacks?  Perhaps that's what he meant?[/hypothesis]

I'm not sure if I'm right about that.  When I took my x86 assembly class, we did a LOT of polling before we started fussing with the interrupt controller, and we didn't touch direct memory access except in perhaps the last 3 weeks of the course.
April 6, 2005, 7:14 AM
soccerist
:-[  Ah...I made an bad assumption.  I kinda guessed that because something was more preferred and has a more flexible API that it would be newer (even though this seems to be true in computers).  Sorry.

Anyways, I decided to look up on it. 

In Linux, poll was added after select as Adron mentioned. 

In terms of their histories, the system commands poll and select date back to the UNIX days.  UNIX System V (SYSV) implemented poll() and BSD implemented select(). 

From the wikipedia page for BSD ( http://en.wikipedia.org/wiki/BSD  ): 
[quote]
BSD pioneered many of the advances of modern computing. Berkeley's Unix was the first to include library support for the Internet Protocol stacks, Berkeley sockets. By integrating sockets with the UNIX operating system file descriptors, users of their library found it almost as easy to read and write data across the network, as it was to put data on a disk. The AT&T laboratory eventually released their own STREAMS library, which incorporated much of the same functionality in a software stack with better architectural layers, but the already widely-distributed sockets library, together with the unfortunate omission of a function call for polling a set of open sockets (an equivalent of the select call in the Berkeley library), made it difficult to justify porting applications to the new API.
[/quote]

So yes, select was also created first in UNIX. 

In Linux, I'm not sure if using one is worse than using the other.  In the network apps class I took about a year ago, the professor covered select() pretty throughly, and barely touched poll.  I only used it in my code because I picked it up from someone (from work) way back when I was first learning to use sockets.  Also, polling works on both file and socket descriptors, so it seemed like the more advantageous way to go at the time.  Can you 'select()' on file descriptors too?  I've never seen it done.

April 11, 2005, 3:36 AM
soccerist
By the way, I got it working.  I had a tiny typo in the Check Revision code...  That was the reason why it seemed to work for one key but not another. 

I wouldn't have noticed it if it weren't for Maddox.  Thx all.
April 12, 2005, 1:07 AM
Zakath
To answer your question, yes, select() can be (and often is) used on file descriptors, not just sockets.
April 12, 2005, 3:59 AM

Search