Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: pyropk on October 21, 2003, 05:06 PM

Title: Visual Basic Bot Flood Protection
Post by: pyropk on October 21, 2003, 05:06 PM
Grok's code didn't work when I tested it.  I have a bot written by me, but I need Flood Protection.  Somone help!  Thanx.
Title: Re:Visual Basic Bot Flood Protection
Post by: Adron on October 21, 2003, 05:14 PM
this is probably safe flood protection:

if len(txt) > 60 then txt = left(txt, 60)
sleep 3000
Title: Re:Visual Basic Bot Flood Protection
Post by: Banana fanna fo fanna on October 21, 2003, 07:43 PM
But terrible.

Add all send events to a queue and have a timer empty it and write to bnet.
Title: Re:Visual Basic Bot Flood Protection
Post by: iago on October 21, 2003, 11:09 PM
Quote from: St0rm.iD on October 21, 2003, 07:43 PM
But terrible.

Add all send events to a queue and have a timer empty it and write to bnet.

nonono, use a stack! Then your messages will display backwards; but don't tell the person you send your bot to, have the messages displayed as soon as he hits send on the client side, then watch the hilarity ensue! :)
Title: Re:Visual Basic Bot Flood Protection
Post by: Yoni on October 22, 2003, 01:43 AM
Quote from: Adron on October 21, 2003, 05:14 PM
this is probably safe flood protection:

if len(txt) > 60 then txt = left(txt, 60)
sleep 3000

You can also get a funny version of the same protection method if you replace "left" with "right"
Title: Re:Visual Basic Bot Flood Protection
Post by: Adron on October 22, 2003, 02:41 AM
For an infinite sequence of long messages, is the flood protection I suggested more than 20% off? For an infinite sequence of short messages, is it more than 30% off? I don't think it's that bad at all if it's within 30%!
Title: Re:Visual Basic Bot Flood Protection
Post by: pyropk on October 22, 2003, 02:39 PM
Well.. Using
if len(txt) > 60 then txt = left(txt, 60)
sleep 3000

Why only 60?  And...Should I put this for all the data sending?  Or..What?  Cause im slightly confused.
Title: Re:Visual Basic Bot Flood Protection
Post by: Tuberload on October 22, 2003, 03:35 PM
What that does is

If the length of 'txt' is greater than 60, replace text with the first 60 characters fro the left side of the string. Then pause for 3000 milliseconds before proceeding.
Basically he is saying you need that long of a duration before you send anymore data, for every 60 characters sent.
Title: Re:Visual Basic Bot Flood Protection
Post by: Adron on October 22, 2003, 06:09 PM
I'm saying that the ultra flood protection should be around 60 characters somewhere and that for 60 characters you get a waiting time that is somewhere close to 3 seconds anyway.
Title: Re:Visual Basic Bot Flood Protection
Post by: pyropk on October 23, 2003, 02:13 AM
While waiting, I came up with my own Flood Protection... Its rather 'Ghetto' if you will, and im sure buggy.. Buts it worked not bad so far.

Public Function SendData(Text As String)
frmMain.FloodC.Text = frmMain.FloodC.Text + 1

'Basicaly, just adds one digit to the Flood Counter Txt
'Then sends the actual text through Clean Slate...

frmMain.CSB1.Send Text

'But if the FloodC is >= 1, then it'll wait until it
'drops back down to 0, before it proceeds to send
'more data.

If frmMain.FloodC.Text >= "1" Then
   Do Until frmMain.FloodC.Text = "0"
       DoEvents
   Loop
End If

DoEvents
End Function

Private Sub FloodProtecion_Timer()
'Interval: 1300
'Slowely takes away the digit back down to 0,
'So it wont send until its 0...So gives time in between

If FloodC.Text > "0" Then FloodC.Text = FloodC.Text - 1
End Sub
Title: Re:Visual Basic Bot Flood Protection
Post by: iago on October 23, 2003, 02:22 AM
The algorithm they use is actually rather complicated, but 60 characters is the most efficient length.  I would recommend figureing out what the lowest safe time/character is for each possible length and calculating the formula.  It will involve getting banned from b.net a lot, but it'll be fun!

Incidently, use [code ] and [/ code] tags around your source code to make it easier to read.  

Thanks!

QuoteIf frmMain.FloodC.Text >= "1" Then
   Do Until frmMain.FloodC.Text = "0"
       DoEvents
   Loop
End If
I'm confused; why are you checking if the text > "1"?  That makes no sense..
Title: Re:Visual Basic Bot Flood Protection
Post by: pyropk on October 23, 2003, 03:05 AM
No, if FloodC.Text is >= 1.  Thats the Flood Counter text box.  When you call the Send command, it adds 1 to that text box.  If the Text is greater than 0, it'll stall until its back to zero, causing the pause.  The timer checks to see if the Flood Counter is greater than 0 to know whether or not it should decrease at a rate before it sends the next set of data.
Title: Re:Visual Basic Bot Flood Protection
Post by: Adron on October 23, 2003, 05:23 AM
Quote from: pyropk on October 23, 2003, 03:05 AM
No, if FloodC.Text is >= 1.  Thats the Flood Counter text box.  When you call the Send command, it adds 1 to that text box.  If the Text is greater than 0, it'll stall until its back to zero, causing the pause.  The timer checks to see if the Flood Counter is greater than 0 to know whether or not it should decrease at a rate before it sends the next set of data.

That's a nice idea. My original flood protection was something like:

Add 200 + the number of characters in the message to the flood counter when sending a message.
Decrease the flood counter by 1 every 11 ms.
Only send a message if the resulting flood counter after sending the message would be less than 600.


Edit:
You can't set a timer for 11 ms and get it to decrease the flood counter reliably, you'd have to set it for 110 ms and decrease by 10 or something like that.
Title: Re:Visual Basic Bot Flood Protection
Post by: Banana fanna fo fanna on October 23, 2003, 02:00 PM
Don't use a textbox, use a variable.
Title: Re:Visual Basic Bot Flood Protection
Post by: bmwrb16 on October 23, 2003, 09:53 PM
Ditto!
Title: Re:Visual Basic Bot Flood Protection
Post by: Tuberload on October 24, 2003, 03:34 AM
Quote from: bmwrb16 on October 23, 2003, 09:53 PM
Ditto!
May I ask what the purpose of this post was?
Title: Re:Visual Basic Bot Flood Protection
Post by: Hitmen on October 24, 2003, 02:33 PM
Quote from: Tuberload on October 24, 2003, 03:34 AM
Quote from: bmwrb16 on October 23, 2003, 09:53 PM
Ditto!
May I ask what the purpose of this post was?

Making a useless post asking why someone made a useless post is a waste of time.

I suppose this post is rather useless too.
Title: Re:Visual Basic Bot Flood Protection
Post by: Tuberload on October 24, 2003, 05:16 PM
Quote from: Hitmen on October 24, 2003, 02:33 PM
Quote from: Tuberload on October 24, 2003, 03:34 AM
Quote from: bmwrb16 on October 23, 2003, 09:53 PM
Ditto!
May I ask what the purpose of this post was?

Making a useless post asking why someone made a useless post is a waste of time.

I suppose this post is rather useless too.
Mine wasn't really a useless post because I was trying to figure something out. He clearly was not and neither were you. So you guys posted the useless posts. My curiosity gave mine a point. ;D
Title: Re:Visual Basic Bot Flood Protection
Post by: Michael on November 01, 2003, 08:37 PM
Here is a queue system i designed for my zonebot use it if you like its very stable note set timer5.interval to 100 and timer2.interval to 4000


Public Sub Send(ByVal strText As String)
On Error Resume Next
QueueCount = QueueCount + 1
Bot.mnuQ.Caption = "Queue(" & QueueCount & ")"
Bot.List1.AddItem strText
End Sub
Public Sub QueueClear()
   QueueCount = 0
   Bot.List1.Clear
   LastQueue = ""
   Bot.mnuQ.Caption = "Queue(" & QueueCount & ")"
End Sub
'no double ban queue
Public Sub CheckQueue(Queue1 As String, Queue2 As String)
If LCase(Left(Queue1, 4)) = "/ban" And LCase(Left(Queue2, 4)) = "/ban" Then
If LCase(Queue1) = LCase(Queue2) Then
Allowed = flase
Else
Allowed = True
End If
Else
Allowed = True
End If
End Sub
Private Sub Timer5_Timer()
If Timer2.Enabled = True Then
Else
If List1.ListCount = "0" Then
Else
QueueCount = QueueCount - 1
Bot.mnuQ.Caption = "Queue(" & QueueCount & ")"
Call CheckQueue(LastQueue, Bot.List1.List(0))
If Allowed = True Then
'AddChat "<" & varuser & ">", vbYellow, Bot.List1.List(0), vbWhite
CleanSlateBot1.Send Bot.List1.List(0)
If LCase(Left(Bot.List1.List(0), 1)) = "/" Then
'
Else
AddChat "<" & varUsername & ">", vbYellow, Bot.List1.List(0) & vbNewLine, vbWhite
End If
LastQueue = Bot.List1.List(0)
Bot.List1.RemoveItem (0)
Timer2.Enabled = True
End If
If Allowed = False Then
Bot.List1.RemoveItem (0)
Call CheckQueue(LastQueue, Bot.List1.List(0))
End If
End If
End If
End Sub
Title: Re: Visual Basic Bot Flood Protection
Post by: Antarctica on September 07, 2006, 07:49 PM
Michael... your code is pretty hard 2 read u know.  You have no enters in any of it or indentations.
Title: Re: Visual Basic Bot Flood Protection
Post by: rabbit on September 07, 2006, 08:04 PM
WOW!  Two years dead.
Title: Re: Visual Basic Bot Flood Protection
Post by: topaz on September 07, 2006, 08:16 PM
The nested ifs are pretty ugh too.
Title: Re: Visual Basic Bot Flood Protection
Post by: Mystical on September 07, 2006, 11:39 PM
Quote from: rabbit on September 07, 2006, 08:04 PM
WOW!  Two years dead.

3 years dead.. :P
Title: Re: Visual Basic Bot Flood Protection
Post by: MysT_DooM on September 08, 2006, 06:36 AM
Quote from: MyStiCaL on September 07, 2006, 11:39 PM
Quote from: rabbit on September 07, 2006, 08:04 PM
WOW!  Two years dead.

3 years dead.. :P

2 years and 9 months
Title: Re: Visual Basic Bot Flood Protection
Post by: l2k-Shadow on September 08, 2006, 02:39 PM
oh dear! 2 years 10 months 6 days dead.
Title: Re: Visual Basic Bot Flood Protection
Post by: Mystical on September 08, 2006, 03:18 PM
thats right break it down!!
Title: Re: Visual Basic Bot Flood Protection
Post by: Cat Food on September 22, 2006, 12:54 PM
-Mouse drifts around for the lock topic button as if it were really there-
Title: Re: Visual Basic Bot Flood Protection
Post by: MyndFyre on September 22, 2006, 12:56 PM
Quote from: ImaWh0re on September 22, 2006, 12:54 PM
-Mouse drifts around for the lock topic button as if it were really there-
You're not a moderator.  Stop bitching about it.  You're just contributing to the problem.
Title: Re: Visual Basic Bot Flood Protection
Post by: Cat Food on September 22, 2006, 12:59 PM
I wasn't bitching I was putting my 2 cents in. Hence why I said 'as if it were really there', being I am obviously NOT a moderator. It was a joke, you understand that right?
Title: Re: Visual Basic Bot Flood Protection
Post by: rabbit on September 22, 2006, 05:38 PM
hehehe....newbie talks back to Myndy :P
Title: Re: Visual Basic Bot Flood Protection
Post by: Cat Food on September 22, 2006, 07:37 PM
I'm not a newbie :( I'm not gosu but defiantly far from a newbie. And my tag lies.
Title: Re: Visual Basic Bot Flood Protection
Post by: rabbit on September 22, 2006, 07:59 PM
ROFL..."gosu".... I can't believe that's still floating around...
Title: Re: Visual Basic Bot Flood Protection
Post by: Hero on September 22, 2006, 08:41 PM
Quote from: rabbit on September 22, 2006, 07:59 PM
ROFL..."gosu".... I can't believe that's still floating around...
I thought it died as well.
Title: Re: Visual Basic Bot Flood Protection
Post by: Mystical on September 23, 2006, 04:17 AM
im a newbie so what. =P