Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Jaquio on July 19, 2005, 09:28 PM

Title: BNetAuth.dll Password Hash?
Post by: Jaquio on July 19, 2005, 09:28 PM
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


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


I think... but when I used it like this when it gets down to send 0x3A my bot crashes.. Any idea why at all?
Title: Re: BNetAuth.dll Password Hash?
Post by: MyndFyre on July 19, 2005, 09:31 PM
I believe (and this may be incorrect) that your outbuf parameter needs to be ByRef.
Title: Re: BNetAuth.dll Password Hash?
Post by: Jaquio on July 19, 2005, 09:34 PM
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


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)


Thanks though
Title: Re: BNetAuth.dll Password Hash?
Post by: LivedKrad on July 19, 2005, 10:59 PM
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:


Dim someBuf as String
someBuf = String$(28, Chr$(0))


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.
Title: Re: BNetAuth.dll Password Hash?
Post by: Newby on July 20, 2005, 12:41 AM
Quote from: LivedKrad.fe on July 19, 2005, 10:59 PM
Instance:


Dim someBuf as String
someBuf = String$(28, Chr$(0))


IIRC,


Dim someBuf as String * 28


Works too.
Title: Re: BNetAuth.dll Password Hash?
Post by: Jaquio on July 20, 2005, 11:52 AM
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..
Title: Re: BNetAuth.dll Password Hash?
Post by: MyndFyre on July 20, 2005, 11:59 AM
Quote from: Jaquio on July 20, 2005, 11:52 AM
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..
Provide a packet log of your sent 0x3a.

And don't whine.  It's annoying.
Title: Re: BNetAuth.dll Password Hash?
Post by: Jaquio on July 20, 2005, 12:30 PM
Quote from: MyndFyre on July 20, 2005, 11:59 AM
Quote from: Jaquio on July 20, 2005, 11:52 AM
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..
Provide a packet log of your sent 0x3a.

And don't whine.  It's annoying.


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


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.                       


I hope that is 0x3A.. I have no idea what to look for really(for solving my problem.).
Title: Re: BNetAuth.dll Password Hash?
Post by: MyndFyre on July 20, 2005, 01:44 PM
This is the problem:

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.           


You need to trim your username string.
Title: Re: BNetAuth.dll Password Hash?
Post by: Jaquio on July 20, 2005, 02:04 PM
Quote from: MyndFyre on July 20, 2005, 01:44 PM
This is the problem:

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.           


You need to trim your username string.


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.
Title: Re: BNetAuth.dll Password Hash?
Post by: MyndFyre on July 20, 2005, 02:17 PM
Quote from: Jaquio on July 20, 2005, 02:04 PM
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.
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."
Title: Re: BNetAuth.dll Password Hash?
Post by: Jaquio on July 20, 2005, 02:24 PM
Quote from: MyndFyre on July 20, 2005, 02:17 PM
Quote from: Jaquio on July 20, 2005, 02:04 PM
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.
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."


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.
Title: Re: BNetAuth.dll Password Hash?
Post by: R.a.B.B.i.T on July 20, 2005, 02:44 PM
.................................
Title: Re: BNetAuth.dll Password Hash?
Post by: Jaquio on July 20, 2005, 02:50 PM
Yea what a lot of help that was. Am I not doing something right here?  :-\
Title: Re: BNetAuth.dll Password Hash?
Post by: LivedKrad on July 20, 2005, 02:51 PM
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.
Title: Re: BNetAuth.dll Password Hash?
Post by: PaiD on July 20, 2005, 03:34 PM
I am in shock that you got this far and dont know how to trim strings.....
Title: Re: BNetAuth.dll Password Hash?
Post by: Jaquio on July 20, 2005, 04:46 PM
Quote from: DueL on July 20, 2005, 03:34 PM
I am in shock that you got this far and dont know how to trim strings.....

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..  :-\
Title: Re: BNetAuth.dll Password Hash?
Post by: MyndFyre on July 20, 2005, 05:06 PM
Quote from: Jaquio on July 20, 2005, 04:46 PM
Quote from: DueL on July 20, 2005, 03:34 PM
I am in shock that you got this far and dont know how to trim strings.....

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

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?
Title: Re: BNetAuth.dll Password Hash?
Post by: Hdx on July 20, 2005, 05:11 PM
Dude, you are all wrong:
his 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


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

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)~-~
Title: Re: BNetAuth.dll Password Hash?
Post by: Warrior on July 20, 2005, 05:20 PM
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.
Title: Re: BNetAuth.dll Password Hash?
Post by: Hdx on July 20, 2005, 05:35 PM
I got him to send me a log:
Quote1  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.
Can WC2 login using 0x50 sequance insted of 0x1E?

This is how I thought it was suposto go..
Curt of Lord:
QuoteC -> 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]
~-~(HDX)~-~
Title: Re: BNetAuth.dll Password Hash?
Post by: Warrior on July 20, 2005, 06:38 PM
WC2 can indeed use 0x50.
Title: Re: BNetAuth.dll Password Hash?
Post by: MyndFyre on July 20, 2005, 06:47 PM
Quote from: HdxBmx27 on July 20, 2005, 05:11 PM
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,
Ahh you are in fact correct.  Don't accuse me for not reading though -- he said this himself:

Quote from: Jaquio on July 19, 2005, 09:34 PM
Edit: Oops sorry for posting I should have searched the forums fist. You use it like this

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)


Thanks though
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.
Title: Re: BNetAuth.dll Password Hash?
Post by: R.a.B.B.i.T on July 20, 2005, 07:02 PM
Quote from: Warrior on July 20, 2005, 05:20 PM
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.
He does 7 * 4 (why not just 28?) but 5 "dwords" is 20.
Title: Re: BNetAuth.dll Password Hash?
Post by: Warrior on July 20, 2005, 09:23 PM
and it was suggested he trim it as a temporary fix. :o
Title: Re: BNetAuth.dll Password Hash?
Post by: MyndFyre on July 20, 2005, 09:48 PM
Quote from: Warrior on July 20, 2005, 09:23 PM
and it was suggested he trim it as a temporary fix. :o

Stop defending me!  You're not helping my situation!  :P
Title: Re: BNetAuth.dll Password Hash?
Post by: Warrior on July 20, 2005, 10:42 PM
But I LOVE you enjoy your company.
Title: Re: BNetAuth.dll Password Hash?
Post by: BaDDBLooD on July 20, 2005, 10:57 PM
Quote from: Warrior on July 20, 2005, 10:42 PM
But I LOVE you enjoy your company.

Classic.
Title: Re: BNetAuth.dll Password Hash?
Post by: shout on July 20, 2005, 11:20 PM
<OT>

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

Go evangelion?

</OT>