• Welcome to Valhalla Legends Archive.
 

anti flood

Started by Tazo, March 25, 2005, 09:05 AM

Previous topic - Next topic

Tazo

I looked all over this forum for about ~2 hours last night. I tried alll the code, and I did everything to make it work. I really need to know how to create an effective anti flood method, I looked all night last night searching for one!! (The requireddelay by Adron did not work, it always returned an extremely large number (or very small one..)).

Adron

Quote from: laurion on March 25, 2005, 09:05 AM
I looked all over this forum for about ~2 hours last night. I tried alll the code, and I did everything to make it work. I really need to know how to create an effective anti flood method, I looked all night last night searching for one!! (The requireddelay by Adron did not work, it always returned an extremely large number (or very small one..)).


It should be a number in milliseconds. Those tend to be very large...

Tazo

Too large for the timer. I'm using VB 6 by the way

Spht

#3
Quote from: laurion on March 25, 2005, 09:44 AM
Too large for the timer. I'm using VB 6 by the way

Maybe it's not the actual time to wait, but instead the time when it wants you to send the message, which could be a significantly larger number.

What's too large?  More than 1 minute?  I think with Blizzard's new flood protection scheme, there are some times when you are required to wait more than a minute before sending something else would be safe.

Tazo

Ok I tried doing

Public Sub Send(Text As String)
frmMain.Text3.Text = Text
Dim delay As Double
delay = (((Len(Text) * 15 + 1700) / 1000) + 1) * 1000
SetTimer frmMain.hWnd, &H0, delay, SendProc
End Sub

Public Function SendProc()
If frmMain.Text3.Text = "" Then Exit Function
    With PBuffer
        .InsertNTString frmMain.Text3.Text
        .SendPacket &HE
    End With
    If Left(Text, 1) = "/" Then
        RTBAdd Text3.Text & vbNewLine, vbTeal
    Else
        RTBAdd "<", vbWhite, MyName, vbCyan, "> " & frmMain.Text3.Text & vbNewLine, vbWhite
    End If
End Function

But it seemed to have No effect on the delay of what I was sending. I got that delay thing from a post from Noodlez. And Spht, I dont really understand what you mean..

edit: besides didnt some1 say that Adron's VB anti flood is outdated and will no longer work, it is missing one part?

Networks

Quote from: laurion on March 25, 2005, 09:05 AM
I looked all over this forum for about ~2 hours last night. I tried alll the code, and I did everything to make it work. I really need to know how to create an effective anti flood method, I looked all night last night searching for one!! (The requireddelay by Adron did not work, it always returned an extremely large number (or very small one..)).


This is much of the problem nowadays in bot development. Many users are simply searching for code that works or code they can modify. Why not create code that works on your own? Many the things you search now are out of phase and simply will not work perfectly. I can understand you using whatever you find as a reference, I mean why reinvent the wheel? The information you may have found can probably give you insight for what you need to do. Perhaps modifying code isn't enough anymore, I think people should actually try to invent something on their own with information they find here. The time you probably took to search for something that works is wasted time you could've used to create something new and effective that you would've understood.

If you want to create an effective method, do it.

Tazo

I don't know how to go about doing that..
+1 to networks though, you are right, that is correct. and I know I probably need to learn more VB before i try to write an anti flood. yea thats prob the problem

Kp

IIRC, the current anti-flood rules are not publicly posted.  The code available on the forum is close, but won't cover you reliably.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

iago

Well, this may not answer your question, but you can have a look at my (Java) code if you want.  I designed it to be easy to understand, so maybe you can learn enough to implement it on your own (it should be obvious what I'm doing).  I actually designed the algorithm myself, based on what I thought Adron's was doing (although I never really understood Adron's). 

http://www.javaop.com/javaop2/src/AntiFlood/src/PluginMain.java

Look at the getDelay() function.  If you want to get ideas from that, let me know if there's anything you don't understand.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Tazo

Quote from: iago on March 25, 2005, 01:58 PM
Well, this may not answer your question, but you can have a look at my (Java) code if you want.  I designed it to be easy to understand, so maybe you can learn enough to implement it on your own (it should be obvious what I'm doing).  I actually designed the algorithm myself, based on what I thought Adron's was doing (although I never really understood Adron's). 

http://www.javaop.com/javaop2/src/AntiFlood/src/PluginMain.java

Look at the getDelay() function.  If you want to get ideas from that, let me know if there's anything you don't understand.
thanks for offering to help but I know no Java lol. But hey, you have SentPackets in there..is that the new part of the aglithorim?  :-X

Warrior

It's pretty straight forward to port that.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

iago

Quote from: laurion on March 25, 2005, 02:11 PM
Quote from: iago on March 25, 2005, 01:58 PM
Well, this may not answer your question, but you can have a look at my (Java) code if you want.  I designed it to be easy to understand, so maybe you can learn enough to implement it on your own (it should be obvious what I'm doing).  I actually designed the algorithm myself, based on what I thought Adron's was doing (although I never really understood Adron's). 

http://www.javaop.com/javaop2/src/AntiFlood/src/PluginMain.java

Look at the getDelay() function.  If you want to get ideas from that, let me know if there's anything you don't understand.
thanks for offering to help but I know no Java lol. But hey, you have SentPackets in there..is that the new part of the aglithorim?  :-X

There is no "the algorithm" -- it varies depending on who wrote it.  This is just MY implementation, which is based (loosely) on Adron's.

I base it on 2 factors: the number of packets recently sent and the total number of bytes recently sent.

The function you need is very straight forward.  Here is a stripped down version with some comments I added for you:

    public long getDelay(String text, Object data)
    {
        // Increment the number of sent bytes by the length of the text
        sentBytes += text.length();
        // Increment the number of packets
        sentPackets++;
        long requiredDelay = 0;
       
        // Find the required delay
        requiredDelay += perByte * sentBytes;
        requiredDelay += perPacket * sentPackets;

        // If we've waited long enough (the packet should be sent out immediately), then reset everything
        if(firstMessage + requiredDelay + totalDelay < System.currentTimeMillis())
        {
            firstMessage = System.currentTimeMillis();
            requiredDelay = 0;
            sentBytes = text.length();
            sentPackets = 1;
            totalDelay = requiredDelay;
            return 0;
        }

        // Increase the total delay
        totalDelay += requiredDelay;

        // Find out what time in the future to send it (based on the current time)
        long timeSinceFirst = System.currentTimeMillis() - firstMessage;
       
        // Return the amount of time we need to wait
        return requiredDelay - timeSinceFirst + totalDelay;
    }
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Adron

What's missing in iago's compared to mine is that if you don't send anything for a while, you gain some "credits" that you can use to send several messages in a row later. But then, all that is the old flood protection algorithm.

iago

Quote from: Adron on March 25, 2005, 03:24 PM
What's missing in iago's compared to mine is that if you don't send anything for a while, you gain some "credits" that you can use to send several messages in a row later. But then, all that is the old flood protection algorithm.

That's the part of yours that confused me, so I didn't do it.  :)

Can you explain on a high level how you do that?  Like, how long = how many tokens, type thing?
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Adron

Quote from: iago on March 25, 2005, 03:25 PM
That's the part of yours that confused me, so I didn't do it.  :)

Can you explain on a high level how you do that?  Like, how long = how many tokens, type thing?

Hmm, let's see. I like to think of it like this:

Every 10 milliseconds or so, you gain a credit, up to a maximum of 600 credits.

When you send a message, you're charged a base amount of 200 credits plus an additional 1 credit per character in the message.

If you don't have enough credits to send a message when you want to, you'll have to wait until you do.


The numbers are just approximates, I think I had more exact values for them.