Valhalla Legends Forums Archive | Battle.net Bot Development | What do i do next?

AuthorMessageTime
BaDDBLooD
Some of you may have seen my earlier post about that BNLS connection.

I Finally got a Connection to BNLS Server, Sent my Username/Password. Also got a Response saying that they were accepted.

What do i do next on my way to Connecting to bnet?
March 5, 2004, 5:07 AM
DaRk-FeAnOr
Download CleanSlateBot.ocx from www.valhallalegends.com/cuphead and read the documentation on how to use it.
This is assuming that you already know Visual Basic.
March 5, 2004, 12:53 PM
CrAz3D
[quote author=BaDDBLooD link=board=17;threadid=5609;start=0#msg47640 date=1078493844]
i don't want to use Cleanslate bot...

i have WinsockBNLS, made a Connection to BNLS server. Sent the ID/PASS to the bnls server, and got a response back.

What's the next step in Connecting to BNET?
[/quote]

Make a winsock for BNET & do:
[code]
winsockBNET.connect, SERVER (which is w/e), 6112
[/code]

& then, upon the winsockBNET connecting, send x50 (basically location packet).
After this parse, or seperate, the data the battle.net sends back to you in the winsockBNET_DataArrival
March 5, 2004, 3:16 PM
Myndfyr
[quote author=DaRk-FeAnOr link=board=17;threadid=5609;start=0#msg47649 date=1078496621]
Shut up assbag. Check out http://www.valhallalegends.com/yoni/stuff/BNLSProtocolSpec.asp
[/quote]

Don't be an ass. If he bothers you that much just ignore him. Damn.
March 5, 2004, 5:18 PM
LoRd
[quote author=BaDDBLooD link=board=17;threadid=5609;start=0#msg47704 date=1078511087]
Please help me... What do i Send / Recieve next in My Login Sequence?
[/quote]

http://bnetdocs.valhallalegends.com/sequence.php

After logging into BNLS, the only purpose it serves is replacing the functions that are called in BnetAuth.dll along with the functions required for Warcraft III logon.

As I pointed out in your other post, if you don't understand BnetDocs, you probably won't understand the majority of this. You should either study up on socket programming and packet creation/retrieval or use CleanSlateBot.
March 5, 2004, 6:47 PM
hismajesty
[quote author=Myndfyre link=board=17;threadid=5609;start=0#msg47689 date=1078507115]
[quote author=DaRk-FeAnOr link=board=17;threadid=5609;start=0#msg47649 date=1078496621]
Shut up assbag. Check out http://www.valhallalegends.com/yoni/stuff/BNLSProtocolSpec.asp
[/quote]

Don't be an ass. If he bothers you that much just ignore him. Damn.
[/quote]

He can't help being an ass; however, it WAS uncalled for.
March 5, 2004, 8:10 PM
ChR0NiC
[quote author=BaDDBLooD link=board=17;threadid=5609;start=0#msg47602 date=1078463257]
Some of you may have seen my earlier post about that BNLS connection.

I Finally got a Connection to BNLS Server, Sent my Username/Password. Also got a Response saying that they were accepted.

What do i do next on my way to Connecting to bnet?
[/quote]

Well....next what you gotta do is tell BNLS what product you wish to use by doing this......

[code]
Case &HF
with Buffer
.InsertDWORD GetBNLSByte()
.SendBNLSPacket frmMain.sckBNLS, &H10
End With
[/code]

[code]
Public Function GetBNLSByte() As Long
Select Case varProduct
Case "RATS"
GetBNLSByte = &H1
Case "PXES"
GetBNLSByte = &H2
Case "NB2W"
GetBNLSByte = &H3
Case "VD2D"
GetBNLSByte = &H4
Case "PX2D"
GetBNLSByte = &H5
Case Else
AddChat vbRed, "Invalid Client version! Setting version as Starcraft!"
GetBNLSByte = &H1
End Select
End Function
[/code]

Anyways, that's what I use when receiving 0xF from BNLS......

Edit: This I believe is optional, you are only doing this I BELIEVE in which to request the verbyte in the response to 0x10, but it is a good thing to use, at least in my opinion

[code]
Case &H10
VerByte = GetDWORD(Mid(Data, 8, 4))
WinSockBNET.Close
WinSockBNET.Connect varServer, 6112
[/code]

This is where you obtain the verbyte from BNLS, but you can use your own built in verbyte, you can get the current verbytes at BNET Docs.....(But I like getting the verbyte from BNLS because SkyWing usually figures out when a verbyte is changed before I do.)
March 5, 2004, 11:56 PM
Myndfyr
Here's what I suggest:

Get EternalChat or StealthBot, and then Ethereal or BNCSMon. Monitor your BNCS+BNLS connections from there, and watch the order of packets sent to and from each BNCS and BNLS.

If you're using ethereal, the filter I use is:

port 6112 or port 9367

That way, you can see which packet it being sent when, and what data it has to have before sending. This info is SOMEWHAT contained in the BNLS docs, but if you do it this way, you get a really good idea of what's going on. That's how I did.
March 6, 2004, 7:08 AM
ChR0NiC
[quote author=BaDDBLooD link=board=17;threadid=5609;start=0#msg47843 date=1078545243]
that's what i needed.. Thanks
[/quote]

Just for people who do not know what to do next, usually when starting your connection to BNET, the first thing you do is send 0x50....

And glad I could be of help BaddBlood. :)
March 6, 2004, 7:35 PM
UserLoser.
[quote author=ChR0NiC link=board=17;threadid=5609;start=0#msg47913 date=1078601752]
[quote author=BaDDBLooD link=board=17;threadid=5609;start=0#msg47843 date=1078545243]
that's what i needed.. Thanks
[/quote]

Just for people who do not know what to do next, usually when starting your connection to BNET, the first thing you do is send 0x50....

And glad I could be of help BaddBlood. :)
[/quote]

The first thing you do is tell the server what type of client you are (1: Game client, 2: FTP, 3: Chat)
March 6, 2004, 8:03 PM
ChR0NiC
[quote author=UserLoser. link=board=17;threadid=5609;start=0#msg47915 date=1078603398]
The first thing you do is tell the server what type of client you are (1: Game client, 2: FTP, 3: Chat)
[/quote]

I assumed he knew that o.O
March 6, 2004, 8:59 PM
ChR0NiC
[quote author=BaDDBLooD link=board=17;threadid=5609;start=15#msg47925 date=1078610218]
k, What do i send to Tell Bnet what i am using, game, chat, or ftp?

And can i get a "Layout" for 0x50.. BNETDOC's Doesn't explain it very well, in my opinion that is...
[/quote]

Form1.WinsockBNET.SendData Chr(1) is using Game, I have not done Chat or FTP, but I am guessing they are similar.

0x50 is quite simple, but I won't do it for you.

(DWORD)       Protocol ID (0)
(DWORD)       Platform ID
(DWORD)       Program ID
(DWORD)       Version Byte
(DWORD)       Product language
(DWORD)       Local IP for NAT compatibility*
(DWORD)       Time zone bias*
(DWORD)       Locale ID*
(DWORD)       Language ID*
(STRING)       Country abreviation
(STRING)       Country

I can TRY walk you through this.....

BNET's protocol ID = SID_NULL or in VB terms &H0
Platform ID = A DWORD specifying the client's platform (Macintosh, PC, etc). "6X8I" is usually used for this and the Program ID is your product EG: "PXES"
Version Byte = the verbyte which you retrieved from BNLS using a DWORD.
Product language = can be ignored by using SID_NULL (&H0)
Local IP for NAT compatibility* = can be ignored by using SID_NULL (&H0
Time zone bias* = can be ignored by using SID_NULL (&H0)
Locale ID* = can be ignored by using SID_NULL (&H0)
Language ID* = can be ignored by using SID_NULL (&H0)
Country abreviation = "USA" or the country of your choice's abbreviated
Country = "United States" or the country of your choice.
Then of course you once you combine all the data together you send it with the Packet ID of 0x50.
Buffer.SendPacket &H50

well.....I said I wouldn't do it for you, but it looks like I pretty much did lol....
There are ways to to do Time Zone, Locale ID, Language ID and other ones, but since you are just trying to get connected there is no use on trying to figure those out until you learn more.
March 6, 2004, 10:10 PM
ChR0NiC
[quote author=BaDDBLooD link=board=17;threadid=5609;start=15#msg47937 date=1078612063]
ok.. doing good.

What does (STRING) Mean, and Which String do i use? There is like 5 in the Packetbuffer..

if you could explain what each does, and when to use them, that'd be Great!
[/quote]

Well for Country Abbrev and Country, you gotta use Null Terminated Strings.
should be in your packetbuffer under InsertNTString

A Null Terminated String is a string that is terminated (ended) with a null character. EG: vbNullChar aka Chr(0)
March 6, 2004, 10:39 PM
ChR0NiC
Wait for your responses then act of them.
Next you will receive 0x25 and then followed by 0x50.
You usually respond to 0x25 but it is not ESSENTIAL to respond to it.
You respond to 0x50 by sending 0x51, which is usually extremely hard but BNLS makes it pretty easy to do for you. I want you to figure out 0x25 (if you choose to do it) on your own.
March 6, 2004, 10:50 PM
ChR0NiC
[code]
Public Sub ParseBNET(Data As String)
Select Case Asc(Mid(Data, 2, 1))
Case &H50
End Select
[/code]

Just to make a little correction
March 6, 2004, 10:56 PM
ChR0NiC
[quote author=BaDDBLooD link=board=17;threadid=5609;start=15#msg47957 date=1078614101]
nm, i don't send 0x25

So i don't NEED to Respond to 0x25, but i need to Recieve it?
[/quote]

Well once you send 0x50, you will first receive 0x25 then 0x50.
It is not essential to respond to 0x25 but you always receive it whether you like it or not. It is essential to respond to 0x50 otherwise you won't connect.

Instead of making....2nd posts just edit your post please....

Perhaps we should talk on AIM or MSN because this is filling up the forum and I'm sure it would be appreciated if we kept this off the forums, because I am basically holding your hand through the BNET connection.
March 6, 2004, 11:03 PM
LoRd
[quote author=BaDDBLooD link=board=17;threadid=5609;start=15#msg48001 date=1078626612]
Forum admin's, you can Remove this topic now ;p
[/quote]

Admin's don't delete topics that could provide someone with help later on, but since not many people know how to use or even where to find the 'Search' button, it won't help much in a month or so.
March 7, 2004, 2:36 AM
ChR0NiC
No offense to badd blood, but it seems like he is on purposely posting alot of replies instead of editing on purpose in order to increase his number of posts. Well, not that I even give a !@$&, but it's something I noticed. ;D
March 7, 2004, 3:19 AM
UserLoser.
[quote author=ChR0NiC link=board=17;threadid=5609;start=0#msg47932 date=1078611042]
[quote author=BaDDBLooD link=board=17;threadid=5609;start=15#msg47925 date=1078610218]
k, What do i send to Tell Bnet what i am using, game, chat, or ftp?

And can i get a "Layout" for 0x50.. BNETDOC's Doesn't explain it very well, in my opinion that is...
[/quote]

Form1.WinsockBNET.SendData Chr(1) is using Game, I have not done Chat or FTP, but I am guessing they are similar.

0x50 is quite simple, but I won't do it for you.

(DWORD)       Protocol ID (0)
(DWORD)       Platform ID
(DWORD)       Program ID
(DWORD)       Version Byte
(DWORD)       Product language
(DWORD)       Local IP for NAT compatibility*
(DWORD)       Time zone bias*
(DWORD)       Locale ID*
(DWORD)       Language ID*
(STRING)       Country abreviation
(STRING)       Country

I can TRY walk you through this.....

BNET's protocol ID = SID_NULL or in VB terms &H0
Platform ID = A DWORD specifying the client's platform (Macintosh, PC, etc). "6X8I" is usually used for this and the Program ID is your product EG: "PXES"
Version Byte = the verbyte which you retrieved from BNLS using a DWORD.
Product language = can be ignored by using SID_NULL (&H0)
Local IP for NAT compatibility* = can be ignored by using SID_NULL (&H0
Time zone bias* = can be ignored by using SID_NULL (&H0)
Locale ID* = can be ignored by using SID_NULL (&H0)
Language ID* = can be ignored by using SID_NULL (&H0)
Country abreviation = "USA" or the country of your choice's abbreviated
Country = "United States" or the country of your choice.
Then of course you once you combine all the data together you send it with the Packet ID of 0x50.
Buffer.SendPacket &H50

well.....I said I wouldn't do it for you, but it looks like I pretty much did lol....
There are ways to to do Time Zone, Locale ID, Language ID and other ones, but since you are just trying to get connected there is no use on trying to figure those out until you learn more.
[/quote]

You seem to be confused on what exactly SID_NULL is
March 7, 2004, 4:53 AM
Adron
SID_NULL is obviously a different version of the C/C++ NULL value, suitable for use in battle.net applications. You have to use the right one always.
March 7, 2004, 1:29 PM
BaDDBLooD
Yeah... now i have a new problem

Parse BNET:

[code]

Public Sub ParseBNET(data As String)

Dim PacketID As String
PacketID = Asc(Mid(data, 2, 1))

Select Case PacketID

Case &H25
With buffer
.InsertNonNTString Mid(data, 5, 4)
.SendPacket &H25
End With

Case &H50
Servers = Val("&h" & StrToHex(StrReverse(Mid(data, 9, 4))))
MPQName = Mid(data, 25, 12)
ExeHash = Mid(data, 38, Len(data) - 2)
MPQName2 = Val(Mid(MPQName, 8, 1))
With buffer
.InsertDWORD GetBNLSByte()
.InsertDWORD CLng(MPQName2)
.InsertNTString ExeHash
.SendBNLSPacket &H9
End With

Case &H51
Select Case GetWORD(Mid(data, 5, 2))

Case &H0
AddChat vbGreen, "BNET: ", vbYellow, "Version and CDKeys Passed."

Case &H101
AddChat vbRed, "BNET: ", vbYellow, "Incorrect Game Version."

Case &H200
AddChat vbRed, "BNET: ", vbYellow, "Incorrect Cdkey(s)"

Case &H100
AddChat vbRed, "BNET: ", vbYellow, "Incorrect Game Version"

Case &H203
AddChat vbRed, "BNET: ", vbYellow, "Incorrect Cdkey for this product."

Case &H202
AddChat vbRed, "BNET: ", vbYellow, "Current Cdkey is banned from battle.net"

Case &H201
AddChat vbYellow, "BNET: ", vbYellow, "Current cdkey is in use by: " & Mid(data, 9, Len(data) - 9)

End Select

End Select

End Sub

[/code]

PACKET: 0x50

[code]

Public Sub Packet0x50()

With buffer
.InsertDWORD &H0
.InsertNonNTString "68XI" & Product()
.InsertDWORD VerByte
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertDWORD &H0
.InsertNTString "USA"
.InsertNTString "United States"
.SendPacket &H50
End With

AddChat vbGreen, "BNET: Sent Packet: 0x50!"

End Sub

[/code]

PACKET: 0x51

[code]

Public Sub Packet0x51()

AddChat vbGreen, "BNET: ", vbYellow, "Sending.. Cdkey, Checksum, Version..."

With buffer
.InsertDWORD Token
.InsertDWORD ExeVersion
.InsertDWORD ExeChecksum
.InsertDWORD &H1
.InsertDWORD &H0
.InsertNonNTString CdkeyHash
.InsertNTString ExeInfo
.InsertNTString BnetBot.Username
.SendPacket &H51
End With

AddChat vbGreen, "BNET: Sent Packet: 0x51"

End Sub

[/code]

Parse BNLS:

[code]

Public Sub ParseBNLS(data As String)

Select Case Asc(Mid(data, 3, 1))

Case &HE
AddChat vbYellow, "BNLS: Sending Authorization"
Dim key As Long, key2 As Long
key2 = GetDWORD(Mid(data, 4, 4))
key = BNLSChecksum("Secret", key2)
With buffer
.InsertDWORD key
.SendBNLSPacket &HF
End With

Case &HF
AddChat vbGreen, "BNLS: Autorization Accepted"
With buffer
.InsertDWORD GetBNLSByte()
.SendBNLSPacket &H10
End With

Case &H10
VerByte = GetDWORD(Mid(data, 8, 4))
Main.WinsockBNET.Close
Main.WinsockBNET.Connect BnetBot.Server, 6112
AddChat vbYellow, "BNET: Connecting To Server: " & BnetBot.Server & ":6112"

Case &H9
ExeVersion = Val("&H" & StrToHex(StrReverse(Mid(data, 8, 4))))
ExeVersion = CLng(ExeVersion)
ExeChecksum = Val("&H" & StrToHex(StrReverse(Mid(data, 12, 4))))
ExeChecksum = CLng(Checksum)
ExeInfo = Mid(data, 16, Len(data) - 16)
With buffer
.InsertDWORD Servers
.InsertNTString BnetBot.Cdkey
.SendBNLSPacket &H1
End With

Case &H1
CdkeyHash = Mid(data, 12)
Token = Val("&H" & StrToHex(StrReverse(Mid(data, 8, 4))))
Token = CLng(Token)
Packet0x51

End Select

End Sub

[/code]

DECLARES:

[code]

Public buffer As New PacketBuffer
Public Version As String
Public VarProduct As String
Public VerByte As Long
Public MPQName As String
Public MPQName2 As Long
Public ExeInfo As String
Public ExeVersion As Long
Public ExeHash As String
Public Token As Long
Public Servers As Long
Public ExeChecksum As Long
Public CdkeyHash As String

[/code]

[code]

Public Type BotData
Username As String
Password As String
HomeChannel As String
Cdkey As String
Server As String
BNLSServer As String
Product As String
End Type
Public BnetBot As BotData

[/code]

I Get a Invalid Game Version Response from 0x51... not sure what is wrong!



March 7, 2004, 3:09 PM
Myndfyr
What are you sending as the game version, and for which product?
March 7, 2004, 8:48 PM
BaDDBLooD
i am sending RATS, for starcraft..

[code]

Private Function Product() As String

Select Case BnetBot.Product

Case "0"
Product = "RATS"
Case "1"
Product = "PXES"
Case "2"
Product = "NB2W"
Case "3"
Product = "VD2D"
Case "4"
Product = "PX2D"
Case "5"
Product = "3RAW"
End Select

End Function

[/code]

[code]

Public Function GetBNLSByte() As Long
Select Case BnetBot.Product
Case "0"
GetBNLSByte = &H1
Case "1"
GetBNLSByte = &H2
Case "2"
GetBNLSByte = &H3
Case "3"
GetBNLSByte = &H4
Case "4"
GetBNLSByte = &H5
Case "5"
GetBNLSByte = &H7
Case Else
AddChat vbRed, "Invalid Client version! Setting version as Starcraft!"
GetBNLSByte = &H1
End Select
End Function

[/code]
March 7, 2004, 8:57 PM

Search