• Welcome to Valhalla Legends Archive.
 

[Solved][VB] C-> S 0x51 Packet

Started by Don Cullen, September 11, 2005, 08:25 PM

Previous topic - Next topic

Don Cullen

SID_AUTH_CHECK Info:

Quote(DWORD)       Client Token
(DWORD)       EXE Version
(DWORD)       EXE Hash
(DWORD)       Number of keys in this packet
(BOOLEAN)    Using Spawn (32-bit)

For Each Key:
(DWORD)       Key Length
(DWORD)       CD key's product value
(DWORD)       CD key's public value
(DWORD)       Unknown (0)
(DWORD[5])    Hashed Key Data

(STRING)     Exe Information
(STRING)     CD Key owner name

After studying the BNETDocs, I tried to code a 0x51 packet, and got stuck in the process. The Client Token was easy enough, only had to use GetTickCount() API for that one.

EXE Version: Does that follow a specific format? And how can this be obtained dynamically without hard-coding it?

How is a EXE Hash formatted, and how does one go about hashing an EXE? I'm assuming here that it's the Starcraft.exe that needs to be hashed...

(DWORD)       Number of keys in this packet

Number of keys? As in number of cdkeys, or how many numbers inside the cdkey, or what?

For Spawn, can I just do:

.INSERTDWORD &H0  'Zero, boolean for false

Or does it have to be done another way?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

l2k-Shadow

Use BNCSUtil Hashing Library to get those values... a vb example source on how to use it is also on the site.

Quote(DWORD)       Number of keys in this packet

Number of keys? As in number of cdkeys, or how many numbers inside the cdkey, or what?

Yeah, number of cdkeys. 0x00000001 for STAR, SEXP, W2BN, D2DV, WAR3 and 0x00000002 for D2XP and W3XP.

Quote
For Spawn, can I just do:

.INSERTDWORD &H0  'Zero, boolean for false

Or does it have to be done another way?

that works :)
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.

Don Cullen

So, because I'll be only using one cdkey (it being Starcraft), I should just put down:

.InsertDWORD &H1 'only one cdkey, if two cdkeys, &H2

Right?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

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.

Don Cullen

Since this is a very sensitive packet to battle.net (high risk of ipban), is there a server I can test the bot on so I won't have to worry about ipban?

[Edit: added to avoid double post]

Oh and-- how do I know I've gotten IPBanned? Does Battle.net send a packet informing me of ipban before disconnecting?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

l2k-Shadow

No, it just disconnects you and when you attempt to connect again you'll receive winsock error 10053.
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.

Don Cullen

' Check server signature.
     If (UseNLS) Then
         ServerSignature = P.GetFixedString(128)
         If (Not nls_check_socket_signature(frmMain.WS.SocketHandle, ServerSignature)) Then
             Disconnect
             MsgBox "Server signature check failed.", vbExclamation, "Example Bot"
         End If
     End If


This section errored out-- says Sub/Function not defined. nls_check_socket_signature() was the one highlighted. I decided to do some checking around, and found out there was not only no sub/function for it which means it's in bncsutil.dll, but the declaration for it also was missing.

Do you by any perchance have the declaration for that particular sub?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

l2k-Shadow

#7
This DL has all of the current declerations.

BTW what packet buffer are you using?

EDIT: You know, you don't have to use that declare anyway...
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.

Don Cullen

I'm using Dark Minion's Packet Buffer class.

QuoteWhat's the "mpqNumber" argument in checkRevision? 
This is the number in the filename received in 0x50 (SID_AUTH_INFO) that looks like "IX86ver#.mpq".  You can get this number by using the extractMPQNumber function.

Why does the mpq number matter?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

shout

Quote from: Kyro on September 11, 2005, 10:42 PM
Why does the mpq number matter?

The MPQ number is which IX86Ver?.dll to emulate.

l2k-Shadow

Quote from: Shout on September 11, 2005, 10:45 PM
Quote from: Kyro on September 11, 2005, 10:42 PM
Why does the mpq number matter?

The MPQ number is which IX86Ver?.dll to emulate.

In more understandable words, Battle.net assigns you a .dll file with which to use CheckRevision(). There are 8 dlls and each has it's own unique checksum key. BNCSUtil, however, has all of these 8 checksum keys inside itself, so by the MPQ number, you're telling it which one to use.
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.

Don Cullen

Alright, got it. I'm curious about something:

    ' Check server signature.
    If (UseNLS) Then
        ServerSignature = P.GetFixedString(128)
        If (Not nls_check_socket_signature(frmMain.WS.SocketHandle, ServerSignature)) Then
            Disconnect
            MsgBox "Server signature check failed.", vbExclamation, "Example Bot"
        End If
    End If


Why check the server signature?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

l2k-Shadow

I think it's to make sure that the server is authentic bnet server, there is no use for it really.
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.

Don Cullen

'SID_AUTH_CHECK
Public Sub P0x51(ServerToken As Long, Ix86verfilename As String, ChecksumFormula As String)
    AddC vbMagenta, "Assembling 0x51 SID_AUTH_CHECK Packet..."
    Dim ClientToken As Long
    Dim EXEVersion As Long
    Dim EXEHash As Long
    Dim KeyLen As Long
    Dim CDKeyProductValue As Long
    Dim CDKeyPublicValue As Long
    Dim HashedKeyData As Long
    Dim EXEInformation As String
    Dim CDKeyOwnerName As String
    Dim EXEPath As String, DLLPath As String, ThirdPath As String
     
    EXEPath = ProgHashPath & ProgFileName
    DLLPath = ProgHashPath & DLLFileName
    ThirdPath = ProgHashPath & ThirdFileName
     
    ClientToken = GetTickCount()
    EXEVersion = getExeInfo(EXEPath, EXEInfo)
    mpqNumber = extractMPQNumber(Ix86verfilename)
         
    ' Perform revision check operations.
    If (checkRevision(ChecksumFormula, EXEPath, DLLPath, ThirdPath, mpqNumber, Checksum) = False) Then
        DMBot.BNET.Close
        Call DMBot.BNET_Close
        AddC vbRed, "CheckRevision failed."
        Exit Sub
    End If
     
    AddC vbMagenta, "Done."
    'Now data for the packet has been gathered,
    'begin assembling the packet
End Sub


How does that look so far? Any errors?
Regards,
Don
-------

Don't wonder why people suddenly are hostile when you treat them the way they shouldn't be- it's called 'Mutual Respect'.

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.