Im moving away from CSB type things now..
I know how to send packets (i have a packet buffer) and I know how to parse packets. I know the sequence to send to battle.net.. so what do I do?
Do I connect to BNLS first, send those packets, then reconnect to BNET? I'm utterly confused on what I am supposed to connect to / how it works. Ive searched the forums - no luck. Can anyone help me out here?
you can connect to either BNLS or BNet first. If you want BNLS to give you the verbyte .. connect to BNLS first, if you know the verbyte.. bnet is the way to go.
After you recieve 0x50, you send 0x09 to BNLS, Than depending on how many keys you have you send 0x01 or 0x0C to BNLS, than send 0x51.
Quote from: MindArchon on August 26, 2004, 02:43 AM
Im moving away from CSB type things now..
I know how to send packets (i have a packet buffer) and I know how to parse packets. I know the sequence to send to battle.net.. so what do I do?
Do I connect to BNLS first, send those packets, then reconnect to BNET? I'm utterly confused on what I am supposed to connect to / how it works. Ive searched the forums - no luck. Can anyone help me out here?
If you know the sequence then you shouldn't need BNLS. the packet buffer you have is from another bot? if so then it probably has a sendpacket function
Quote from: Gangz on August 26, 2004, 05:01 AM
If you know the sequence then you shouldn't need BNLS.
How do you figure? I know the sequence for connecting, but I still use BNLS.
There are other reasons for using BNLS other than the verByte, Hashes can be a pain for non-broadband users if they dont have the client. BNLS was created for a hashless connection, making your zip file for your bot alot smaller not needing hashes :D
Quote from: Gangz on August 26, 2004, 05:01 AM
If you know the sequence then you shouldn't need BNLS. the packet buffer you have is from another bot? if so then it probably has a sendpacket function
Let's all remember that, without Yobguls, all VB programmers would most likely be using BNLS unless Userloser or Maddox decided to make a Visual Basic Equivelant of SHA-1 in a DLL. But BNLS uses a much more efficient check revision according to Skywing, and I notice getting lower pings when using BNLS.
Ugh. I cant log into bnet docs. I think its my crappy internet connection. Ok maybe I thought I knew the sequence. After looking at BNLSProtocolSpec I thought that the packets were listed in the correct order to connect. I think i was wrong :-\
I want to use BNLS, as I know nothing about hashes
So, I connect to bnls.valhallalegends.com on port 9367.
BNLS sends me 0x50 which contains the version byte
I then send 0x09 which is a version check. After recieving it I send 0x01 with my cdkey. After recieiving that I send 0x51 with the data recieved from 0x01 and 0x09.
After that I am not sure, but I beleive I send my account info to 0x02, after recieving that I send 0x53, If its successful I send 0x03, then send 0x54, if thats successful I then send 0x0a which enters chat (I think this is on bnet docs but I cant check it since my internet sucks).
Can anyone tell me if I'm correct?
Also. Where do I put the server? Like useast.battle.net, or do I have to connect to that or something
You connect to bnls
send your BNLS product id ( 0x10 )
recieve verbyte ( 0x10 )
connect to bnet
send 0x50
send 0x09
send 0x01 or 0x0C depending on how many keys
Send 0x51
Quote from: BaDDBLooD on August 26, 2004, 03:39 PM
You connect to bnls
send your BNLS product id ( 0x10 )
recieve verbyte ( 0x10 )
connect to bnet
send 0x50
send 0x09
send 0x01 or 0x0C depending on how many keys
Send 0x51
Ahh. I see, so after sending 0x10 I would get the version byte.
I then disconnect from BNLS, and reconnect to BNET like on useast.battle.net. What port is BNET on?
So then I send 0x50, and I need the versionbyte from BNLS. After I send 0x09 which is the versioncheck. Then I send 0x01 which encrypts the cdkey. Then I send 0x51 which sends the cdkey data to BNET. Then I beleive I send all the account data like I said in the above post correct?
you stay connected to bnls, you never Disconnect after connecting.
port 6112
everything else is right
it can be 0x01 *OR* 0x0C depending on how many cdkey's you have ( 1 or 2 )
Quote from: BaDDBLooD on August 26, 2004, 04:00 PM
you stay connected to bnls, you never Disconnect after connecting.
port 6112
everything else is right
it can be 0x01 *OR* 0x0C depending on how many cdkey's you have ( 1 or 2 )
So then I have to open 2 connections? Time to learn VB Winsock :)
Is there a reason why you have to have BNLS open while connecting to BNET?
Quote from: MindArchon on August 26, 2004, 04:25 PMIs there a reason why you have to have BNLS open while connecting to BNET?
Yes. Battle.net will send you a versioning challenge, to which you must respond. You can't reliably predict in advance what the challenge will be, so you must get the challenge, pass it to BNLS, then pass the answer to BNCS. You could connect to BNLS before/during/after you connect to BNCS, but you can't avoid being connected to both of them if you want to have a decent chance at not failing vercheck due to stale info. :)
In what packet does BNET send you the challenge?
And with Visual Basic, is it better to put two winsock controls on the form, or just one and connect with the index or whatever (its in bnet reference)
i prefer 2 seperate winsock's
Quote from: MindArchon on August 26, 2004, 05:22 PM
In what packet does BNET send you the challenge?
And with Visual Basic, is it better to put two winsock controls on the form, or just one and connect with the index or whatever (its in bnet reference)
Probably doesn't matter (no big difference) if you add two separate controls to the form, or create an array of them.
2 controls, however, are a little easier to manage. And BNLS will automatically disconnect after about 30 seconds.
Quote from: R.a.B.B.i.T on August 26, 2004, 06:32 PM
And BNLS will automatically disconnect after about 30 seconds.
Unless you send BNLS_NULL (0x00) consistently. ;)
Quote from: MyndFyre on August 26, 2004, 06:33 PM
Quote from: R.a.B.B.i.T on August 26, 2004, 06:32 PM
And BNLS will automatically disconnect after about 30 seconds.
Unless you send BNLS_NULL (0x00) consistently. ;)
The document says 1 minute, not 30 seconds.
Bah, does the packetbuffer at http://www.valhallalegends.com/docs/PacketBuffer.htm work for BNLS packets too?
If so, then it doesnt seem to be working. I send something and get no data recieved back.
It does, however the "SEND PACKET" Function will not.
You need to Change it to +3, and it should be Length + packetID
Quote from: BaDDBLooD on August 27, 2004, 12:50 AM
It does, however the "SEND PACKET" Function will not.
You need to Change it to +3, and it should be Length + packetID
er..
Public Function SendPacket(SOCKET As Winsock, PacketID As Byte)
SOCKET.SendData Chr(&HFF)
SOCKET.SendData Chr(PacketID)
SOCKET.SendData MakeWORD (Len(Buffer) + 4)
SOCKET.SendData
BufferClear
End Function
was how it came.
So I change it to:
Public Function SendPacket(SOCKET As Winsock, PacketID As Byte)
SOCKET.SendData Chr(&HFF)
SOCKET.SendData Chr(PacketID)
SOCKET.SendData MakeWORD (Len(Buffer) + PacketID + 3)
BufferClear
End Function
?
The header is 3 bytes. The first part of the packet is a word, so you would want something like Makeword(len(Buffer)+3) then you would want to include the packetID which is a byte and the rest of the data to send.
I would suggest you getting a basic winsock connection source code. That will help you see how everything works and then you can just work off of that, If you never made a bot w/o an ocx then just getting a source is much easier then starting from scratch and getting 99% chance that the bot won't work
Quote from: MindArchon on August 27, 2004, 01:34 AM
Quote from: BaDDBLooD on August 27, 2004, 12:50 AM
It does, however the "SEND PACKET" Function will not.
You need to Change it to +3, and it should be Length + packetID
So I change it to:
Public Function SendPacket(SOCKET As Winsock, PacketID As Byte)
SOCKET.SendData Chr(&HFF)
SOCKET.SendData Chr(PacketID)
SOCKET.SendData MakeWORD (Len(Buffer) + PacketID + 3)
BufferClear
End Function
?
Errr, no that isn't correct I don't think. This is mine
Public Function SendBNLS(socket As Winsock, PacketID As Byte)
'//
'(WORD) Message size, including this 3-byte header
'(BYTE) Message ID
'(....) Message-dependant data
socket.SendData MakeWORD(Len(Buffer) + 3)
socket.SendData Chr(PacketID)
socket.SendData Buffer
Clear
End Function
Quote from: bethra on August 27, 2004, 03:05 PM
Errr, no that isn't correct I don't think. This is mine
I think he was talking about his BNCS packet buffer, not BNLS one.
Quote from: UserLoser. on August 27, 2004, 03:07 PM
Quote from: bethra on August 27, 2004, 03:05 PM
Errr, no that isn't correct I don't think. This is mine
I think he was talking about his BNCS packet buffer, not BNLS one.
Quote from: MindArchon on August 26, 2004, 10:25 PM
Bah, does the packetbuffer at http://www.valhallalegends.com/docs/PacketBuffer.htm work for BNLS packets too?
If so, then it doesnt seem to be working. I send something and get no data recieved back.
hmmm I dunno, maybe I'm wrong... he said this so I thought maybe he was talking about BNLS =\
Quote from: UserLoser. on August 27, 2004, 03:07 PM
Quote from: bethra on August 27, 2004, 03:05 PM
Errr, no that isn't correct I don't think. This is mine
I think he was talking about his BNCS packet buffer, not BNLS one.
BNLS packet buffer. However will that packet buffer I linked to previously work on BNCS packets without tweaking?
Quote from: MindArchon on August 27, 2004, 03:23 PM
Quote from: UserLoser. on August 27, 2004, 03:07 PM
Quote from: bethra on August 27, 2004, 03:05 PM
Errr, no that isn't correct I don't think. This is mine
I think he was talking about his BNCS packet buffer, not BNLS one.
BNLS packet buffer. However will that packet buffer I linked to previously work on BNCS packets without tweaking?
Read Over the posts, Figure it out for yourself. It's pretty easy if you just Concentrate!
This one I use to send a BNCS packet buffer. It is the one that is already in the DarkMinion's Packet buffer class
Public Function SendBNCS(socket As Winsock, PacketID As Byte)
socket.SendData Chr(&HFF)
socket.SendData Chr(PacketID)
socket.SendData MakeWORD(Len(Buffer) + 4)
socket.SendData Buffer
Clear
End Function
This one I used to send a BNLS packet buffer.
Public Function SendBNLS(socket As Winsock, PacketID As Byte)
'//
'(WORD) Message size, including this 3-byte header
'(BYTE) Message ID
'(....) Message-dependant data
socket.SendData MakeWORD(Len(Buffer) + 3)
socket.SendData Chr(PacketID)
socket.SendData Buffer
Clear
End Function
Quote from: bethra on August 27, 2004, 03:39 PM
This one I use to send a BNCS packet buffer. It is the one that is already in the DarkMinion's Packet buffer class
Public Function SendBNCS(socket As Winsock, PacketID As Byte)
socket.SendData Chr(&HFF)
socket.SendData Chr(PacketID)
socket.SendData MakeWORD(Len(Buffer) + 4)
socket.SendData Buffer
Clear
End Function
This one I used to send a BNLS packet buffer.
Public Function SendBNLS(socket As Winsock, PacketID As Byte)
'//
'(WORD) Message size, including this 3-byte header
'(BYTE) Message ID
'(....) Message-dependant data
socket.SendData MakeWORD(Len(Buffer) + 3)
socket.SendData Chr(PacketID)
socket.SendData Buffer
Clear
End Function
Its ok bethra, I figured out how to do it on my own. Great, I think I have everything I need. Time to attempt to make my first winsocket bot!
Congradulations! =)
wait, heh while here
is mine correct?
Public Function SendBNLS(socket As Winsock, PacketID As Byte)
'//
'(WORD) Message size, including this 3-byte header
'(BYTE) Message ID
'(....) Message-dependant data
socket.SendData MakeWORD(Len(Buffer) + 3)
socket.SendData Chr(PacketID)
socket.SendData Buffer
Clear
End Function
Sometimes when I send with it tehre is no problem. but soemtimes I get a runtime error
Quote
Run-time error '40006':
Wring Protocol or connection state for the requested transaction or request
Dunno, it works sometimes when I try to send data to BNLS but then sometimes it displays this run-time error.
huh?
That means that the socket was closed, and you tried to send data on it.
You should check if the socket is connected (ie, State is vbStateConnected or whatever) before trying to write to it.
Heres what I use for bnls packetsend...
Public Function SendBNLSPacket(PacketID As Byte)
On Error Resume Next
If frmMain.sckBNLS.State <> 0 Then
frmMain.sckBNLS.SendData MakeWORD(Len(Buffer) + 3) & Chr(PacketID) & Buffer
Clear
End if
End Function
Edit:
Why would you need to specify which socket you use? Why would you need more then one for bnls?
On Error Resume Next isn't very good. Ignoring a problem will usually cause more problems in the end.
Public Function SendBNLSPacket(PacketID As Byte)
If frmMain.sckBNLS.State <> 8 Then
frmMain.sckBNLS.SendData MakeWORD(Len(Buffer) + 3) & Chr(PacketID) & Buffer
Clear
End if
End Function
Public Function SendBNLSPacket(PacketID As Byte)
If frmMain.sckBNLS.State = sckConnected Then
frmMain.sckBNLS.SendData MakeWORD(Len(Buffer) + 3) & Chr(PacketID) & Buffer
Clear
End if
End Function
This way, you will be 100% sure you are connected so you won't crash your bot when it thinks it's alright to send.
So, ive connected to BNLS and got the versionbyte. Ive read on these forums, the first thing you send to bnet after connection is 0x01? I dont get the format for it.
This is what it says on bnet docs
(DWORD[16]) MCP Startup Data
(STRING) Battle.net Unique Name
Whats a MCP Startup Data, and whats "Battle.net Unique Name?"
Those r apart of a different login. That is for 0x01 MCP (Also known as Diablo 2 realms) You want to look for BNCS not MCP
Quote from: DueL on August 28, 2004, 01:39 AM
Those r apart of a different login. That is for 0x01 MCP (Also known as Diablo 2 realms) You want to look for BNCS not MCP
Hmm, im not really sure about this..
So i send 0x01 which means I want to be able to join games. Is there anything in this packet?
Quote from: MindArchon on August 28, 2004, 01:53 AM
Hmm, im not really sure about this..
So i send 0x01 which means I want to be able to join games. Is there anything in this packet?
0x01 is not an official BNET Packet.
you would use
Winsock.SendData Chr(1)
Quote from: BaDDBLooD on August 28, 2004, 02:04 AM
you would use
Winsock.SendData Chr(1)
Why do you have to send this. What does it actually do?
Quote from: MindArchon on August 28, 2004, 02:54 AMWhy do you have to send this. What does it actually do?
It identifies that you want to be a game client, not a {file transfer, chat} client or battle.net server.
How the little thing's make such a big difference.
Its just like setting up your profile on a dating site. If you say your a girl, your gonna get guys(hopefully) messaging you, and vice versa.
So what your saying is I should put "Winsock.SendData Chr(1)" as my title ;)
Weird, since BNLS is unreachable and I cant test my bot so far, I'd thought I'd look at someone elses source code (just to see if im doing it right). However his 0x50 packet is different from mine. Heres his 0x50 packet.
DWORD &H0
NonNTString "68XI" & Prod
DWORD verbyte
DWORD &H0
DWORD &H0
DWORD &H480
DWORD &H1033
DWORD &H1033
NTString "USA"
NTString "United States"
Mine seems different then his. Here's mine:
DWORD &H0
DWORD IX68
DWORD SEXP
DWORD versionbyte
DWORD &H0
DWORD &H0
DWORD &H0
DWORD &H0
DWORD &H0
NTString "CAN"
NTString "Canada"
Which ones correct?
I am betting both will pass 0x50. Yours looks to be more .. correct .. in terms of what is inserted where. His NTString "68XI" & Product is just being a cheater.
Why is his IX68 reversed?
Quote from: MindArchon on August 28, 2004, 04:13 PMWhy is his IX68 reversed?
Intel chips are little endian.
so I dont have to reverse the product like in Cupheads ocx or Chronics ocx?
The packet above will work just fine?
Quote from: MindArchon on August 28, 2004, 04:32 PM
so I dont have to reverse the product like in Cupheads ocx or Chronics ocx?
The packet above will work just fine?
DWORD SEXP will reverse the the product and make it PXES. So no, you are wrong.
When battle.net sends 0x25, if you ignore it you get a -1 ping, and if you send the timestamp back you get a regular ping.
What does this mean?
"The ping displayed when in chat can be artificially inflated by delaying before sending this packet."
It gets larger? How do you get a 0 ms ping. Do you just send 0?
It keeps sending me 0x25 after I respond to it every 10 - 15 seconds. Is this normal?
If you ignore 0x25 and reply with nothing, than you will get 0 ping.
However, I replied to it, and it keeps sending 0x25 over and over, and I keep responding over and over. Do i need to send the next packet to get it stop sending it?
It does that, so bnet can monitor your latency, and your connection.
OK, ill guess ill keep replying.
on the 0x50 return, for NLS revision it returned 0, and on BNLSProtocolSpec it says
QuoteIf this is zero, the Old Logon System messages (not documented here) will be used.
Anyone know what this is / how to use it?
I got it, I just skipped that and went to 0x09.
Im confused, what do I put for Checksum formula. What is it/what does it do?
Quote from: MindArchon on August 29, 2004, 03:06 PM
I got it, I just skipped that and went to 0x09.
Im confused, what do I put for Checksum formula. What is it/what does it do?
Look on the protocol spec, read it more carefully the checksum is extracted when you recieve 0x50, It tells you that.
Ok i just started working on packets and winsocket, and dont want to open a new thread, so here's my question to the class packet buffer from DarkMinion-vL:
I get:
Compile error:
Constants, fixed-length strings, arrays, user-defined types and declare statements not allowed as public members of object modules.
that means that i cant place it at the top of the class, but thats exactly the point where it has to be ?! where should i place it then??
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal numBytes As Long)
Im really stumped. Whenever I send 0x09 to BNLS it returns false. Heres what Im sending.
AddDWORD &H2
AddDWORD &H1
AddNTString checksum
It keeps returning false. checksum as a string vairable where I write the checksum data returned from 0x50.
Anyone know why its not working?
Quote from: DarkSoldier on August 29, 2004, 04:10 PM
Ok i just started working on packets and winsocket, and dont want to open a new thread, so here's my question to the class packet buffer from DarkMinion-vL:
I get:
Compile error:
Constants, fixed-length strings, arrays, user-defined types and declare statements not allowed as public members of object modules.
that means that i cant place it at the top of the class, but thats exactly the point where it has to be ?! where should i place it then??
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal numBytes As Long)
Try puttting the API Declare in a declare module, it makes your code cleaner.
Quote from: DarkSoldier on August 29, 2004, 04:10 PMCompile error:
Constants, fixed-length strings, arrays, user-defined types and declare statements not allowed as public members of object modules.
that means that i cant place it at the top of the class, but thats exactly the point where it has to be ?! where should i place it then??
If you're not using CopyMemory anywhere else, just change "Declare Sub" to "Private Declare Sub".
Quote from: MindArchon on August 28, 2004, 04:01 PM
Weird, since BNLS is unreachable and I cant test my bot so far, I'd thought I'd look at someone elses source code (just to see if im doing it right). However his 0x50 packet is different from mine. Heres his 0x50 packet.
DWORD &H0
NonNTString "68XI" & Prod
DWORD verbyte
DWORD &H0
DWORD &H0
DWORD &H480
DWORD &H1033
DWORD &H1033
NTString "USA"
NTString "United States"
Mine seems different then his. Here's mine:
DWORD &H0
DWORD IX68
DWORD SEXP
DWORD versionbyte
DWORD &H0
DWORD &H0
DWORD &H0
DWORD &H0
DWORD &H0
NTString "CAN"
NTString "Canada"
Which ones correct?
Your 0x50 will not work, because you send IX68 as the platform ID, when you should be sending IX86. Just another small detail :P