Jump to content

[Include] Anti flood + IP limits


Young Crooi
 Share

Recommended Posts

Functions
This is a simple include which will prevent your server from getting attacked by those pesky join/part bots.
You can also limit how many connections can be made with your server from the same exact IP. This is because some bots do not flood connections, but instead join every few seconds, evading the Anti Flood.

Code:#define IP_LIMIT 3 // = Max connections from one single IP
#define Time_Limit 3500 // = The time span between connects, adjust it to your own specifications

Change the IP_LIMIT if you are affraid of banning brothers, altho unlikely somebody will join with 3 computers.

I believe this will be of much help to other server owners, as it is of help for myself.
I used to use Kick(playerid) and just kick the flooders, but that wouldn't stop them from reconnecting 20 more times, so I've changed it to instantly ban if it identifies these attacks.

This is pretty much secure and won't cause any threat to your regulars being banned. Tested & fully working.

EDIT:
After looking up some more information about these attacks I'd like to provide another simple piece of code that would help you against the attackers that use the samp NPC's.

Add this to the code of OnPlayerConnect.

Code:public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) {
new server_IP[16];
format(server_IP, 16, "127.0.0.1");

if(strcmp(ConnIP,server_IP,true) != 0) {
Ban(playerid); // Ban is the safest thing here, as if you kick, they can still flood you with endless connections
return 0;
}
}
return 1;
}

What this does is check if the NPC connecting has the IP 127.0.0.1, this is the local IP of your server and NPC always connect from that. So if the IP isn't 127.0.0.1, it means the NPC connecting is an attacker's bot.


Downloads:


bMjQAWM.png

 
<embed src="http://laradio.ml/player1"width="280" height="480"></embed />

 

 
 
Link to comment
Share on other sites

  • 3 months later...
  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • 6 months later...

Multumim de postare. 

    _________________________________________________
    |                                                        _________             |
    |    |    /          /|        |\            |      /                   \          |
    |    |  /        /   |          |  \          |      |                              |
    |    |/       /     |           |    \        |      |                              |   
    |    |\              |           |      \      |      |        _____            |
    |    |  \            |           |        \    |      |                 \           |
    |    |    \          |           |          \  |      |                   |          |
    |    |      \        |           |            \|      \_________/           |
    |_______________________________________________|

Link to comment
Share on other sites

  • 4 months later...
  • 8 months later...
  • 4 months later...
  • 4 months later...
  • 4 weeks later...
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...