hi!
(sorry if this is the wrong place for what i am posting.. i am coding c only thats why i post here)
i am looking for information about the starcraft in-game protocol, like packets that move units, packets that make buildings, packets that change mineral count etc.
if anyone has any information, i'd greatly appreciate that.
(i have been sniffing a long time now, and its getting on my nerves)
thanks in advance,
aton
what i have so far is at http://aton.skillzenmasse.de/packet.txt
it might be wrong, i will update it constantly. please tell me if you have any idea/data thats more correct than mine.
Quote
player string '\0'
| |
0030 00 00 00 00 55 72 7A 61 68 69 6C 00 50 58 45 53 ....Urzahil.PXES
|- these are probably version info etc.
0040 20 30 20 30 20 31 20 30 20 30 20 30 20 30 20 30 0 0 1 0 0 0 0 0
"SEXP" starcraft expansion
| '\0'
| |
0050 20 50 58 45 53 00 PXES.
That's just their battle.net account name and their statstring. Statstring contains what product they're using, wins, rating, rank, high rank, rating, high rating, spawn, icon etc.
Edit: eww at bnetd stuff at bottom
do you know what field means what exactly? i think i can find out the wins/losses but not the icon for example
Quote from: aton on May 01, 2005, 04:28 PM
do you know what field means what exactly? i think i can find out the wins/losses but not the icon for example
Icon is last part, in this case, 'SEXP'.
Document on user statstrings (http://bnetdocs.valhallalegends.com/content.php?Section=d&id=16)
thanks, i updated the file.
you dont have any information on "click" packets (or do i better call them "movement" packets?), have you?
as i understand only the player actions are transmitted over the net, i.e. when a player moves a unit, or builds a building, correct?
edit: btw has anyone got an outline of how the udp checksum is created? i am into linux and cannot really debug in windows very well... just a description of the algorithm would be sufficient, i'd write my own routine...
your first ?.?.? in the statstring = the persons ladder rank it will only show up if they are ranked on the list eg. #1 - #1000.
Only player actions are transmitted yes. Say, when a player queues up a building or unit to be built.
The udp checksum is something like a loop summing the packet. The data in the packet is summed into one accumulator, and that accumulator is summed into another one.
so each byte is summed together? i.e. longer packets -> bigger checksum? sounds too easy for my taste ;)
do you have the assembly routine for it?
I've got the VB6 code here, which I ported from C++ with Pianka (that code I can't find, but is on the forums somewhere). It should be easy enough to port it back if you can't find the original code.
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(ByRef Destination As Any, ByRef Source As Any, ByVal numBytes As Long)
Private Function UDPChecksum(ByRef bufa As String) As Single
Dim subsum As Double
Dim A As Double
Dim B As Single
Dim buf As Long
buf = MakeLong(bufa)
subsum = SubChecksum(buf + 2, buf - 1)
A = &HFF - ((subsum And &HFF) + (subsum Xor 8)) Mod &HFF
B = CSng(((&HFF - (A + (ShiftRight(subsum, 8))) Mod &HFF) And &HFF) Or (ShiftLeft(A, 8)))
UDPChecksum = B
End Function
Private Function SubChecksum(ByRef buf As Long, length As Long) As Currency
Dim sum1 As Double
Dim sum2 As Double
Dim p As Long
sum1 = sum2 = 0
p = buf And (length - 1)
While length - 1 > 0
sum2 = sum2 + p
p = p - 1
If sum2 > &HFF Then sum2 = sum2 - &HFF
sum1 = sum1 + sum2
length = length - 1
Wend
SubChecksum = ((sum2 And &HFF) Xor 8) Or ((sum1 Mod &HFF) And &HFF)
End Function
Private Sub Form_Load()
Debug.Print UDPChecksum(1234)
End Sub
Public Function ShiftRight(ByVal A As Long, ByVal L As Long) As Double
ShiftRight = CDbl(A / (2 ^ L))
End Function
Public Function ShiftLeft(ByVal A As Long, ByVal L As Long) As Double
ShiftLeft = CDbl(A * (2 ^ L))
End Function
Private Function MakeLong(str As String) As Long
CopyMemory MakeLong, ByVal str, Len(str)
End Function
Does your VB6 code work?
Quote from: Adron on May 02, 2005, 12:20 PM
Does your VB6 code work?
It looks as if it was just ported from your NBBot :p
It was ported from some C++ code that someone asked about (if there was an equivolent of in VB6). Nobody knew about any so that's why Pianka and I ported it. Where ever the original code came from, I don't know, is where it was ported from. So, maybe.
cool thanks, i will port that back to c, i think i gotta fresh up my vb a bit, has been quite a while...
I think I was able to get into the pregame room, but that was it.
Quote from: LoRd[nK] on May 02, 2005, 02:39 PM
Quote from: Adron on May 02, 2005, 12:20 PM
Does your VB6 code work?
It looks as if it was just ported from your NBBot :p
The reason I asked was it looked like an inaccurate nonworking port from NBBot :p
ok i will begin with writing a bot to login and get game listings etc. there should be enough info for that on the bnet docs
after that i will do some more years of sniffing ;)
btw i heard iago is doing some linux stuff... so iago how do you logon to b.net? have you written the hashing functions yourself or have you managed to use a .dll somehow? i cannot think of any way that could be done..
Was he using Java?
it is more than possible to log onto battle.net with linux...
http://newds.zefga.net <- *poke*
http://www.javaop.com <- *poke*
Just avoid languages that are platform specific (Visual Basic, Basic, etc) and avoid any portions of the language, such as API calls, that would restrict it to a single operating system. Both of the above links are links to open source bots, so if you are interested in how to connect to battle.net using *nix, take a look if it suits you.
ok solved it, thanks
now the problem is the udp checksum. does anyone have it in c/c++ ?
Please stop double posting.
This is his thread. Get out of his thread.
ah nevermind, he is right, i probably double posted, i am somewhat dizzy during the last days.
anyways i converted the vb functions to c, they work perfectly, thanks.