• Welcome to Valhalla Legends Archive.
 

0x51 Help

Started by Spilled, February 23, 2005, 09:58 AM

Previous topic - Next topic

UserLoser.

Yes, packet log(s) would be nice since more than half the time when people post code, they do not show how the variable is set, what this function does, and stuff like that.  Seeing a packet log of your bot interacting with Battle.net would really help us figure it out and help you towards success

Spilled

Hrmm i packet logged it, came up with some weird stuff... here it is


1  Hide  Hide  59  Send 
0000  01 FF 50 3A 00 00 00 00 00 36 38 58 49 56 44 32    ..P:.....68XIVD2
0010  44 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00    D...............
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.

2  Hide  Hide  106  Recv 
0000  FF 25 08 00 1E 90 13 E8 FF 50 62 00 00 00 00 00    .%.......Pb.....
0010  05 E2 DC A7 A0 1F 29 00 00 AC 41 43 25 0B C5 01    ......)...AC%...
0020  49 58 38 36 76 65 72 32 2E 6D 70 71 00 41 3D 32    IX86ver2.mpq.A=2
0030  31 32 37 38 30 37 30 20 42 3D 36 36 37 35 37 30    1278070 B=667570
0040  35 37 38 20 43 3D 33 30 32 30 38 34 30 35 30 20    578 C=302084050
0050  34 20 41 3D 41 5E 53 20 42 3D 42 2D 43 20 43 3D    4 A=A^S B=B-C C=
0060  43 2B 41 20 41 3D 41 2B 42 00                      C+A A=A+B.

3  Hide  Hide  153  Send 
0000  FF 25 08 00 1E 90 13 E8 FF 51 91 00 C0 46 EC 23    .%.......Q...F.#
0010  00 0A 00 01 25 4A 89 32 01 00 00 00 00 00 00 00    ....%J.2........
0020  10 00 00 00 06 00 00 00 C8 77 9B 00 00 00 00 00    .........w......
0030  41 3D 32 31 32 37 38 30 37 30 20 42 3D 36 36 37    A=21278070 B=667
0040  35 37 30 35 37 38 20 43 3D 33 30 32 30 38 34 30    570578 C=3020840
0050  35 30 20 34 20 41 3D 41 5E 53 20 42 3D 42 2D 43    50 4 A=A^S B=B-C
0060  20 43 3D 43 2B 41 20 41 3D 41 2B 42 00 47 61 6D     C=C+A A=A+B.Gam
0070  65 2E 65 78 65 20 30 32 2F 32 33 2F 30 35 20 32    e.exe 02/23/05 2
0080  30 3A 33 39 3A 33 33 20 31 31 39 38 38 35 37 00    0:39:33 1198857.
0090  53 6F 6D 65 4E 65 77 62 00                         SomeNewb.



Edit:

FF 25 08 00 1E 90 13 E8 FF 51 91 00 C0 46 EC 23 

its like they put together, hrmm... ideas?

Hdx

Why are you echoing back the hashstring?
It isn't sapost be sent to b.net it is saposto be used in the CheckRevishion function, with the hash files, Currently the Z() function in BNetAuth.dll
~-~(HDX)~-~

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

Spilled

I dont get what you mean by echoing, can you be more specific, thx for the help.

Hdx

You recive
2  Hide  Hide  106  Recv
.A=21278070 B=667570578 C=302084050 4 A=A^S B=B-C C=C+A A=A+B.
in S->C 0x50

Then you send it back in 0x51.
Take out the InsertNonNTString Hashing.Hash in your sub, that should fix it..
Also for them being bunched together, dont worry, the server can pick them apart using the Packet header
~-~(HDX)~-~

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

Spilled

ahh, there we go, thx HDX and Userloser for your help, much appreciated :)

Spilled

Ok, ran into anohter problem here and i thought i would be more appropriate to just post it here instead of starting a new topic so sry about the double post everyone, but heres my Code:

Variable Declares:

Public Hashing As HashingShit
Private Type HashingShit
    Checksum As Long
    ClientToken As Long
    ServerToken As Long
    VersionID As Long
    ExeInfo As String
    Hash As String
    HashedData As String
    MpqName As String
End Type


heres the case where i recieve 0x50:

        Case &H50
             Hashing.ServerToken = Val("&H" & Connection.StrToHex(StrReverse(Mid(strData, 9, 4))))
             Hashing.Hash = Mid(strData, 38, Len(strData) - 2)
             Hashing.MpqName = CStr(Mid(Mid(strData, InStr(1, strData, "IX86ver"), Len(strData)), 1, 12))
                SendPacket51


And heres where my problem is, in this sub where it sends 0x50, i was getting it back as bad game version, (HDX tried to help me on PM's but we didnt finish), i think the problem is:


cRev = C(Hashing.HashedData, Hashing.ServerToken, ProductID, Val1, Val2, ClientToken)


Because i put a break there and Hashing.HashedData is an empty string variable.

Any ideas anybody? HDX's help got it to send now its just responding as bad game version and i think this may be the problem, thanks in advance...

tA-Kane

Quote from: Spilled[DW] on February 23, 2005, 11:05 PMAnd heres where my problem is, in this sub where it sends 0x50, i was getting it back as bad game version, (HDX tried to help me on PM's but we didnt finish), i think the problem is:


cRev = C(Hashing.HashedData, Hashing.ServerToken, ProductID, Val1, Val2, ClientToken)


Because i put a break there and Hashing.HashedData is an empty string variable.
Put a break after that code (or step over once) and see if it's still an empty string variable. When you put a break on something, it stops before executing the code, not after.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Spilled

#23
If i put the break after that line of code, vb crashes but if before it doesnt, any ideas kane?


Public Hashing As HashingShit
Private Type HashingShit
    Checksum As Long
    ClientToken As Long
    ServerToken As Long
    VersionID As Long
    ExeInfo As String
    Hash As String
    HashedData As String
    MpqName As String
End Type



Heres my case &H50 where it calls for sending of 0x51

        Case &H51
                Select Case Connection.GetDWORD(Mid(strData, 5, 2))
                    Case &H0
                        AddChat vbGreen, "Authorization Passed!"
                    Case &H101
                        AddChat vbRed, "Bad game version."
                            CloseConnection
                    Case &H200
                        AddChat vbRed, "Invalid cd-key!"
                            CloseConnection
                    Case &H203
                        AddChat vbRed, "Bad Product!"
                            CloseConnection
                    Case &H202
                        AddChat vbRed, "Cd-Key Banned!"
                            CloseConnection
                    Case &H201
                        AddChat vbRed, "Cd-Key in use by: ", vbWhite, Mid(strData, 9, Len(strData) - 9)
                            CloseConnection
                    Case &H210
                        AddChat vbRed, "LOD Cd-Key is invalid."
                            CloseConnection
                    Case &H211
                        AddChat vbRed, "LOD Cd-Key in use by: " & Mid(strData, 9, Len(strData) - 9) & "!"
                            CloseConnection
                    Case &H212
                        AddChat vbRed, "LOD Cd-Key is banned!"
                            CloseConnection
                End Select


Heres the sub where i send 0x51:


Public Sub SendPacket51()
    Dim CheckRev As Long
    Dim ClientToken As Long
    Dim ProductID As Long
    Dim Val1 As Long
    Dim Val2 As Long
    Dim cRev As Long
   
    Select Case strProduct
        Case "PX2D" 'D2:LOD Not supported yet.
            Exit Sub
        Case "VD2D"
            Hashing.ExeInfo = Space(256)
            Hash = String(20, vbNullChar)
            CheckRev = z(Files & "Game.exe", Files & "Bnclient.dll", Files & "D2Client.dll", Hashing.Hash, Hashing.VersionID, Hashing.Checksum, Hashing.ExeInfo, Hashing.MpqName)
                If CheckRev = 0 Then
                    AddChat vbRed, "CheckRevion Failed!"
                        CloseConnection
                    Exit Sub
                End If
                    Connection.NullTruncString Hashing.ExeInfo
                    ClientToken = GetTickCount()
                   
                InsertDWORD ClientToken
                InsertDWORD Hashing.VersionID
                InsertDWORD Hashing.Checksum
                        'If strProduct = "PX2D" Then
                        '    InsertDWORD &H2
                        'Else
                            InsertDWORD &H1
                        'End If
                InsertDWORD &H0
                Call Connection.DecodeCDKey(strKey, ProductID, Val1, Val2)
                cRev = C(Hashing.HashedData, Hashing.ServerToken, ProductID, Val1, Val2, ClientToken)
                InsertDWORD Len(strKey)
                InsertDWORD ProductID
                InsertDWORD Val1
                InsertDWORD &H0
                InsertNonNTString Hashing.HashedData
                InsertNTString Hashing.ExeInfo
                InsertNTString "SomeNewb"
                    SendPacket &H51
    End Select
End Sub


I think its a problem with the Hashing.HashedData, can anyone spot my error? Thanks in advance everyone.


tA-Kane

Quote from: Spilled[DW] on February 24, 2005, 12:28 AMIf i put the break after that line of code, vb crashes but if before it doesnt, any ideas kane?
Breakpoint C?

If it's a library call (eg, you're using SomeGuysBnetUtilities.dll or somesuch), then make sure you're passing your data correctly; make sure your data types and their values are correct.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Spilled

Thats what i was doing, putting breakpoints and checking my values in my variables, all seems appropriate but Hashing.hasheddata was empty. Ideas?

Hdx

#26
Feel like posting the values of some vareables?
I have a hunch that Hashing.HashedData = vbNullstring.
And THAT is what is causing your error: to fix it place: Hashing.HashedData = String(20, vbNullChar) right befor you call c()
Also you can deleat Hash = String(20, vbNullChar)
Oh and ADD OPTION EXPLICIT TO THE VARRY TOP OF YOU MOD!
If its not already there >.<

~-~(HDX)~-~
[Edit]
Haha I was right You need to fix your vareable.
I've noticed that BnetAuth has NO handeling of empty parameters, causing major crashing.
[/Edit]

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

Spilled

yea, i just added that and the erroring stopped, now its sending 0x51 and im recieving the response of bad game version again, i checked if Hashing.HashedData had a value and it does now, i packetlogged this:


1  Hide  Hide  59  Send 
0000  01 FF 50 3A 00 00 00 00 00 36 38 58 49 56 44 32    ..P:.....68XIVD2
0010  44 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00    D...............
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.

2  Hide  Hide  107  Recv 
0000  FF 25 08 00 F7 3C 36 5E FF 50 63 00 00 00 00 00    .%...<6^.Pc.....
0010  95 0C 27 D5 59 ED 32 00 00 AC 41 43 25 0B C5 01    ..'.Y.2...AC%...
0020  49 58 38 36 76 65 72 35 2E 6D 70 71 00 41 3D 38    IX86ver5.mpq.A=8
0030  36 39 36 30 30 34 32 38 20 42 3D 33 38 38 32 38    69600428 B=38828
0040  34 31 30 32 20 43 3D 36 30 30 30 32 30 35 35 38    4102 C=600020558
0050  20 34 20 41 3D 41 2B 53 20 42 3D 42 2D 43 20 43     4 A=A+S B=B-C C
0060  3D 43 2D 41 20 41 3D 41 5E 42 00                   =C-A A=A^B.

3  Hide  Hide  112  Send 
0000  FF 25 08 00 F7 3C 36 5E FF 51 68 00 B0 62 C8 24    .%...<6^.Qh..b.$
0010  00 0A 00 01 83 3E 98 D0 01 00 00 00 00 00 00 00    .....>..........
0020  10 00 00 00 06 00 00 00 C8 77 9B 00 00 00 00 00    .........w......
0030  54 F7 AC 90 21 27 D2 4B 90 FD DF C1 D8 7F EB A0    T...!'.K........
0040  E3 C1 3D 0E 47 61 6D 65 2E 65 78 65 20 30 32 2F    ..=.Game.exe 02/
0050  32 33 2F 30 35 20 32 30 3A 33 39 3A 33 33 20 31    23/05 20:39:33 1
0060  31 39 38 38 35 37 00 53 6F 6D 65 4E 65 77 62 00    198857.SomeNewb.

4  Hide  Hide  9  Recv 
0000  FF 51 09 00 01 01 00 00 00                         .Q.......


Hdx

Well, Just by the packt log I can tell that your not using the right hashes. last edit time should be: 10/13/03 not 02/23/05
Use these: http://hdx.no-ip.org/Files/D21.10.zip
~-~(HDX)~-~

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

Spilled

Yes, Authorization passed thank you once again HDX, much appreciated :)

|