• Welcome to Valhalla Legends Archive.
 

Prevent double sending?

Started by Gangz, December 30, 2003, 04:40 PM

Previous topic - Next topic

Gangz

I am creating a lock down function that does not use queue (made for stopping floods). I was wondering if there is any type of function that can make it not send to times.

If Form1.chklock = vbChecked Then Form1.Send "/ban " & username & " Lockdown" & lockname
Message = "/ban " & username & " Lockdown" & lockname

Message is the one that needs to not be repeated

iago

I don't see what you're having a problem with.  It doesn't seem very difficult,does it?
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


UserLoser.

I know a few great bots that use a queue and can ban flood bots, if it tries to

Gangz

Yea but very few.. I tested my bot on evey flood i could find and banned titan 4 times on 4 rj and turtle bot 2 times on 2 1 rj floods. The project seems wirth the time.

______

Here is an example on what you could do,

If Not Message = LastMessage then
  'Do whatever
End If

Spht

Quote from: Gangz on December 30, 2003, 05:40 PM
Yea but very few.. I tested my bot on evey flood i could find and banned titan 4 times on 4 rj and turtle bot 2 times on 2 1 rj floods. The project seems wirth the time.

Sounds like really inefficient coding. You should be using a queue for messages and delay sends appropriately, otherwise you could easily spam yourself off Battle.net. A message queue will also allow you to check for duplicated op commands which you can exclude.

Gangz

I do have a queue that can be customized by commands, but it seems that if I do lockdowns it sends 2 messages withought queue for the speed and then goes into the queue. I just want to avoid sending the same message twice just incase it was a mulitple flood or somthing.

o.OV

#7
ok. you arent using a queue for lockdown

'on user joins
SplitUserName = Split(UCase(UserName), "#")(0)
If GetTickCount - LastTick > 4000 And InOps And InStr(SafeList, "<" & SplitUserName & ">") = 0 Then
   If ChannelProtect Or InStr(ShitList, "<" & SplitUserName & ">") Or flags = 32 Or flags = 48 Then
       Ban UserName: LastTick = GetTickCount
       Else
       For xx = 1 To UBound(TagList)
           If UCase(SplitUserName) Like UCase(TagList(xx)) Then Ban UserName: LastTick = GetTickCount: Exit For
       Next xx
   End If
End If
If the facts don't fit the theory, change the facts. - Albert Einstein

Kp

Quote from: o.OV on December 30, 2003, 08:03 PM
ok. you arent using a queue for lockdown

'on user joins
SplitUserName = Split(UCase(UserName), "#")(0)
If GetTickCount - LastTick > 4000 And InOps And InStr(SafeList, "<" & SplitUserName & ">") = 0 Then
   If ChannelProtect Or InStr(ShitList, "<" & SplitUserName & ">") Or flags = 32 Or flags = 48 Then
       Ban UserName: LastTick = GetTickCount
       Else
       For xx = 1 To UBound(TagList)
           If UCase(SplitUserName) Like UCase(TagList(xx)) Then Ban UserName: LastTick = GetTickCount: Exit For
       Next xx
   End If
End If


What incredibly horrible code!  Among other failings, it tries to treat a bitmask as discrete values.  Use bitwise and to test their flags.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

o.OV

#9
Quote from: Kp on December 30, 2003, 08:30 PM
Quote from: o.OV on December 30, 2003, 08:03 PM
ok. you arent using a queue for lockdown

'on user joins
SplitUserName = Split(UCase(UserName), "#")(0)
If GetTickCount - LastTick > 4000 And InOps And InStr(SafeList, "<" & SplitUserName & ">") = 0 Then
   If ChannelProtect Or InStr(ShitList, "<" & SplitUserName & ">") Or flags = 32 Or flags = 48 Then
       Ban UserName: LastTick = GetTickCount
       Else
       For xx = 1 To UBound(TagList)
           If UCase(SplitUserName) Like UCase(TagList(xx)) Then Ban UserName: LastTick = GetTickCount: Exit For
       Next xx
   End If
End If


What incredibly horrible code!  Among other failings, it tries to treat a bitmask as discrete values.  Use bitwise and to test their flags.

.. well how would u rather do it
i know u are a better coder then me so help us out instead of telling me that my coding is horrid and please point out the other horrible parts of my coding .. then i can improve on it. thx kp
If the facts don't fit the theory, change the facts. - Albert Einstein

o.OV

#10
Ah.
Look kP


'    Spht's example
If (flags and &H20) Then


its an example i found on bitmask comparison

now what other improvements can be done for the code i provided?
If the facts don't fit the theory, change the facts. - Albert Einstein

Kp

Quote from: o.OV on December 30, 2003, 10:07 PM
now what other improvements can be done for the code i provided?

Well, I'd suggest storing your safelist and banlist in a true list of some sort rather than as a massive string with illegal characters to delimit entries.  As I recall, VB's support for such things tends to be rather poor though, so you may have some difficulty making it work.  I'll leave it to the VB gurus to explain how to implement the list (it'd be trivial in C, not so in VB afaik).
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Spht

Quote from: o.OV on December 30, 2003, 10:07 PM
Ah.
Look kP


'    Spht's example
If (flags and &H20) Then


its an example i found on bitmask comparison

now what other improvements can be done for the code i provided?

I don't believe that's my example. I usually check if the result is actually equal to what I'm checking, and not only checking if it's greater than zero. If you only check if it's greater than zero, you may run into some unwanted happenings.

Grok

#13
Quote from: Kp on December 30, 2003, 11:01 PM
Quote from: o.OV on December 30, 2003, 10:07 PM
now what other improvements can be done for the code i provided?

Well, I'd suggest storing your safelist and banlist in a true list of some sort rather than as a massive string with illegal characters to delimit entries.  As I recall, VB's support for such things tends to be rather poor though, so you may have some difficulty making it work.  I'll leave it to the VB gurus to explain how to implement the list (it'd be trivial in C, not so in VB afaik).

Nah, quite easy to do in VB, really.  To wit:


Private Function OpenList(ByVal ListName As String) As ADODB.Recordset
   
   Dim rs As ADODB.Recordset
   Dim fso As Scripting.FileSystemObject
   Dim sFile As String
   
   Set fso = New Scripting.FileSystemObject
   sFile = fso.BuildPath(App.Path, ListName & ".xml")
   
   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   If fso.FileExists(sFile) = True Then
       rs.Open sFile
   Else
       rs.Fields.Append "UserName", adVarChar, 30
       rs.Fields.Append "Namespace", adVarChar, 30
       rs.Fields.Append "Flags", adInteger
       rs.Fields.Append "DateAdded", adDate
       rs.Fields.Append "LastSeen", adDate
       rs.Fields.Append "Notes", adVarChar, 200
       rs.Open
       rs.Save sFile, adPersistXML
   End If
   Set OpenList = rs
   
End Function


o.OV

#14
Quote from: Spht on December 30, 2003, 11:35 PM
Quote from: o.OV on December 30, 2003, 10:07 PM
Ah.
Look kP


'    Spht's example
If (flags and &H20) Then


its an example i found on bitmask comparison

now what other improvements can be done for the code i provided?

I don't believe that's my example. I usually check if the result is actually equal to what I'm checking, and not only checking if it's greater than zero. If you only check if it's greater than zero, you may run into some unwanted happenings.

Oh =\

I thought that was you. Perhaps I misread the post.

Quote from: Spht on July 09, 2003, 10:38 AM
Quote from: ______ on July 09, 2003, 09:08 AM
put this on your join command

If flags = &H20 Then
cleanslatebot2.send "/ban " & username & " Ban Evasion Detected"
endif


Note that would fail if the user has "plug" (0x10). You should be doing a bitmask comparison for this type of thing. Example:

If (flags and &H20) Then

Ok. So maybe that wasn't you or maybe it was.

But if what you say is true and I might run into unwanted happenings then how should I properly make the comparison?

Quote from: Kp on December 30, 2003, 11:01 PM
Quote from: o.OV on December 30, 2003, 10:07 PM
now what other improvements can be done for the code i provided?

Well, I'd suggest storing your safelist and banlist in a true list of some sort rather than as a massive string with illegal characters to delimit entries.  As I recall, VB's support for such things tends to be rather poor though, so you may have some difficulty making it work.  I'll leave it to the VB gurus to explain how to implement the list (it'd be trivial in C, not so in VB afaik).

Reason why I avoid an array is because I normally use a loop to go through an array. I'll go look at the filter function again perhaps I missed something
If the facts don't fit the theory, change the facts. - Albert Einstein