Valhalla Legends Forums Archive | Battle.net Bot Development | Quick Question: BNLS_HASHDATA (0x0B)

AuthorMessageTime
LockesRabb
[code]Private Sub BNLS_HASHDATA() '0x0B
    DataLen = Len(m_Password) + 1
    With PacketBuf
        .Clear
        .InsertDWORD DataLen
        .InsertDWORD &H2
        .InsertNTString m_Password
        .InsertDWORD ClientToken
        .InsertDWORD ServerToken
        .SendBNLSPacket sckBNLS, &HB    'Send 0x0B packet
        .Clear
    End With
    RaiseEvent DebugOutput("0x0B BNLS_HASHDATA packet sent.")
End Sub[/code]

The password is a typical string variable containing the password in plain text. Nothing special has been done to it, ie: lowercase, etc, etc. Does the packet look about right? Or am I going about it in the wrong way?
February 14, 2007, 9:56 PM
UserLoser
That is incorrect, you don't hash the null terminator at the end of your password
February 14, 2007, 10:00 PM
LockesRabb
[code]Private Sub BNLS_HASHDATA() '0x0B
    DataLen = Len(m_Password)
    With PacketBuf
        .Clear
        .InsertDWORD DataLen
        .InsertDWORD &H2
        .InsertNTString lcase(m_Password)
        .InsertDWORD ClientToken
        .InsertDWORD ServerToken
        .SendBNLSPacket sckBNLS, &HB    'Send 0x0B packet
        .Clear
    End With
    RaiseEvent DebugOutput("0x0B BNLS_HASHDATA packet sent.")
End Sub[/code]

Took out the +1. thought the len would include the NT. I was reading the 0x29 C->S packet doc at BNETDocs, and found out that passwords are supposed to be converted to lowercase prior to hashing. So I added lcase.

So otherwise, it looks fine?
February 14, 2007, 10:08 PM
UserLoser
They don't have to be converted to lowercase.  The only reason it states that is because the official Blizzard clients convert your password to lowercase prior to hashing it.
February 14, 2007, 10:11 PM
LockesRabb
so it'll return the same data regardless of case? in other words, bnls_hashdata is case-insensitive?
February 14, 2007, 10:13 PM
UserLoser
[quote author=Kyro link=topic=16322.msg164876#msg164876 date=1171491214]
so it'll return the same data regardless of case? in other words, bnls_hashdata is case-insensitive?
[/quote]

BNLS doesn't care what the case is.  Just the official Blizzard client puts your password to lower case.  You can have BNLS hash anything, not only account passwords for Battle.net.
February 14, 2007, 10:32 PM
LockesRabb
I'm having problems....

Look:

[quote]Ready.
Username set.
Password set.
GameCode set to SEXP.
CDKey set.
Connecting to BNLS...
Connected to BNLS.
Connected to BNET.
0x01 SID_EmuByte sent.
0x50 SID_AUTH_INFO packet sent.
Received Packet: 0x25 (SID_PING)
0x25 SID_PING packet sent.
Received 0x25 from BNET. 0x25 transmitted back to BNET.
Received Packet: 0x50 (SID_AUTH_INFO)
0x01 BNLS_CDKEY packet sent.
Receiving incoming data...
Parsing BNLS packet...
Received Packet: 0x1 (BNLS_CDKEY)
0x1A BNLS_VERSIONCHECKEX2 packet sent.
Receiving incoming data...
Parsing BNLS packet...
Received Packet: 0x1A (BNLS_VERSIONCHECKEX2)
0x51 SID_AUTH_CHECK packet sent.
Received Packet: 0x51 (SID_AUTH_CHECK)
0x51 Response: Authenication information accepted.
[color=red]0x0B BNLS_HASHDATA packet sent.[/color]
Received Packet: 0x4C (SID_REQUIREDWORK)
0x4C (SID_REQUIREDWORK) disregarded.
[color=red]BNLS connection closed.
BNLS connection aborted by server!
[/color]
Received Packet: 0x0 (SID_NULL)
0x00 SID_NULL packet sent.
Received 0x00 from BNET. 0x00 transmitted back to BNET.
Sockets closed.
Disconnected. (User Action)[/quote]

This is my 0x0B code:

[code]Private Sub BNLS_HASHDATA() '0x0B
    Dim DataLen As Long
    DataLen = Len(m_Password)
    With PacketBuf
        .Clear
        .InsertDWORD DataLen
        .InsertDWORD &H2
        .InsertNTString LCase(m_Password)
        .InsertDWORD ClientToken
        .InsertDWORD ServerToken
        .SendBNLSPacket sckBNLS, &HB    'Send 0x0B packet
        .Clear
    End With
    RaiseEvent DebugOutput("0x0B BNLS_HASHDATA packet sent.")
End Sub[/code]

Right after it's sent, BNLS disconnects me. So I presume I must be doing something wrong...

BNLS 0x0B C->S info:

[quote]Optional:
(DWORD) Client Key (Double Hash only)
(DWORD) Server Key (Double Hash only)[/quote]

The client key data is obtained from:

S->C 0x01 BNLS_CDKEY

[quote](DWORD) Client Token[/quote]

And the server key data is obtained from:

S->C 0x50 SID_AUTH_INFO

[quote](DWORD) Server Token[/quote]

Does all of that seem correct?
February 14, 2007, 11:17 PM
Barabajagal
ClientToken is just a value you set once and use for the rest of the connection... usually a GetTickCount you set when you first start to connect. Where are you getting it from?
February 14, 2007, 11:22 PM
LockesRabb
The client key data is being obtained from

S->C 0x01 BNLS_CDKEY

[quote](DWORD) Client Token[/quote]
February 14, 2007, 11:25 PM
HdxBmx27
[code](VOID) Data to be hashed.[/code]
You are inserting it as a STRING you need to insert it as a VOID.
If you're using my old packet Buffer I *think* there is a InsertNonNTString and a InsertVoid depends on what ver of my buffer you're using.
~Hdx
February 15, 2007, 12:23 AM
HdxBmx27
[quote author=Hdx link=topic=16322.msg164893#msg164893 date=1171498999]
[code](VOID) Data to be hashed.[/code]
You are inserting it as a STRING you need to insert it as a VOID.
If you're using my old packet Buffer I *think* there is a InsertNonNTString and a InsertVoid depends on what ver of my buffer you're using.
Also, you should lowercase your password, because the game does and it will result in a invalid password result if you don't.
~Hdx
[/quote]

Whops hit the wrong button sorry yall.
~Hdx
February 15, 2007, 12:24 AM
LockesRabb
Nope, was using DarkMinion's packet buffer class. The debuffer class although is definitely yours. :-)

But to answer your question, no, I don't see any insertvoid sub or function at all. It was one of the first things I checked when I first started coding this packet. Would have made things easier if I had that sub.

[Edit] I tried changing it to InsertNONNTString. That pretty much solved the problem, thanks Hdx! Here's results:

[quote]Ready.
Username set.
Password set.
GameCode set to SEXP.
CDKey set.
Connecting to BNLS...
Connected to BNLS.
Connected to BNET.
0x01 SID_EmuByte sent.
0x50 SID_AUTH_INFO packet sent.
Received Packet: 0x25 (SID_PING)
0x25 SID_PING packet sent.
Received 0x25 from BNET. 0x25 transmitted back to BNET.
Received Packet: 0x50 (SID_AUTH_INFO)
0x01 BNLS_CDKEY packet sent.
Receiving incoming data...
Parsing BNLS packet...
Received Packet: 0x1 (BNLS_CDKEY)
0x1A BNLS_VERSIONCHECKEX2 packet sent.
Receiving incoming data...
Parsing BNLS packet...
Received Packet: 0x1A (BNLS_VERSIONCHECKEX2)
0x51 SID_AUTH_CHECK packet sent.
Received Packet: 0x51 (SID_AUTH_CHECK)
0x51 Response: Authenication information accepted.
0x0B BNLS_HASHDATA packet sent.
Received Packet: 0x4C (SID_REQUIREDWORK)
0x4C (SID_REQUIREDWORK) disregarded.
Receiving incoming data...
Parsing BNLS packet...
Received Packet: 0xB (BNLS_HASHDATA)
0x29 SID_LOGONRESPONSE packet sent.
Received Packet: 0x29 (SID_LOGONRESPONSE)
Successfully logged on Battle.net!
Sockets closed.
Disconnected.
February 15, 2007, 1:16 AM
HdxBmx27
Ah ok, Its exactly the same as InsertNTString except remove the & Chr(0) part at the end.
If I could figure out where my old backups of my laptop are I could post my best Buffer class for VB. But alas I cant find it.
~-~(HDX)~-~
February 15, 2007, 1:21 AM
LockesRabb
At least you have backups! When my laptop hd failed, I was offically screwed. Everything I ever had was in there -- zero backups. I had financial info, homework, artwork, games, stuff like that in there. I was so morose about it... I tried buying a drive bay with USB to see if I could hook it up to another PC and recover the data. Even with data recovery programs I downloaded off the internet, none of them could manage to interface with the data. I was sooooo depressed. No backups.... :-(
February 15, 2007, 1:25 AM

Search