• Welcome to Valhalla Legends Archive.
 

Login problems

Started by soccerist, April 02, 2005, 02:54 AM

Previous topic - Next topic

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.

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...... .


[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?]

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.
asdf.

soccerist

#2
Quote from: Maddox on April 03, 2005, 10:13 PM
Looks like you either entered an invalid cd-key or something is wrong with your cdkey decoding/hashing algorithm.
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 from: Maddox on April 03, 2005, 10:13 PM
I made a Qt bot a while ago, but I didn't really like the look of KDE.
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 from: Maddox on April 03, 2005, 10:13 PM
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.
I'd like to check it out, thanks.

If anyone else has any insight on this, don't be shy!

shout

Quote from: soccerist on April 02, 2005, 02:54 AM
RECV:
0000006A  ff 51 09 00 00 02 00 00 00                      .Q...... .

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?

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 from: Shout on April 04, 2005, 07:16 PM
Btw, where did the extra byte come from?

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.

shout


Maddox

Quote from: soccerist on April 04, 2005, 06:48 PM
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.

I haven't found a way to change KDE themes under fluxbox without installing kde itself.
asdf.

Maddox

One thing I noticed, you shouldn't really use poll for checking the status of your socket. select() is more preferred.
asdf.

soccerist

Quote from: Maddox on April 04, 2005, 08:41 PM
I haven't found a way to change KDE themes under fluxbox without installing kde itself.
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 from: Maddox on April 04, 2005, 08:47 PM
One thing I noticed, you shouldn't really use poll for checking the status of your socket. select() is more preferred.
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.


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.
asdf.

Adron

Quote from: soccerist on April 05, 2005, 12:50 PM
Yeah.  You're right.  Poll is older...

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).

It sounds to me like poll is newer and select older?

MyndFyre

Quote from: Adron on April 05, 2005, 11:48 PM
Quote from: soccerist on April 05, 2005, 12:50 PM
Yeah.  You're right.  Poll is older...

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).

It sounds to me like poll is newer and select older?

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.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

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.

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.


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.

Zakath

To answer your question, yes, select() can be (and often is) used on file descriptors, not just sockets.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.