Valhalla Legends Forums Archive | Battle.net Bot Development | When I send this I get ip banned... Why?

AuthorMessageTime
Nub
I'm trying to learn to send packets and things, and when I try to send a packet to say "the wheels ont he bus go round and round" with this function I get ip banned...
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal numBytes As Long)

Public Function blah() As String
Dim data$, final$, result As String * 2
data = "74 68 65 20 77 68 65 65 6c 73 20 6f 6e 74 20 68 65 20 62 75 73 20 67 6f 20 72 6f 75 6e 64 20 61 6e 64 20 72 6f 75 6e 64 00 "

For i = 1 To Len(data)
final = final & Chr("&H" & Left(data, 2))
data = Right(data, Len(data) - 3)
Next i

data = ""
data = data & Chr(&HFF)
data = data & Chr(&HE)
CopyMemory ByVal result, Len(final) + 4, 2
data = data & result
data = data & final
BUFFER = data
End Function

Then I called it like this....

Private sub Command1_Click()
CleanSlateBot1.Send blah
End Sub

Help me... :'(
July 14, 2003, 1:59 AM
Nub
[quote author=Nub link=board=17;threadid=1901;start=0#msg14722 date=1058147984]
BUFFER = data
[/quote]
Oops...
blah = data*
:-X
July 14, 2003, 2:13 AM
Nub
*waits for help*
;D
July 14, 2003, 3:33 AM
UserLoser
No need to insert chr(ff) and chr(e), I believe .Send is for chat messages, and already includes that.

You could just do CleanSlateBot.Send "Hello world!"
July 14, 2003, 3:49 AM
Nub
I know that I could just do .send "blah"
The reason im doing it this way though is because I'm trying to learn how to send packets to bnet. Just useing 0x0e (I think) because its easy...
July 14, 2003, 3:54 AM
Nub
[quote author=UserLoser link=board=17;threadid=1901;start=0#msg14738 date=1058154563]
No need to insert chr(ff) and chr(e), I believe
[/quote]
Wouldn't I need that as part of the packet header?
July 14, 2003, 3:56 AM
UserLoser
If you want to send other besides 0x0e, with CleanSlateBot, you'd have to use .BuildPacket. I've never used it before, so I don't know how to do it.
July 14, 2003, 3:56 AM
Nub
Thenks for the help UserLoser

Can anyone help me with .buildpacket?
July 14, 2003, 4:05 AM
Camel
I don't think this will help you too much if you're using CSB, but here it is anyways:
[code]Option Explicit

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal numBytes As Long)

Public Function MakePacket(ByVal ID As Long, ByVal Data As String) As String
MakePacket = Chr(&HFF) & Chr(ID) & MKI(Len(Data) + 4) & Data
End Function

Public Function MKI(Value As Integer) As String
Dim Result As String * 2

CopyMemory ByVal Result, Value, 2
MKI = Result
End Function

Public Function sendChatPacket(strText As String) As String
sendChatPacket = MakePacket(&HE, strText & Chr(0))
End Function

Public Function HexToStr(ByVal Hex1 As String) As String
'I didn't write this function, nor do I use it for non-debugging purposes

Dim strTemp As String, strReturn As String, I As Long
Hex1 = Replace(Hex1, " ", "")
If Right(Hex1, 1) = Chr(0) Then Hex1 = Left(Hex1, Len(Hex1) - 1)
If Len(Hex1) Mod 2 <> 0 Then Exit Function

Dim Y As String
For I = 1 To Len(Hex1)
Y = UCase(Mid(Hex1, I, 1))
If (Not IsNumeric(Y)) And (Asc(Y) < Asc("A") Or Asc(Y) > Asc("F")) Then
Exit Function
End If
Next

For I = 1 To Len(Hex1) Step 2
Dim x As Integer
Y = Mid(Hex1, I, 2)

x = Val("&H" & Y)
If x < 0 Or x > 255 Then
HexToStr = ""
Exit Function
End If
strReturn = strReturn & Chr(x)
Next I
HexToStr = strReturn
End Function

Public Function blah() As String
Dim Data As String, Final As String
Data = "74 68 65 20 77 68 65 65 6c 73 20 6f 6e 74 20 68 65 20 62 75 73 20 67 6f 20 72 6f 75 6e 64 20 61 6e 64 20 72 6f 75 6e 64 00 "

Final = HexToStr(Data)

blah = sendChatPacket(Final)
End Function[/code]
July 14, 2003, 4:39 AM
Nub
I think the packet ends up being the same as with my function... The problem still stands for me to send the packet with CSB.
Thanks for the input
July 14, 2003, 4:45 AM
Camel
I understand that, but now you don't need that [ugly] code every time you want to send a packet. :)
July 14, 2003, 4:59 AM
Nub
"[ugly]"
*kick* :P
July 14, 2003, 5:04 AM
Eternal
He has a point Nub...it isn't going to win any code beauty contests... ;D
July 14, 2003, 12:20 PM
Kp
[quote author=Nub link=board=17;threadid=1901;start=0#msg14736 date=1058153625]*waits for help*;D[/quote]Barely an hour and a half had passed between you first request and your thread bump. Have a little more patience, especially when you supply such ugly code.
July 14, 2003, 6:30 PM
Nub
sorry kp... :'(
July 15, 2003, 4:25 AM
Nub
Last question - so, would the packet my function made be correct, and I just cant send it because I'm useing CSB? Or are they both wrong?
July 15, 2003, 6:43 PM

Search