SA-MP Forums Archive
Anti Bot Attack - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Anti Bot Attack (/showthread.php?tid=484742)



Anti Bot Attack - Blackazur - 01.01.2014

Hello, do you know any good method to prevent this shitty bots from connecting to the server?


Re: Anti Bot Attack - dominik523 - 01.01.2014

pawn Код:
// under onPlayerConnect
new num_players_on_ip = GetNumberOfPlayersOnThisIP(connecting_ip);
if(num_players_on_ip > MAX_CONNECTIONS_FROM_IP)
{
      // banning
}

stock GetNumberOfPlayersOnThisIP(test_ip[])
{
    new against_ip[32+1];
    new x = 0;
    new ip_count = 0;
    for(x=0; x<MAX_PLAYERS; x++) {
        if(IsPlayerConnected(x)) {
            GetPlayerIp(x,against_ip,32);
            if(!strcmp(against_ip,test_ip)) ip_count++;
        }
    }
    return ip_count;
}



Re: Anti Bot Attack - AndreT - 01.01.2014

dominik's solution, although working, is not the best. And could end up with false positives of course.

I have another sort of check in place, which takes action if:
1. it has been less than 2 seconds from the last connection
2.1. the connecting player has the same name as the last connection OR
2.2. the connecting player has the same IP as the last connection

I haven't seen bots which would use the same name but a different IP when connecting so far, all I have encountered is bots using different names from the same IP real frequently. These sorts of attacks, though, can be made "invisible" to the other players in your server - detect them before sending any connection messages or spending ANY time on them (this would include calling queries, "registering" them with the streamer or sscanf, etc). This way you will encounter less lag, if any.

JernejL has released something a bit more complicated when it comes to detecting bots. I believe you'll find it if you search for it.


Re: Anti Bot Attack - Ada32 - 01.01.2014

http://ysi.wikia.com/wiki/Library:YSI%5Cy_flooding


Re: Anti Bot Attack - dominik523 - 01.01.2014

Quote:
Originally Posted by AndreT
Посмотреть сообщение
dominik's solution, although working, is not the best. And could end up with false positives of course.
How would that system end up with false positives?