Valhalla Legends Forums Archive | Battle.net Bot Development | An odd problem...

AuthorMessageTime
Eternal
Hello everyone,

I'm scratching my head over an issue which involves a bot (programmed in VB6), that connects fine on one PC, but not another. The two PC's are:

1. My 'home PC' - running XP, SP2
2. A new installation of XP (running under VMWare) - upgraded with all latest MS updates and VB runtime files (and SP2)

Basically, my bot works fine, and always has on my home PC. When trying to run it using the new VMWare OS it gets as far as sending packet 0X14, then disconnects. Packet logs of the program running on both machines is below if you find that helpful. This is the exact same program, just running on different systems.

As part of my de-bugging process, I have checked one or two other programs. Stealth's bot, for example, will run fine on both systems. Mine wont (grrr). I can see from the logs that the final packet is not being correctly assembled when the program is running under VMWare, but am not sure why. The code for that packet is also below.

So I confess, I'm a bit at a loss as to what the problem may be. I'm wondering if there is another OCX or DLL file that I haven't yet registered on the latest installation, but am not getting any errors when running the program either through Visual Studio or as a compliled exe...it just disconnects.

Would appreciate any tips or advice.

Thanks.

Apologies to any Mods if you feel this isn't posted in the correct forum. I debated the choice of three possible alternatives and deemed this one most appropriate


Here's a packetlog of the bot connecting using VMWare:

[quote]
1  Hide  Hide  9  Send 
0000  09 00 0E 65 74 65 72 6E 00                        ...etern.

2  Hide  Hide  7  Recv 
0000  07 00 0E 1A 9F F2 4C                              ......L

3  Hide  Hide  7  Send 
0000  07 00 0F C1 F1 24 65                              .....$e

4  Hide  Hide  7  Recv 
0000  07 00 0F 01 00 00 00                              .......

5  Hide  Hide  59  Send 
0000  01 FF 50 3A 00 00 00 00 00 36 38 58 49 4E 42 32    ..P:.....68XINB2
0010  57 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00    WO..............
0020  00 00 00 00 00 00 00 00 00 55 53 41 00 55 6E 69    .........USA.Uni
0030  74 65 64 20 53 74 61 74 65 73 00                  ted States.

6  Hide  Hide  70  Recv 
0000  FF 25 08 00 87 0F BE 22 FF 50 3E 00 00 00 00 00    .%.....".P>.....
0010  C3 B3 9E 5F 82 6E 8B 00 00 9E A9 CB 72 FC C6 01    ..._.n......r...
0020  6C 6F 63 6B 64 6F 77 6E 2D 49 58 38 36 2D 30 37    lockdown-IX86-07
0030  2E 6D 70 71 00 CC CB A5 9D 4B EB 23 BE 56 CB BA    .mpq.....K.#.V..
0040  64 E8 EF 5D 9C 00                                  d..]..

7  Hide  Hide  8  Send 
0000  FF 25 08 00 87 0F BE 22                            .%....."

8  Hide  Hide  61  Send 
0000  3D 00 1A 03 00 00 00 00 00 00 00 00 00 00 00 00    =...............
0010  9E A9 CB 72 FC C6 01 6C 6F 63 6B 64 6F 77 6E 2D    ...r...lockdown-
0020  49 58 38 36 2D 30 37 2E 6D 70 71 00 CC CB A5 9D    IX86-07.mpq.....
0030  4B EB 23 BE 56 CB BA 64 E8 EF 5D 9C 00            K.#.V..d..]..

9  Hide  Hide  40  Recv 
0000  28 00 1A 01 00 00 00 00 02 00 02 A1 99 57 9A 59    (............W.Y
0010  80 0E D5 0B 2D 0E 58 93 AD 2F 59 DF 8E 07 92 00    ....-.X../Y.....

0020  00 00 00 00 4F 00 00 00                            ....O...
10  Hide  Hide  24  Send 
0000  18 00 01 C3 D3 9E 5F 34 61 68 76 6B 6F 6D 37 67    ......_*********
0010  7A 36 63 32 6B 92 34 00                            ********.

11  Hide  Hide  47  Recv 
0000  2F 00 01 01 00 00 00 59 83 5D 8F 10 00 00 00 04    /......Y.]......
0010  00 00 00 7F 67 1B 00 00 00 00 00 75 84 59 67 F7    ....g......u.Yg.
0020  A9 40 06 25 E0 ED 11 71 5A 43 7E D1 59 5F F0      .@.%...qZC~.Y_.

12  Hide  Hide  85  Send 
0000  FF 51 55 00 59 83 5D 8F A1 99 57 9A A1 99 57 9A    .QU.Y.]...W...W.
0010  01 00 00 00 00 00 00 00 10 00 00 00 04 00 00 00    ................
0020  7F 67 1B 00 00 00 00 00 75 84 59 67 F7 A9 40 06    .g......u.Yg..@.
0030  25 E0 ED 11 71 5A 43 7E D1 59 5F F0 59 80 0E D5    %...qZC~.Y_.Y...
0040  0B 2D 0E 58 93 AD 2F 59 DF 8E 07 92 00 45 74 65    .-.X../Y.....Use
0050  72 6E 61 6C 00                                    rnam.

13  Hide  Hide  9  Recv 
0000  FF 51 09 00 00 00 00 00 00                        .Q.......

14  Hide  Hide  48  Send 
0000  FF 14 08 00 74 65 6E 62 FF 3A 28 00 00 00 00 00    ....tenb.:(.....
0010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
0020  00 00 00 00 00 00 00 00 45 74 65 72 6E 61 6C 00    ........Usernam.
[/quote]
At this point, the program disconnects.

And now the exact same program running on my home PC
[quote]
1  Hide  Hide  9  Send 
0000  09 00 0E 65 74 65 72 6E 00                        ...etern.

2  Hide  Hide  7  Recv 
0000  07 00 0E DB 55 B0 1E                              ....U..

3  Hide  Hide  7  Send 
0000  07 00 0F 51 6E 65 78                              ...Qnex

4  Hide  Hide  7  Recv 
0000  07 00 0F 01 00 00 00                              .......

5  Hide  Hide  59  Send 
0000  01 FF 50 3A 00 00 00 00 00 36 38 58 49 4E 42 32    ..P:.....68XINB2
0010  57 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00    WO..............
0020  00 00 00 00 00 00 00 00 00 55 53 41 00 55 6E 69    .........USA.Uni
0030  74 65 64 20 53 74 61 74 65 73 00                  ted States.

6  Hide  Hide  8  Recv 
0000  FF 25 08 00 73 8D DD CF                            .%..s...

7  Hide  Hide  8  Send 
0000  FF 25 08 00 73 8D DD CF                            .%..s...

8  Hide  Hide  62  Recv 
0000  FF 50 3E 00 00 00 00 00 50 9F E5 1E 7B 5A 97 00    .P>.....P...{Z..
0010  00 F8 0B CE 72 FC C6 01 6C 6F 63 6B 64 6F 77 6E    ....r...lockdown
0020  2D 49 58 38 36 2D 30 38 2E 6D 70 71 00 49 EF 51    -IX86-08.mpq.I.Q
0030  55 B3 0A 7F 35 E0 7F EC F5 13 8C 08 1F 00          U...5.........

9  Hide  Hide  61  Send 
0000  3D 00 1A 03 00 00 00 00 00 00 00 00 00 00 00 00    =...............
0010  F8 0B CE 72 FC C6 01 6C 6F 63 6B 64 6F 77 6E 2D    ...r...lockdown-
0020  49 58 38 36 2D 30 38 2E 6D 70 71 00 49 EF 51 55    IX86-08.mpq.I.QU
0030  B3 0A 7F 35 E0 7F EC F5 13 8C 08 1F 00            ...5.........

10  Hide  Hide  40  Recv 
0000  28 00 1A 01 00 00 00 00 02 00 02 8A 70 DC B3 30    (...........p..0
0010  B2 BF A2 98 51 F0 91 F1 FB 25 82 97 D0 D2 CF 00    ....Q....%......
0020  00 00 00 00 4F 00 00 00                            ....O...

11  Hide  Hide  24  Send 
0000  18 00 01 55 9F E5 1E 37 39 6B 62 67 72 6D 6D 6E    ...P...*********
0010  65 74 6D 74 65 33 6B 00                            ********.

12  Hide  Hide  47  Recv 
0000  2F 00 01 01 00 00 00 CB 46 81 8F 10 00 00 00 04    /.......F.......
0010  00 00 00 A9 67 1B 00 00 00 00 00 64 C4 41 CF 7F    ....g......d.A..
0020  9C FA 67 CA 4B 8A BB 47 82 14 48 51 24 E9 70      ..g.K..G..HQ$.p

13  Hide  Hide  85  Send 
0000  FF 51 55 00 CB 46 81 8F 8A 70 DC B3 8A 70 DC B3    .QU..F...p...p..
0010  01 00 00 00 00 00 00 00 10 00 00 00 04 00 00 00    ................
0020  A9 67 1B 00 00 00 00 00 64 C4 41 CF 7F 9C FA 67    .g......d.A....g
0030  CA 4B 8A BB 47 82 14 48 51 24 E9 70 30 B2 BF A2    .K..G..HQ$.p0...
0040  98 51 F0 91 F1 FB 25 82 97 D0 D2 CF 00 45 74 65    .Q....%......Use
0050  72 6E 61 6C 00                                    rnam.

14  Hide  Hide  9  Recv 
0000  FF 51 09 00 00 00 00 00 00                        .Q.......

15  Hide  Hide  48  Send 
0000  FF 14 08 00 74 65 6E 62 FF 3A 28 00 91 C1 13 01    ....tenb.:(.....
0010  50 9F E5 1E FE F3 C1 5A 2C 3F C9 1F 98 99 E4 6F    P......Z,?.....o
0020  92 82 AC F6 CD 5A FD 7C 45 74 65 72 6E 61 6C 00    .....Z.|Usernam.

16  Hide  Hide  8  Recv 
0000  FF 3A 08 00 00 00 00 00                            .:......

17  Hide  Hide  31  Send 
0000  FF 0A 0D 00 45 74 65 72 6E 61 6C 00 00 FF 0B 08    ....Usernam.....
0010  00 4E 42 32 57 FF 0C 0A 00 01 00 00 00 4C 00      .NB2W........L.

18  Hide  Hide  4  Send 
0000  FF 00 04 00                                        ....

19  Hide  Hide  291  Recv 
0000  FF 0B 23 01 42 6C 69 7A 7A 61 72 64 20 54 65 63    ..#.Blizzard Tec
0010  68 20 53 75 70 70 6F 72 74 00 4F 70 65 6E 20 54    h Support.Open T
0020  65 63 68 20 53 75 70 70 6F 72 74 00 42 6C 69 7A    ech Support.Bliz
0030  7A 61 72 64 20 43 68 61 74 00 50 75 62 6C 69 63    zard Chat.Public
0040  20 43 68 61 74 00 48 75 6D 61 6E 20 53 74 72 61    Chat.Human Stra
0050  74 65 67 79 00 4F 72 63 20 53 74 72 61 74 65 67    tegy.Orc Strateg
0060  79 00 53 63 65 6E 61 72 69 6F 20 47 61 6D 65 73    y.Scenario Games
0070  00 43 6C 61 73 73 69 63 20 47 61 6D 65 73 00 57    .Classic Games.W
0080  61 72 32 20 4C 61 64 64 65 72 20 43 68 61 6C 6C    ar2 Ladder Chall
0090  65 6E 67 65 73 00 49 72 6F 6E 20 4D 61 6E 20 43    enges.Iron Man C
00A0  68 61 6C 6C 65 6E 67 65 73 00 46 72 65 65 20 46    hallenges.Free F
00B0  6F 72 20 41 6C 6C 00 4F 6E 65 20 76 73 20 4F 6E    or All.One vs On
00C0  65 00 53 65 61 73 6F 6E 20 56 00 57 43 47 20 4D    e.Season V.WCG M
00D0  65 72 63 75 72 79 00 57 43 47 20 56 65 6E 75 73    ercury.WCG Venus
00E0  00 57 43 47 20 4D 61 72 73 00 57 43 47 20 4A 75    .WCG Mars.WCG Ju
00F0  70 69 74 65 72 00 57 43 47 20 53 61 74 75 72 6E    piter.WCG Saturn
0100  00 57 43 47 20 4E 65 70 74 75 6E 65 00 57 43 47    .WCG Neptune.WCG
0110  20 55 72 61 6E 75 73 00 57 43 47 20 50 6C 75 74    Uranus.WCG Plut
0120  6F 00 00                                          o..

20  Hide  Hide  166  Recv 
0000  FF 0A 2E 00 45 74 65 72 6E 61 6C 00 4E 42 32 57    ....Usernam.NB2W
0010  20 30 20 30 20 30 20 30 20 30 20 30 20 30 20 30    0 0 0 0 0 0 0 0
0020  20 4E 42 32 57 00 45 74 65 72 6E 61 6C 00 FF 0F    NB2W.Usernam...
0030  36 00 07 00 00 00 21 00 00 00 8D 00 00 00 00 00    6.....!.........
0040  00 00 0D F0 AD BA 0D F0 AD BA 45 74 65 72 6E 61    ..........Userna
0050  6C 00 77 61 72 63 72 61 66 74 20 69 69 20 75 73    e.warcraft ii us
0060  61 2D 31 00 FF 0F 42 00 01 00 00 00 00 00 00 00    a-1...B.........
0070  3E 00 00 00 00 00 00 00 0D F0 AD BA 0D F0 AD BA    >...............
0080  43 6C 61 6E 54 77 43 2D 41 69 72 00 4E 42 32 57    ClanTwC-Air.NB2W
0090  20 30 20 30 20 30 20 30 20 30 20 30 20 30 20 30    0 0 0 0 0 0 0 0
00A0  20 4E 42 32 57 00                                  NB2W.

21  Hide  Hide  472  Recv 
0000  FF 0F 42 00 01 00 00 00 00 00 00 00 3E 00 00 00    ..B.........>...
0010  00 00 00 00 0D F0 AD BA 0D F0 AD BA 4E 65 77 62    ............Newb
0020  5F 4D 61 73 74 65 72 00 50 58 45 53 20 30 20 30    _Master.PXES 0 0
0030  20 34 20 30 20 30 20 30 20 30 20 30 20 50 58 45    4 0 0 0 0 0 PXE
0040  53 00 FF 0F 3E 00 01 00 00 00 00 00 00 00 8D 00    S...>...........
0050  00 00 00 00 00 00 0D F0 AD BA 0D F0 AD BA 45 74    ..............Us
0060  65 72 6E 61 6C 00 4E 42 32 57 20 30 20 30 20 30    ernam.NB2W 0 0 0
0070  20 30 20 30 20 30 20 30 20 30 20 4E 42 32 57 00    0 0 0 0 0 NB2W.
0080  FF 0F 3B 00 12 00 00 00 00 00 00 00 8D 00 00 00    ..;.............
0090  00 00 00 00 0D F0 AD BA 0D F0 AD BA 45 74 65 72    ............User
00A0  6E 61 6C 00 57 65 6C 63 6F 6D 65 20 74 6F 20 42    nam.Welcome to B
00B0  61 74 74 6C 65 2E 6E 65 74 21 00 FF 0F 43 00 12    attle.net!...C..
00C0  00 00 00 00 00 00 00 8D 00 00 00 00 00 00 00 0D    ................
00D0  F0 AD BA 0D F0 AD BA 45 74 65 72 6E 61 6C 00 54    .......Usernam.T
00E0  68 69 73 20 73 65 72 76 65 72 20 69 73 20 68 6F    his server is ho
00F0  73 74 65 64 20 62 79 20 41 54 26 54 2E 00 FF 0F    sted by AT&T....
0100  97 00 12 00 00 00 00 00 00 00 8D 00 00 00 00 00    ................
0110  00 00 0D F0 AD BA 0D F0 AD BA 45 74 65 72 6E 61    ..........Userna
0120  6C 00 54 68 65 72 65 20 61 72 65 20 63 75 72 72    m.There are curr
0130  65 6E 74 6C 79 20 33 36 31 20 75 73 65 72 73 20    ently 361 users
0140  70 6C 61 79 69 6E 67 20 35 36 20 67 61 6D 65 73    playing 56 games
0150  20 6F 66 20 57 61 72 63 72 61 66 74 20 49 49 2C    of Warcraft II,
0160  20 61 6E 64 20 32 33 35 33 30 33 20 75 73 65 72    and 235303 user
0170  73 20 70 6C 61 79 69 6E 67 20 34 32 38 31 37 20    s playing 42817
0180  67 61 6D 65 73 20 6F 6E 20 42 61 74 74 6C 65 2E    games on Battle.
0190  6E 65 74 2E 00 FF 0F 43 00 12 00 00 00 00 00 00    net....C........
01A0  00 8D 00 00 00 00 00 00 00 0D F0 AD BA 0D F0 AD    ................
01B0  BA 45 74 65 72 6E 61 6C 00 4C 61 73 74 20 6C 6F    .Usernam.Last lo
01C0  67 6F 6E 3A 20 4D 6F 6E 20 4A 75 6C 20 39 20 20    gon: Mon Jul 9 
01D0  33 3A 30 32 20 50 4D 00                            3:02 PM.

[/quote]

And the example code, if it is helpful.
[quote]
        Case &H0
            addText "BNET: Version and CD-key check passed!" & vbCrLf, &H99CC00
                If varProduct = "3RAW" Or varProduct = "PX3W" Then
                    InsertNTString varUser
                    InsertNTString varPass
                    SendBNLSPacket &H2
                Else
                    If frmLoginOptions.chkPLug.Value = vbChecked Then
                    Else
                        InsertNonNTString "tenb"
                        sendPacket &H14
                    End If
                    tempb = String(7 * 4, vbNullChar)
                    rb = A(tempb, servers, varPass)
                    InsertNonNTString tempb
                    InsertNTString varUser
                    sendPacket &H3A
                End If
[/quote]

[Edit: added in code sample]
July 9, 2007, 3:59 PM
Eternal
Apologies for replying to my own post but I've noticed a moderator has kindly moved my topic to this forum (which is probably where I should have posted it to begin with). If anyone has any additional information or advice they can offer, I would appreciate your input. I'm still scratching my head on this one...
July 25, 2007, 4:47 PM
Barabajagal
If you'll look closely, it's not 14 that's causing the problem, it's 3A. I don't understand your code at all for 3A... You're using raw data strings when you don't need to. 3A should look something like this:
[code]Packet.ClearOutbound
Packet.InsertDWORD ClientToken
Packet.InsertDWORD ServerToken
Packet.InsertString Hash_Password_Double(LCase$(Config.Password), ClientToken, ServerToken)
Packet.InsertNTString Config.Username
AddQueue Packet.SendBNCSPacket(SID_LOGONRESPONSE2)[/code]
July 25, 2007, 6:59 PM
Eternal
Thanks for the comment. I'm not sure it answers why the program runs perfectly fine on one PC and not another, unless there is an underlying problem with 3A that is triggering on one system. Sounds odd though, don't you think?
July 25, 2007, 8:41 PM
HdxBmx27
The fact that you're sending null data for the hash is bad, and what is causing you to be disconnected.
Step through it and figure out why it's not filling in the data. Also I suggest you move on to BNCSutil.dll instead of BnetAuth.dll
~Hdx
July 25, 2007, 8:53 PM
UserLoser
[quote author=What's wrong with 現のさざ波? link=topic=16858.msg171209#msg171209 date=1185389952]
If you'll look closely, it's not 14 that's causing the problem, it's 3A. I don't understand your code at all for 3A... You're using raw data strings when you don't need to. 3A should look something like this:
[code]Packet.ClearOutbound
Packet.InsertDWORD ClientToken
Packet.InsertDWORD ServerToken
Packet.InsertString Hash_Password_Double(LCase$(Config.Password), ClientToken, ServerToken)
Packet.InsertNTString Config.Username
AddQueue Packet.SendBNCSPacket(SID_LOGONRESPONSE2)[/code]
[/quote]

I wouldn't have a InsertString and InsertNTString.  Strings are null-terminated, so this naming convention makes no sense.  A InsertNonNTString makes more sense  ::)
July 26, 2007, 2:25 AM
Barabajagal
I'm used to a system wherein strings are not null terminated, but have a DWORD before them giving the length. That's why I named them this way. It doesn't really matter, does it?
July 26, 2007, 4:58 AM
Eternal
Thanks for your tips. I'll go work on 0x3A and see if that solves the problem. I still think it's odd that it works on one PC and not the other but if that doesn't solve it at least I can rule it out.
July 26, 2007, 6:13 AM
warz
[quote author=What's wrong with 現のさざ波? link=topic=16858.msg171215#msg171215 date=1185425932]
I'm used to a system wherein strings are not null terminated, but have a DWORD before them giving the length. That's why I named them this way. It doesn't really matter, does it?
[/quote]

For a battle.net client, sure.
July 26, 2007, 1:17 PM
Barabajagal
It's a naming convention, and it tells the truth. One is a Null-Terminated string, one is not. You guys are worse than me when it comes to starting arguments.
July 26, 2007, 5:43 PM
warz
What environment is it, that you're familiar with, that works with the unique length prefixed strings?
July 26, 2007, 6:51 PM
Barabajagal
OGG Vorbis tags.
July 26, 2007, 7:17 PM

Search