Author | Message | Time |
---|---|---|
Nub_1 | How would I break a packet down, sent to me from B.net, into all the DWORDS and things, like I see on the site...? | November 20, 2003, 10:41 PM |
Kp | [quote author=Nub_1 link=board=17;threadid=3728;start=0#msg30374 date=1069368067] How would I break a packet down, sent to me from B.net, into all the DWORDS and things, like I see on the site...?[/quote] The answer to this question depends upon what language you're coding in. For cutting edge "safe" languages, which protect you from your own stupidity by denying pointers (among other things), it's a bit of a pain. For older languages that trust you to know what you're doing, it's trivial. What language are you using? There's enough different solutions I'm not going to enumerate all possibilities. | November 20, 2003, 10:55 PM |
Nub_1 | sorry, forgot to include that... I'm doing it in VB | November 20, 2003, 11:04 PM |
Kp | [quote author=Nub_1 link=board=17;threadid=3728;start=0#msg30385 date=1069369440] sorry, forgot to include that... I'm doing it in VB[/quote] Which VB? 6 or .Net? VB6 isn't cutting edge, but it still denies you pointers in an attempt to keep stupid people from hurting themselves. | November 20, 2003, 11:38 PM |
Nub_1 | VB6 | November 20, 2003, 11:42 PM |
DrivE | [quote author=Kp link=board=17;threadid=3728;start=0#msg30398 date=1069371503] VB6 isn't cutting edge, but it still denies you pointers in an attempt to keep stupid people from hurting themselves. [/quote] Make something idiot proof and somebody will invent a better idiot. | November 20, 2003, 11:43 PM |
Nub_1 | ... :'( | November 24, 2003, 8:52 PM |
Myndfyr | [quote author=Nub_1 link=board=17;threadid=3728;start=0#msg31157 date=1069707179] ... :'( [/quote] Well I'm not exactly certain about how to actually DO it in VB6, but think about it this way... When you send packet 0x50 to Bnet, there is a response you know you should get back. If you know what the response is, you can use various functions, such as CopyMemory from the Windows API, to copy the memory into each variable (that's how a lot of VB bots do it, IIRC). If you're using VB.NET, you can use the BitConverter class and all of the shared methods it provides; unfortunately, that's only available through .NET (and is the way that I wrote my bot). When you (for example) use a socket and get back a huge array of bytes, you know that four bytes will be coming in little-endian order for a DWORD. Hope this helps. --Rob | November 24, 2003, 10:04 PM |
Nub_1 | [quote author=Myndfyre link=board=17;threadid=3728;start=0#msg31186 date=1069711473] you can use various functions, such as CopyMemory from the Windows API, to copy the memory into each variable (that's how a lot of VB bots do it, IIRC [/quote] If you can, code would be appreciated... | November 25, 2003, 11:58 PM |
ObsidianWolf | Copy memory code [code] Option Explicit Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal numbytes As Long) [/code] Receiving data code [code] Private Sub Socket_DataArrival(ByVal bytesTotal As Long) Static strBuffer As String Dim strTemp As String, lngLen As Long Socket.GetData strTemp, vbString strBuffer = strBuffer & strTemp While Len(strBuffer) > 4 lngLen = Val("&H" & Login.SringTohex(RevString(Mid(strBuffer, 3, 2)))) If Len(strBuffer) < lngLen Then Exit Sub Login.ParseP Left(strBuffer, lngLen) strBuffer = Mid(strBuffer, lngLen + 1) Wend End Sub [/code] Need More, Its all over this forum, perhaps utilize the search funtion? | November 26, 2003, 12:04 AM |
Nub_1 | I don't think that answers my origional question :-\ | November 26, 2003, 12:10 AM |
ObsidianWolf | Or perhaps you dont know what your looking for? The Copymemory segment would be part of what you seek. the other part is kinda useless if you dont have the rest of it. None the less you could really look around the vL site and find what you need. The question you should really be asking is, are you too lazy to look for it? There is a packet buffer code on the Documents section of Botdev. But Heres the Parse code you are looking for, note this code is not my work. [code] Public Sub ParseP(ByVal Data As String) On Error Resume Next Dim D As String Dim tmp As String Dim mpqend As Long Dim ping As Long, Username As String, message As String Select Case Asc(Mid(Data, 2, 1)) 'Case &H1C ' If PreBoolean = False Then ' ' If Asc(Mid(Data, 5, 1)) = &H0 Then ' 'Authorizing Map... ' ' Game.Authorize ' ' Else ' 'Game start failed! ' ' End If ' ' End If ' Case &H3C ' ' If PreBoolean = False Then ' ' If Asc(Mid(Data, 5, 1)) = &H2 Then ' 'Game Started ' ' Packet.SendPacket Index, &H0 ' 'Game Playing ' ' Else ' 'Game start failed ' ' End If ' ' End If Case &H2E Dim num As Long Dim str As String * 4 Dim splituser() As String Dim X As Integer Data = Mid(Data, 1, Len(Data)) splituser() = Split(Data, Chr(1)) For X = 0 To UBound(splituser) str = Right(splituser(X), 8) CopyMemory num, ByVal str, 4 Dim spltstrs() As String spltstrs() = Split(Hex(num), " ") num = spltstrs(3) & " " & spltstrs(2) & " " & spltstrs(1) & " " & spltstrs(0) AddTextMChat num & vbCrLf, vbGreen AddTextMChat splituser(X) & vbCrLf, vbRed Next X Case &H25 If varPing = "" Then Packet.InsertDWORD 0 Packet.SendPacket &H25 ElseIf varPing = "1" Then End If Case &H6 D = Data MPQName = Mid(D, InStr(D, "I"), Len(D) - InStr(InStr(D, "I"), D, Chr(0))) mpqend = InStr(InStr(D, "I"), D, Chr(0)) MPQName = Left(MPQName, InStr(MPQName, Chr(0)) - 1) Hash = Mid(D, mpqend + 1, InStr(mpqend + 1, D, Chr(0)) - 1) Hash = Left(Hash, InStr(Hash, Chr(0)) - 1) Dim version As Long Dim Checksum As Long Dim ExeInfo As String Dim Result As Long Packet.InsertNonNTString "68XI" & StrReverse(varProduct) Packet.InsertDWORD &HC7 ExeInfo = Space(256) Result = CheckRevision(App.Path & "\" & varProduct & "\StarCraft.exe", App.Path & "\" & varProduct & "\storm.dll", App.Path & "\" & varProduct & "\battle.snp", Hash, version, Checksum, ExeInfo, MPQName) AddChat vbMagenta, App.Path & "\" & varProduct & "\StarCraft.exe" Packet.InsertDWORD version Packet.InsertDWORD Checksum NullTruncString ExeInfo If ExeInfo = Space(256) Then AddChat vbRed, ExeInfo AddChat vbRed, "-Hashes Could Not Be Located" Exit Sub End If Packet.InsertNTString ExeInfo AddTextMChat "-Sending Product Version" & vbCrLf, vbYellow Packet.SendPacket 7 Case &H7 Select Case Mid(Data, 5, 1) Case Chr(2) Packet.SendPacket &H2D If varPing = "2" Then Else Packet.InsertNonNTString "tenb" Packet.SendPacket &H14 End If AddTextMChat "-Product Version Accepted" & vbCrLf, vbGreen Case Else AddTextMChat "-Product versions rejected" & vbCrLf, vbRed End Select Case &H1D ServerHash = Right(Data, 4) Case &H2D AddTextMChat "-Sending CD-Key" & vbCrLf, vbYellow SendCDKey Case &H30, &H36 Select Case Mid(Data, 5, 1) Case Chr(1) AddTextMChat "-CD-Key Accepted" & vbCrLf, vbGreen AddTextMChat "-Sending Username & Password" & vbCrLf, vbYellow SendUsernamePassword Case Else AddTextMChat "-CD-Key rejected on bot" & vbCrLf, vbRed End Select Case &H29 If Mid(Data, 5, 1) = Chr(1) Then AddTextMChat "-Logged on as " & varAccount & vbCrLf, vbGreen Packet.InsertNTString varAccount Packet.InsertBYTE 0 Packet.SendPacket &HA Packet.InsertNonNTString varProduct Packet.SendPacket &HB Packet.InsertDWORD 2 Packet.InsertNTString varHome Packet.SendPacket &HC Else AddTextMChat "Account authorization failed" & vbCrLf, vbRed End If Case &HA With Packet .InsertNTString "/f l" .SendPacket &HE End With Case &HF frmMain.ParseR Data Case &HB frmChannel.ListView1.ListItems.Clear Dim Icon As String Dim SplitChan() As String Dim i As Integer Data = Mid(Data, 1, Len(Data)) SplitChan() = Split(Data, Chr(0)) For i = 0 To UBound(SplitChan) - 2 If InStr(SplitChan(i), "ÿ") Or InStr(SplitChan(i), "þ") Then Else If InStr(SplitChan(i), "Blizzard") Then Icon = "blizz" Else Icon = "bnet" End If frmChannel.ListView1.ListItems.Add , , SplitChan(i), , Icon End If Next i Case &H9 Dim SplitGame() As String Dim a As Integer frmGamelist.ListView1.ListItems.Clear Data = Mid(Data, 99, Len(Data)) SplitGame() = Split(Data, Chr(0)) For a = 0 To UBound(SplitGame) - 2 frmGamelist.ListView1.ListItems.Add , , SplitGame(a) Next a End Select End Sub [/code] And even at that your probally going to be like...wha??? So I suggest taking some time and reading, if you cannot find out what you are looking for then read more. or you could play the role of lazy and use CSB. | November 26, 2003, 12:18 AM |
Nub_1 | eh, I'm trying to move on from CSB... and I relieze that there's a packet buffer class | November 26, 2003, 12:22 AM |
ObsidianWolf | Well I am trying to help, but how much can one help a Llama? | November 26, 2003, 12:36 AM |
Myndfyr | Wolf, how long have you been on these forums? I've only seen you the past couple days, but man! 16 posts already?!? | November 26, 2003, 12:44 AM |
ObsidianWolf | Ive known of these forums a little bit shorter then they have existed. As for registering, I did so sometime in febuary 2k3. I have been reading and observing up to about 2-4 days ago.\ Edited: Time reference to knowledge of forums | November 26, 2003, 12:49 AM |
hismajesty | He asked for information, not to be flamed. Read this, it may help a little bit. http://www.blizzside.com/feanor/PacketLogs.txt | November 26, 2003, 12:57 AM |
Nub_1 | thanks, that helped some | November 26, 2003, 1:08 AM |
ObsidianWolf | I am sorry I was unable to assist you in your attempt to learn more. Perhaps another time. | November 26, 2003, 1:18 AM |