• Welcome to Valhalla Legends Archive.
 

BNCSutil 1.3.1

Started by shadypalm88, September 04, 2006, 01:13 AM

Previous topic - Next topic
|

Hero

Quote from: Antarctica on September 22, 2006, 04:14 PM
that isnt going to help... and it doesen't.
I think you should make a new topic for your problem, this is the BNCSutil thread.

MysT_DooM

hmm i tried your code for when your hashing the cdkey, and thats when bnet discs me.  So the problem might be over there. disregard my earlier hint i was reading the wrong line in my code when i told you that.
anyways

instead of using bncs to do some of ur key stuff try the following


Public Declare Sub calcHashBuf Lib "bncsutil.dll" (ByVal Data As String, ByVal Length As Long, ByVal Hash As String)


Public Function ScKeyDecode(ByVal CDKey As String) As String
Dim tKey(12) As String, tStr As String, tLng As Long, HashKey As Long, pos As Integer, i As Integer
    For i = 0 To 12: tKey(i) = Mid$(CDKey, i + 1, 1): Next i
    tLng = 3
    For i = 0 To 11: tLng = tLng + (tKey(i) Xor (tLng * 2)): Next i
    tKey(12) = CStr((tLng Mod 10))
        pos = &HB
        For i = &HC2 To 7 Step -&H11
            tStr = tKey(pos): tLng = i Mod &HC: tKey(pos) = tKey(tLng): tKey(tLng) = tStr: pos = pos - 1
        Next i
        HashKey = &H13AC9741
        For i = 11 To 0 Step -1
            tStr = tKey(i)
            If Asc(tStr) <= 55 Then
                tKey(i) = (((HashKey And &HFF) And 7) Xor tStr)
                HashKey = HashKey \ 8
            ElseIf Asc(tStr) <= 65 Then
                tKey(i) = ((i And 1) Xor tStr)
            End If
        Next i
        tStr = Join(tKey, vbNullString)
        ScKeyDecode = tStr
End Function


Dim Product As String
Dim PublicValue As String
Dim PrivateValue As String
Dim CDKey As String, Decode As String

CDKey = WhereEverUrKeyIs

Decode = ScKeyDecode(CDKey)
Product = Mid$(Decode, 1, 2)
PublicValue = Mid$(Decode, 3, 7)
PrivateValue = Mid$(Decode, 10, 3)



Dim KeyHash As String

KeyHash = buf2.MakeDWORD(ClientToken) & buf2.MakeDWORD(ServerToken) & buf2.MakeDWORD(Product) & buf2.MakeDWORD(PublicValue) & buf2.MakeDWORD(&H0) & buf2.MakeDWORD(PrivateValue)



Dim outhash As String
outhash = String(20, 0)
Call calcHashBuf(KeyHash, Len(KeyHash), outhash)



then when ur making the packet just replace in urs for the
  .InsertNonNTString KeyHash
with
  .InsertString outhash

then for ur key values just replace em with Product & PublicValue.


if that dont work provide a packetlog using ur earlier code. but when i was experimentin with ur code earlier i kept gettin the keyhash as empty or the cdkey was invalid. hope it helps


vb6, something about that combination of numbers and letters is sexy

Antarctica

#107
I don't really think that is the problem because it worked fine before untill bnet changed the aglorithm again.

PS: If I didn't say what kind of error im getting from 0x51, its 0x101 (Invalid Version)  So, again, I doubt its the key decoder.

Hdx

Quote from: Antarctica on September 22, 2006, 07:02 PM
I don't really think that is the problem because it worked fine before untill bnet changed the aglorithm again.

PS: If I didn't say what kind of error im getting from 0x51, its 0x101 (Invalid Version)  So, again, I doubt its the key decoder.
Thats caused by one or more fo the following:
Invalid VerByte
Invalid Exe Version
Invalid EXE Checksum.
How are you calculating the Checksum/exever?
If you're useing BNCSutil.dll make SURE you are useing the updated ver.
~-~(HDX)~-~

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

Spilled

provide us a packet log also plz

Mystical

I think he didn't update to the right .dll version =x

Antarctica

#111
im using bncsutil.dll v1.3.1.1
i posted my code earlier

heres my code for parsing 0x50:

        Case &H50
            Declarations.lngSrvToken = Val("&H" & StrToHex(StrReverse(Mid(Data, 9, 4))))    'Server Token
            Declarations.strMPQName = Mid(Data, InStr(1, Data, "IX86"), (InStr(1, Data, "mpq") + 4))
            Declarations.ValueString = Mid(Data, 38, Len(Data))   'Value String
            Send0x51


heres a packet log

1  192.168.1.5  63.240.202.138  59  Send 
0000  01 FF 50 3A 00 00 00 00 00 36 38 58 49 50 58 45    ..P:.....68XIPXE
0010  53 CF 00 00 00 00 00 00 00 00 00 00 00 00 00 00    S...............
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  63.240.202.138  192.168.1.5  8  Recv 
0000  FF 25 08 00 5E C9 B3 25                            .%..^..%

3  192.168.1.5  63.240.202.138  8  Send 
0000  FF 25 08 00 5E C9 B3 25                            .%..^..%

4  63.240.202.138  192.168.1.5  103  Recv 
0000  FF 50 67 00 00 00 00 00 AD 85 61 15 29 EB 09 00    .Pg.......a.)...
0010  00 4D 89 7E 99 CB C6 01 76 65 72 2D 49 58 38 36    .M.~....ver-IX86
0020  2D 35 2E 6D 70 71 00 42 3D 31 36 32 34 34 35 37    -5.mpq.B=1624457
0030  36 32 20 43 3D 33 35 31 35 34 39 32 31 31 31 20    62 C=3515492111
0040  41 3D 34 30 38 37 36 31 38 38 30 31 20 34 20 41    A=4087618801 4 A
0050  3D 41 5E 53 20 42 3D 42 2B 43 20 43 3D 43 2D 41    =A^S B=B+C C=C-A
0060  20 41 3D 41 2D 42 00                                A=A-B.

5  192.168.1.5  63.240.202.138  111  Send 
0000  FF 51 6F 00 72 54 68 01 01 00 0E 01 00 00 74 03    .Qo.rTh.......t.
0010  01 00 00 00 00 00 00 00 0D 00 00 00 01 00 00 00    ................
0020  6F 51 70 00 00 00 00 00 EE ED 72 D4 D2 83 EA 5B    oQp.......r....[
0030  B4 B3 BF 7A 5C A3 9D 5A 65 30 F0 0C 53 74 61 72    ...z\..Ze0..Star
0040  63 72 61 66 74 2E 65 78 65 20 30 38 2F 32 35 2F    craft.exe 08/25/
0050  30 36 20 31 37 3A 34 32 3A 30 31 20 31 32 31 36    06 17:42:01 1216
0060  35 31 32 00 57 68 65 65 6C 65 72 20 57 2E 00       512.Wheeler W..

6  63.240.202.138  192.168.1.5  9  Recv 
0000  FF 51 09 00 01 01 00 00 00                         .Q.......

Mystical

as far as i know you don't need to change anything in your code if your using bncsutil.dll to connect.. only if your using bnetauth.dll kthx


well this makes me think your not using bncsutil.dll =\
Quote from: Antarctica on September 24, 2006, 03:36 PM
im using bncsutil.dll v1.3.1.1
i posted my code earlier

heres my code for parsing 0x50:

Case &H50
Declarations.lngSrvToken = Val("&H" & StrToHex(StrReverse(Mid(Data, 9, 4)))) 'Server Token
Declarations.strMPQName = Mid(Data, InStr(1, Data, "IX86"), (InStr(1, Data, "mpq") + 4))
Declarations.ValueString = Mid(Data, 38, Len(Data)) 'Value String
Send0x51


Antarctica

#113
ok, then what ver of bncsutil.dll do i need to be using? im using v1.3.1.1

l2k-Shadow

#114
Quote from: Antarctica on September 24, 2006, 03:36 PM
im using bncsutil.dll v1.3.1.1
i posted my code earlier

heres my code for parsing 0x50:

        Case &H50
            Declarations.lngSrvToken = Val("&H" & StrToHex(StrReverse(Mid(Data, 9, 4))))    'Server Token
            Declarations.strMPQName = Mid(Data, InStr(1, Data, "IX86"), (InStr(1, Data, "mpq") + 4))
            Declarations.ValueString = Mid(Data, 38, Len(Data))   'Value String
            Send0x51


well not to mention that's bad code, you are extracting the incorrect mpq file name, and use a debuffer please. Also check out the extractMPQNumber() function in BNCSUtil.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Antarctica

#115
YAY BOT WORKING!!!  ;D ;D ;D
thx for the tip shadow xD

PS: Shadow: Howcome your bot needs BNLS when mine doesen't? (Just wondering)...

l2k-Shadow

Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

MyndFyre

Quote from: Antarctica on September 24, 2006, 04:29 PM
PS: Shadow: Howcome your bot needs BNLS when mine doesen't? (Just wondering)...
Some of us choose to support BNLS, others choose to support local hashing, and some have a mix.

BNLS requires no files on the end-user's computer, so it's extremely easy for the user to set up.  Requiring game files on the local computer makes the product more prone to breaking due to user error.

For the project I'm currently working on, when all is said and done, my product will default to local hashing, but switch to BNLS if the version check fails, or if the game files aren't present.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

l2k-Shadow

Quote from: Antarctica on September 24, 2006, 04:29 PM
YAY BOT WORKING!!!  ;D ;D ;D
thx for the tip shadow xD

PS: Shadow: Howcome your bot needs BNLS when mine doesen't? (Just wondering)...

it doesn't need it, it is an optional feature.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

RealityRipple

Quote from: MyndFyre[vL] on September 24, 2006, 06:00 PM
Quote from: Antarctica on September 24, 2006, 04:29 PM
PS: Shadow: Howcome your bot needs BNLS when mine doesen't? (Just wondering)...
Some of us choose to support BNLS, others choose to support local hashing, and some have a mix.

BNLS requires no files on the end-user's computer, so it's extremely easy for the user to set up.  Requiring game files on the local computer makes the product more prone to breaking due to user error.

For the project I'm currently working on, when all is said and done, my product will default to local hashing, but switch to BNLS if the version check fails, or if the game files aren't present.

I have something similar to that. Since I have hash files stored on my site (courtesy of Blake!), and they're automatically updated (courtesy of a program blake has), I wrote a program that downloads the new hash files in zip form, extracts them, puts them in the right place, and downloads the new verbyte from a text file. Automatic local hashing. It's been a feature of my bot for a while now.

|