Valhalla Legends Forums Archive | Battle.net Bot Development | BNetAuth.dll Password Hash?

AuthorMessageTime
Jaquio
Ok, I need to hash the password for 0x3A and I am using BNetAuth.dll Which I have been told I shouldn't because it sucks, by a couple of people. But oh well this is what I am learning with, anyways my problem is you use it like this

[code]
Public Declare Function X Lib "BnetAuth.dll" (ByVal outbuf As String, ByVal Password As String) As Long
PassHash = X(PassHash, Password)
[/code]

I think... but when I used it like this when it gets down to send 0x3A my bot crashes.. Any idea why at all?
July 20, 2005, 2:28 AM
Myndfyr
I believe (and this may be incorrect) that your outbuf parameter needs to be ByRef.
July 20, 2005, 2:31 AM
Jaquio
Yea, I tried that and no luck it still crashed I think I am using it wrong or something. Either that or there is something wrong with my bnetauth.dll..


Edit: Oops sorry for posting I should have searched the forums fist. You use it like this

[code]
Public Declare Function X Lib "BnetAuth.dll" (ByVal outbuf As String, ByVal Password As String) As Long
TmpP = String(7 * 4, vbNullChar)
PassHash = X(TmpP, Password)
[/code]

Thanks though
July 20, 2005, 2:34 AM
LivedKrad
For reference, I think the point of naming that variable "outbuf" was to imply that it was a buffer. I think when you pass strings to an API that is passed back with a value, it has to be buffered. Meaning I *think* that any string passed to the API that requires data be put back to have a set length string value passed to it instead of a null string. Instance:

[code]
Dim someBuf as String
someBuf = String$(28, Chr$(0))
[/code]

Like I said, I think this is required for all strings passed to an API that is passed back with a value. Someone please correct me if I'm wrong, as you undoubtedly will.
July 20, 2005, 3:59 AM
Newby
[quote author=LivedKrad.fe link=topic=12278.msg121324#msg121324 date=1121831995]
Instance:

[code]
Dim someBuf as String
someBuf = String$(28, Chr$(0))
[/code]
[/quote]

IIRC,

[code]
Dim someBuf as String * 28[/code]

Works too.
July 20, 2005, 5:41 AM
Jaquio
Meh, can no one help me with this?  :'( All I need to do is get 0x3A then it's done.. because I know how to do the rest of the packets. Just it is not hashing the password right or maybe I screwed up in the other packets because it disconnects after 0x3A..
July 20, 2005, 4:52 PM
Myndfyr
[quote author=Jaquio link=topic=12278.msg121371#msg121371 date=1121878347]
Meh, can no one help me with this?  :'( All I need to do is get 0x3A then it's done.. because I know how to do the rest of the packets. Just it is not hashing the password right or maybe I screwed up in the other packets because it disconnects after 0x3A..
[/quote]
Provide a packet log of your sent 0x3a.

And don't whine.  It's annoying.
July 20, 2005, 4:59 PM
Jaquio
[quote author=MyndFyre link=topic=12278.msg121372#msg121372 date=1121878763]
[quote author=Jaquio link=topic=12278.msg121371#msg121371 date=1121878347]
Meh, can no one help me with this?  :'( All I need to do is get 0x3A then it's done.. because I know how to do the rest of the packets. Just it is not hashing the password right or maybe I screwed up in the other packets because it disconnects after 0x3A..
[/quote]
Provide a packet log of your sent 0x3a.

And don't whine.  It's annoying.
[/quote]


Meh, sorry lol here is a packet log of me sending 0x3A I think.. I am not to good with this little packet logger..

[code]
0000  00 0f db 20 91 97 00 03  c9 4f 1c f4 08 00 45 00  ... .... .O....E.
0010  00 57 79 94 40 00 80 06  b4 cd c0 a8 01 2d 3f f0  .Wy.@... .....-?.
0020  ca 79 0b d3 17 e0 e5 2c  a0 9a 58 16 21 86 50 18  .y....., ..X.!.P.
0030  43 9c 2a cc 00 00 ff 3a  2f 00 73 19 a3 1c 00 00  C.*....: /.s.....
0040  30 00 12 19 01 03 52 7c  dd 5a 65 bd fc ac 7b 95  0.....R| .Ze...{.
0050  b5 40 74 6a 6d 89 00 00  00 00 00 00 00 00 4a 61  .@tjm... ......Ja
0060  71 75 69 6f 00                                    quio.                       
[/code]

I hope that is 0x3A.. I have no idea what to look for really(for solving my problem.).
July 20, 2005, 5:30 PM
Myndfyr
This is the problem:
[font=Courier New]
0050  b5 40 74 6a 6d 89 [u]00 00  00 00 00 00 00 00 4a 61   .@tjm... ......Ja
0060  71 75 69 6f 00                                     quio.           [/u]
[/font]
You need to trim your username string.
July 20, 2005, 6:44 PM
Jaquio
[quote author=MyndFyre link=topic=12278.msg121382#msg121382 date=1121885061]
This is the problem:
[font=Courier New]
0050  b5 40 74 6a 6d 89 [u]00 00  00 00 00 00 00 00 4a 61   .@tjm... ......Ja
0060  71 75 69 6f 00                                     quio.           [/u]
[/font]
You need to trim your username string.
[/quote]


Erm, how exactly would I do that? >.< I am new to all this packet stuff I was using csb for the longest time and decided to do it the right way.
July 20, 2005, 7:04 PM
Myndfyr
[quote author=Jaquio link=topic=12278.msg121386#msg121386 date=1121886284]
Erm, how exactly would I do that? >.< I am new to all this packet stuff I was using csb for the longest time and decided to do it the right way.
[/quote]
You don't know how to handle a string?  I don't think you know Visual Basic well enough to continue.

You might look into Trim$, Left$, and Right$.

Another hint: you should do this with the string BEFORE you put it in the packet.  It has nothing to do with "all this packet stuff."
July 20, 2005, 7:17 PM
Jaquio
[quote author=MyndFyre link=topic=12278.msg121387#msg121387 date=1121887034]
[quote author=Jaquio link=topic=12278.msg121386#msg121386 date=1121886284]
Erm, how exactly would I do that? >.< I am new to all this packet stuff I was using csb for the longest time and decided to do it the right way.
[/quote]
You don't know how to handle a string?  I don't think you know Visual Basic well enough to continue.

You might look into Trim$, Left$, and Right$.

Another hint: you should do this with the string BEFORE you put it in the packet.  It has nothing to do with "all this packet stuff."
[/quote]


No no no, I know how to use the Trim$,Left$ and Right$ functions in vb but I wouldn't know how to trim the username string to work with the 0x3A packet.
July 20, 2005, 7:24 PM
R.a.B.B.i.T
.................................
July 20, 2005, 7:44 PM
Jaquio
Yea what a lot of help that was. Am I not doing something right here?  :-\
July 20, 2005, 7:50 PM
LivedKrad
I think the point was to help you realize that if you knew how to use Trim$, Right$, and Left$, then trimming the "0x3A string" would be no different than trimming any other string that you apparently know how to do properly.
July 20, 2005, 7:51 PM
PaiD
I am in shock that you got this far and dont know how to trim strings.....
July 20, 2005, 8:34 PM
Jaquio
[quote author=DueL link=topic=12278.msg121399#msg121399 date=1121891678]
I am in shock that you got this far and dont know how to trim strings.....
[/quote]

Because I had to trim no other fucking strings. OMG GOD I AM GETTING PISSED ALL IT IS, IS ONE SIMPLE FUCKING THING THAT I NEED HELP WITH. GOD! SOMEONE HELP ME! Erm, sorry for the yelling but I do know how to use the Trim$,Right$ and Left$ functions but! I am not sure how I would trim the username string because I end up cutting off either a letter or some of it disappears and I can't find it. I get ipbanned each time I try to connect so I can't test it that much but someone give me more hints on this on how to trim it right..  :-\
July 20, 2005, 9:46 PM
Myndfyr
[quote author=Jaquio link=topic=12278.msg121412#msg121412 date=1121896015]
[quote author=DueL link=topic=12278.msg121399#msg121399 date=1121891678]
I am in shock that you got this far and dont know how to trim strings.....
[/quote]

Because I had to trim no other fucking strings. OMG GOD I AM GETTING PISSED ALL IT IS, IS ONE SIMPLE FUCKING THING THAT I NEED HELP WITH. GOD! SOMEONE HELP ME! Erm, sorry for the yelling but I do know how to use the Trim$,Right$ and Left$ functions but! I am not sure how I would trim the username string because I end up cutting off either a letter or some of it disappears and I can't find it. I get ipbanned each time I try to connect so I can't test it that much but someone give me more hints on this on how to trim it right..  :-\
[/quote]

Let's consider what we know.

1.) We know that there are too many null characters (0s) on the left side of the string.  The right side is correct.
2.) The Right$ function takes a substring from the right side of the string.

Do you want me to SPELL IT OUT FOR YOU ANY MORE?
July 20, 2005, 10:06 PM
HdxBmx27
Dude, you are all wrong:
his Code:
[code]Public Sub Send_0x3A()
Dim PD As String, PassHash As String, TmpP As String, strUsername As String
strUsername = Username'some kind of trimming here
PassHash = String(7 * 4, vbNullChar)
TmpP = X(PassHash, Password)
Debug.Print "Password = " & Password
Debug.Print "TmpP = " & TmpP
Debug.Print "PassHash = " & PassHash
PB.InsertDWORD GetTickCount() 'CLng(CToken)
PB.InsertDWORD CLng(SToken)
PB.InsertNonNTString PassHash
PB.InsertNTString strUsername
PB.SendPacket &H3A
AC &HFFFFC0, "Sent 0x3A"
End Sub[/code]

OK, Let me see if yall can figure out the problem. No? Heres a hint:
[quote](DWORD) Client Token
(DWORD) Server Token
(DWORD[5]) Password Hash
(STRING) Username[/quote]

Now, I'ma be even more presice, He creates the PassHash Vareable is a String with 7 * 4 null charecters. Well It's not 7 DWORDS it's 5. He has 2 extra Dwords, 2*4 = 8, So thats where the 8 nulls come from. He even posted his code before. Please read EVERYTHING before you start giving him wrong advice. He does not need to user Right$(), Left$(), Mid$(), Trim$() or any other string manipulation.
~-~(HDX)~-~
July 20, 2005, 10:11 PM
Quarantine
I don't see how his information was wrong, it was a tip because I doubt Myndy is going to take his time to read code he doesn't care about. A question arrised and he provided a solution and you did too.
July 20, 2005, 10:20 PM
HdxBmx27
I got him to send me a log:
[quote]1  127.0.0.1:2720  127.0.0.1:6112  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.

2  127.0.0.1:6112  127.0.0.1:2720  108  Recv 
0000  FF 25 08 00 10 66 D0 07 FF 50 64 00 00 00 00 00    .%...f...Pd.....
0010  41 2C FF 2E E9 24 B6 53 60 86 BA 7E 8F 8C C5 01    A,...$.S`..~....
0020  49 58 38 36 76 65 72 30 2E 6D 70 71 00 41 3D 37    IX86ver0.mpq.A=7
0030  31 36 31 39 31 34 38 31 20 42 3D 39 32 32 33 30    16191481 B=92230
0040  37 33 31 32 20 43 3D 31 32 35 37 32 35 33 35 35    7312 C=125725355
0050  32 20 34 20 41 3D 41 2B 53 20 42 3D 42 5E 43 20    2 4 A=A+S B=B^C
0060  43 3D 43 2D 41 20 41 3D 41 5E 42 00                C=C-A A=A^B.

3  127.0.0.1:2720  127.0.0.1:6112  120  Send 
0000  FF 25 08 00 10 66 D0 07 FF 51 70 00 CC 20 C5 1D    .%...f...Qp.. ..
0010  00 02 00 02 E7 7B 99 B3 01 00 00 00 00 00 00 00    .....{..........
0020  10 00 00 00 04 00 00 00 F6 2C 2B 00 00 00 00 00    .........,+.....
0030  95 B4 27 AF 6C 4B 4C B4 1B 60 67 65 62 79 AE 8B    ..'.lKL..`geby..
0040  3F 96 3A 41 57 61 72 43 72 61 66 74 20 49 49 20    ?.:AWarCraft II
0050  42 4E 45 2E 45 58 45 20 30 37 2F 31 39 2F 30 35    BNE.EXE 07/19/05
0060  20 32 33 3A 34 37 3A 33 36 20 37 31 32 37 30 34    23:47:36 712704
0070  00 4A 61 71 75 69 6F 00                            .Jaquio.

4  127.0.0.1:6112  127.0.0.1:2720  9  Recv 
0000  FF 51 09 00 00 00 00 00 00                        .Q.......

5  127.0.0.1:2720  127.0.0.1:6112  39  Send 
0000  FF 3A 27 00 09 21 C5 1D 00 00 34 00 12 19 01 03    .:'..!....4.....
0010  52 7C DD 5A 65 BD FC AC 7B 95 B5 40 74 6A 6D 89    R|.Ze...{..@tjm.
0020  4A 61 71 75 69 6F 00                              Jaquio.[/quote]
Can WC2 login using 0x50 sequance insted of 0x1E?

This is how I thought it was suposto go..
Curt of Lord:
[quote]C -> S: Protocol ID
C -> S: SID_CLIENTID2    (0x1E)
C -> S: SID_LOCALEINFO           (0x12) [Optional]
S -> C: SID_STARTVERSIONING        (0x06)
S -> C: SID_CLIENTID   (0x05)
S -> C: SID_LOGONCHALLENGEEX   (0x1D)
S -> C: SID_PING          (0x25)
C -> S: SID_PING   (0x25) [Optional]
S -> C: SID_STARTVERSIONING        (0x06)
C -> S: SID_REPORTVERSION   (0x07)
C -> S: SID_GETICONDATA   (0x2D) [Optional]
S -> C: SID_GETICONDATA   (0x2D)
C -> S: SID_UDPPINGRESPONSE   (0x14) [Optional]
C -> S: SID_GETFILETIME   (0x33) [Optional]
- tos_USA.txt
S -> C: SID_GETFILETIME   (0x33)
C -> S: SID_GETFILETIME   (0x33) [Optional]
- bnserver.ini
S -> C: SID_GETFILETIME   (0x33)
C -> S: SID_READUSERDATA   (0x26) [Optional]
S -> C: SID_READUSERDATA   (0x26)
C -> S: SID_LOGONRESPONSE          (0x29)
S -> C: SID_LOGONRESPONSE          (0x29)
C -> S: SID_ENTERCHAT   (0x0A)
S -> C: SID_ENTERCHAT   (0x0A)
C -> S: SID_JOINCHANNEL   (0x0C) [Optional]
- War2BNE
C -> S: SID_GETCHANNELLIST   (0x0B) [Optional][/quote]
~-~(HDX)~-~
July 20, 2005, 10:35 PM
Quarantine
WC2 can indeed use 0x50.
July 20, 2005, 11:38 PM
Myndfyr
[quote author=HdxBmx27 link=topic=12278.msg121421#msg121421 date=1121897464]
Now, I'ma be even more presice, He creates the PassHash Vareable is a String with 7 * 4 null charecters. Well It's not 7 DWORDS it's 5. He has 2 extra Dwords, 2*4 = 8,
[/quote]
Ahh you are in fact correct.  Don't accuse me for not reading though -- he said this himself:

[quote author=Jaquio link=topic=12278.msg121308#msg121308 date=1121826849]
Edit: Oops sorry for posting I should have searched the forums fist. You use it like this
[code]
Public Declare Function X Lib "BnetAuth.dll" (ByVal outbuf As String, ByVal Password As String) As Long
TmpP = String(7 * 4, vbNullChar)
PassHash = X(TmpP, Password)
[/code]

Thanks though
[/quote]
I don't know exactly how I thought he was allocating his name buffer -- so that was weird looking back.  *shrug*  During the entire length of the discussion, though, I've been under the impression that he had the password hash working correctly.  The next thing up was the username.  Seemed like the logical choice to look at.
July 20, 2005, 11:47 PM
R.a.B.B.i.T
[quote author=Warrior link=topic=12278.msg121425#msg121425 date=1121898020]
I don't see how his information was wrong, it was a tip because I doubt Myndy is going to take his time to read code he doesn't care about. A question arrised and he provided a solution and you did too.
[/quote]He does 7 * 4 (why not just 28?) but 5 "dwords" is 20.
July 21, 2005, 12:02 AM
Quarantine
and it was suggested he trim it as a temporary fix. :o
July 21, 2005, 2:23 AM
Myndfyr
[quote author=Warrior link=topic=12278.msg121465#msg121465 date=1121912620]
and it was suggested he trim it as a temporary fix. :o
[/quote]

Stop defending me!  You're not helping my situation!  :P
July 21, 2005, 2:48 AM
Quarantine
But I [s]LOVE you[/s] enjoy your company.
July 21, 2005, 3:42 AM
BaDDBLooD
[quote author=Warrior link=topic=12278.msg121488#msg121488 date=1121917357]
But I [s]LOVE you[/s] enjoy your company.
[/quote]

Classic.
July 21, 2005, 3:57 AM
shout
<OT>

When reading this, I thought Jaquio was me. I was thinking "since when did know VB and who revived this?"

Go evangelion?

</OT>
July 21, 2005, 4:20 AM

Search