• 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: l2k-Shadow on September 20, 2006, 05:34 PM
Quote from: heRo on September 20, 2006, 05:31 PM
Quote from: Spilled on September 20, 2006, 05:14 PM
I'm getting an occasional Invalid Key response using BNCSUtil, Anyone else experiencing this problem? KeyHash returned seems rather short but recieving correct values.
Yes I rewrote so much code thinking it was caused by my mistake, but it came down to just having to be bncsutil.

I don't have problems with this.. i use kd_create -> kd_calculatehash -> kd_gethash and it works fine always.
I use kd_quick, when I used kd_create etc.. I never had any problems. I guess I'll have to go back to that old way =\

Spilled

Quote from: heRo on September 20, 2006, 06:12 PM
Quote from: l2k-Shadow on September 20, 2006, 05:34 PM
Quote from: heRo on September 20, 2006, 05:31 PM
Quote from: Spilled on September 20, 2006, 05:14 PM
I'm getting an occasional Invalid Key response using BNCSUtil, Anyone else experiencing this problem? KeyHash returned seems rather short but recieving correct values.
Yes I rewrote so much code thinking it was caused by my mistake, but it came down to just having to be bncsutil.

I don't have problems with this.. i use kd_create -> kd_calculatehash -> kd_gethash and it works fine always.
I use kd_quick, when I used kd_create etc.. I never had any problems. I guess I'll have to go back to that old way =\

I use kd_create() right now and im having the problem....



     DWORD VerID = getExeInfo(files[0], exeInformation, 300, &Version,0x1);
     
     if(!VerID)
     {
          global->Queue << cRed << "Failed to retrieve Exe Version!\n";
          return false;   
     }
     unsigned long prod, val1, val2, pub;
     
     kd_init();
     unsigned long decoder = kd_create(global->Config.getCDKey().c_str(),strlen(global->Config.getCDKey().c_str()));
     if(decoder == -1)
     {
           global->Queue << cRed << "Failed to create decoder!\n";
           return false;                                 
     }
if(!kd_isValid(decoder)) {
global->Queue << cRed << "Invalid CDKey Provided!\n";
return false;
}
     
     long hashLength = kd_calculateHash(decoder,ClientToken,ServerToken);
     if(hashLength == 0)
     {
         global->Queue << cRed << "CDKey hashing failed!\n";
         return false;
     }
     char keyHash[hashLength];
     memset(keyHash,0x0,hashLength);
     if(kd_getHash(decoder,keyHash) == 0)
     {
         global->Queue << cGreen << "[Battle.net] - " << cRed << "Failed to retrieve Key Hash!\n";
         return false;
     }


RealityRipple

kd_init is no longer necessary...
also... your kd_isValid... it's not a boolean, it's supposed to be a long integer. not sure if that changes anything.

Spilled

kd_IsValid is depreceated is called withing kd_create, good point but that still doesnt solve the issue.

RealityRipple

if(!kd_isValid(decoder)) {
global->Queue << cRed << "Invalid CDKey Provided!\n";
return false;
}

Isn't that the error you're getting? or is it a bnet error followed by an ipban?

Spilled

Quote from: RealityRipple on September 20, 2006, 06:56 PM
if(!kd_isValid(decoder)) {
global->Queue << cRed << "Invalid CDKey Provided!\n";
return false;
}

Isn't that the error you're getting? or is it a bnet error followed by an ipban?

No, I'm getting an Invalid Key Response from 0x51 resulting in IPBan. Packet log reveals that my keyHash is only 5 bytes long...

RealityRipple

you may wanna add a hashkey length check then. If it's not 20, don't send it.

Spilled

Quote from: RealityRipple on September 20, 2006, 07:42 PM
you may wanna add a hashkey length check then. If it's not 20, don't send it.

27

RealityRipple

Hashed cd keys are 20 characters long... not 27...

Spilled

My mistake, dont know where i got 27 from...

Antarctica

#100
guys look idk what 2 do, ive dled the new 1.3.1.1 ver and it still dont work... maybe somethingn wrong with my code? (VB6 btw)


    Dim lngToken As Long
    Dim lngVersion As Long
    Dim boolCheckRevision As Boolean
    Dim strExeInfo As String, KeyHash As String

    If Declarations.Product = "STAR" Or Declarations.Product = "SEXP" Then
   
        lngVersion = BNCSutil.getExeInfo(App.Path & "\SEXP\Starcraft.exe", strExeInfo)
        lngToken = GetTickCount
   
        boolCheckRevision = BNCSutil.checkRevision(Declarations.ValueString, App.Path & "\sexp\starcraft.exe", App.Path & "\sexp\storm.dll", App.Path & "\sexp\battle.snp", BNCSutil.extractMPQNumber(Declarations.strMPQName), Declarations.lngCheckSum)
       
        With PBuffer
            .InsertDWORD lngToken
            .InsertDWORD lngVersion
            .InsertDWORD Declarations.lngCheckSum
            .InsertDWORD &H1
            .InsertDWORD &H0
            .InsertDWORD Len(Declarations.CDKey)
       
                decoder = kd_create(Declarations.CDKey, Len(Declarations.CDKey))
                hashlength = kd_calculateHash(decoder, lngToken, Declarations.lngSrvToken)
                If hashlength = -1 Then
                    AddText vbRed, "[BNCSutil] Failed to hash CDKey."
                    frmMain.mnuDisconnect_Click
                    .Clear
                    Exit Function
                End If
                KeyHash = String$(hashlength, vbNullChar) ' Initialize buffer
                Call kd_getHash(decoder, KeyHash)
           
            .InsertDWORD BNCSutil.kd_product(decoder)
            .InsertDWORD BNCSutil.kd_val1(decoder)
            .InsertDWORD &H0
            .InsertNonNTString KeyHash
                Call kd_free(decoder)
            .InsertNTString strExeInfo
            .InsertNTString Declarations.CDKeyOwner
            .SendPacket &H51
        End With
       
    ElseIf Declarations.Product = "WAR3" Then
       
        lngVersion = BNCSutil.getExeInfo(App.Path & "\WAR3\war3.exe", strExeInfo)
        lngToken = GetTickCount
   
        boolCheckRevision = BNCSutil.checkRevision(Declarations.ValueString, App.Path & "\WAR3\war3.exe", App.Path & "\WAR3\storm.dll", App.Path & "\WAR3\game.dll", BNCSutil.extractMPQNumber(Declarations.strMPQName), Declarations.lngCheckSum)
   
        With PBuffer
            .InsertDWORD lngToken
            .InsertDWORD lngVersion
            .InsertDWORD Declarations.lngCheckSum
            .InsertDWORD &H1
            .InsertDWORD &H0
            .InsertDWORD Len(Declarations.CDKey)
       
                decoder = kd_create(Declarations.CDKey, Len(Declarations.CDKey))
                hashlength = kd_calculateHash(decoder, lngToken, Declarations.lngSrvToken)
                If hashlength = -1 Then
                    AddText vbRed, "[BNCSutil] Failed to hash CDKey."
                    frmMain.mnuDisconnect_Click
                    Exit Function
                End If
                KeyHash = String$(hashlength, vbNullChar) ' Initialize buffer
                Call kd_getHash(decoder, KeyHash)
           
            .InsertDWORD BNCSutil.kd_product(decoder)
            .InsertDWORD BNCSutil.kd_val1(decoder)
            .InsertDWORD 0
            .InsertNonNTString KeyHash
                Call kd_free(decoder)
            .InsertNTString strExeInfo
            .InsertNTString Declarations.CDKeyOwner
            .SendPacket &H51
        End With
       
    End If

UserLoser

Out of curiousity, what does the "kd" prefix stand for in bncsutil?

l2k-Shadow

Quote from: UserLoser on September 22, 2006, 08:59 AM
Out of curiousity, what does the "kd" prefix stand for in bncsutil?

i would think Key Decoder
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.

MysT_DooM

try adding a null byte to the end of ur key hash (&H0)
so if u have something like insertNTstring in your packet buffer shud be somelike the one below; so try that.


Public Sub InsertNTString(ByVal NewData As String)
    'adds a string to the buffer with a null byte at the end
    Buffer = Buffer & NewData & Chr(&H0)
End Sub


or if that doesnt work do a search for all your bncsutil.dll's on ur computer and replace them all with your new one :P  , even though it shud be read from ur system folder i believe.


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

Antarctica

that isnt going to help... and it doesen't.

|