[FilterScript] Anti-DDos Bot
#1

Anti DDOS Bots


Agora sim !! Estб funcionando e foi testado.

Quote:

[17:38:04] Incoming connection: 127.0.0.1:58125
[17:38:04] Incoming connection: 127.0.0.1:58126
[17:38:04] Incoming connection: 127.0.0.1:58127
[17:38:04] Incoming connection: 127.0.0.1:58128
[17:38:04] Incoming connection: 127.0.0.1:58129
[17:38:04] Incoming connection: 127.0.0.1:58130
[17:38:05] Incoming connection: 127.0.0.1:58131
[17:38:05] Incoming connection: 127.0.0.1:58132
[17:38:05] Incoming connection: 127.0.0.1:58133
[17:38:05] Incoming connection: 127.0.0.1:58134
[17:38:07] [join] bRUNO_(QlP4 has joined the server (100:127.0.0.1)
[17:38:07] [join] bRUNO_NQw)Y has joined the server (101:127.0.0.1)
[17:38:07] 101 Entrou em menos de 2 segundos
[17:38:07] [join] bRUNO_yq8OD has joined the server (102:127.0.0.1)
[17:38:07] 102 Entrou em menos de 2 segundos
[17:38:07] BOT: ID -> 102 IP -> 127.0.0.
[17:38:08] [part] bRUNO_yq8OD has left the server (102:2)
Quote:
Originally Posted by Victor'
Посмотреть сообщение
Agora funcionou

PHP код:
[17:42:35] [join] DtvugjacniUnwk has joined the server (2:127.0.0.1)
[
17:42:35] [join] TN2oDpmjCzIKfu has joined the server (2:127.0.0.1)
[
17:42:35] 2 Entrou em menos de 2 segundos
[17:42:35] [join] CmkIKzeN71xKUx has joined the server (2:127.0.0.1)
[
17:42:35] 2 Entrou em menos de 2 segundos
[17:42:35] BOT: ID -> 2 IP -> 127.0.0. 



Cуdigo:
PHP код:

#include a_samp
#if !defined varGet
#define varGet(%0)      getproperty(0,%0)
#endif
// https://sampforum.blast.hk/showthread.ph...2.58050230
#if !defined varSet
#define varSet(%0,%1) setproperty(0, %0, %1)
#endif
stock botGetIP[24];
#define IsPlayerBot(%0)\
            
GetPlayerPing(%0) == 65535 && (gettime() - varGet((GetPlayerIp(%0, botGetIP, sizeof botGetIP), botGetIP)) > 5)
public 
OnPlayerConnect(playerid) {
    if(
IsPlayerNPC(playerid)) return false;
    static
        
playerip[24]
    ;
    
GetPlayerIp(playerid, playerip, 24);
    if(
gettime() - varGet(playerip) < 2) {
        
        
strcat(playerip, "di_S");
        if(
gettime() - varGet(playerip) < 3) {
            return 
false;
        }
        
        
printf("%d Entrou em menos de 2 segundos", playerid);
        
GetPlayerIp(playerid, playerip, 20);
        
varSet(playerip, gettime());
        
strcat(playerip, "x");
        static 
timers ;
        
timers = varGet(playerip);
        
varSet(playerip, 1+ timers);
        if(
timers > 2) {
            
playerip[strlen(playerip) - 2] = 0;
            
printf("BOT: ID -> %d IP -> %s", playerid, playerip);
            
BanEx(playerid, "Bot Connect");
        }
    }
    return 
varSet(playerip, gettime());
}
public 
OnPlayerDisconnect(playerid, reason) {
    if(
reason == 2) {
        static
            
playerip[20]
        ;
        
GetPlayerIp(playerid, playerip, 20);
        
strcat(playerip, "di_S");
        
varSet(playerip, gettime());
    }
    return 
false;
} 
Ele detecta apуs o cara fazer 2 a 5 conexхes. Й via IP, ela registra usando varSet e varGet (uma biblioteca minha) e apуs uma nova conexгo checa o tempo desses dois caras.

----

Tambйm й aconselhбvel que vocк coloca o seguinte no topo de cada callback que use playerid:
pawn Код:
if(IsPlayerBOT(playerid)) return false;
Assim evita outros possнveis bots
Reply
#2

Acho que nгo funcionou comigo :S
PHP код:
[17:35:56] [part] ___ has left the server (2:1)
[
17:35:58] Incoming connection: 127.0.0.1:3851
[17:35:59] [join] ___ has joined the server (2:127.0.0.1)
[
17:35:59] Conta salva: Contas/___.ini.
[
17:35:59] [part] ___ has left the server (2:1)
[
17:36:01] Incoming connection: 127.0.0.1:3852
[17:36:01] [join] ___ has joined the server (2:127.0.0.1)
[
17:36:01] Conta salva: Contas/___.ini.
[
17:36:01] [part] ___ has left the server (2:1)
[
17:36:03] Incoming connection: 127.0.0.1:3853 
PHP код:
[17:36:05] [join] xUI42pIjfJfy8I has joined the server (2:127.0.0.1)
[
17:36:05] [join] Cjl6aGeNPrtgBt has joined the server (2:127.0.0.1)
[
17:36:05] [join] PNXlfP8sCFKe8Q has joined the server (2:127.0.0.1)
[
17:36:05] [join] ZBQ40pGGmBPkfE has joined the server (2:127.0.0.1)
[
17:36:05] [join] wBA9E4Yi3waP3X has joined the server (2:127.0.0.1)
[
17:36:05] [join] dBm9tr702x9FWL has joined the server (2:127.0.0.1)
[
17:36:05] [join] FCCcV0XkuvzwB3 has joined the server (2:127.0.0.1)
[
17:36:05] [join] uwpjSK529aEm2x has joined the server (2:127.0.0.1)
[
17:36:05] [join] YpCC48xGwDE6sB has joined the server (2:127.0.0.1) 
Testei com uns bots que achei na internet, nгo vou revelar o nome por questхes de seguranзa.
Reply
#3

Legal, irei usar
Reply
#4

Vitor, eu testei e dei uma modificada em uma linha do cуdigo. Testa agora :d
Reply
#5

Agora funcionou

PHP код:
[17:42:35] [join] DtvugjacniUnwk has joined the server (2:127.0.0.1)
[
17:42:35] [join] TN2oDpmjCzIKfu has joined the server (2:127.0.0.1)
[
17:42:35] 2 Entrou em menos de 2 segundos
[17:42:35] [join] CmkIKzeN71xKUx has joined the server (2:127.0.0.1)
[
17:42:35] 2 Entrou em menos de 2 segundos
[17:42:35] BOT: ID -> 2 IP -> 127.0.0. 
Reply
#6

Adicionei a funзгo IsPlayerBOT. Bom uso pessoal.
Reply
#7

Muito Bom Bruno,vai resolver meus problemas e de muitas pessoas que estao tendo transtorno com atacks.
Reply
#8

Bom, poderia ter incluido no AntiHack...
Reply
#9

Isto estб incluнdo no bpProteзгo ..
Reply
#10

Parabйns, уtima lуgica e eu nгo fazia ideia de como armazenar por IP, irei utilizar
Reply
#11

Parabйns Bruno
Reply
#12

muito foda draks otimo trabalho
Reply
#13

deu um warning

pawn Code:
warning 203: symbol is never used: "botGetIP"
Poderia me responder Drakins?
Eu tento colocar a linha:
pawn Code:
if(IsPlayerBOT(playerid)) return false;
No local onde "hб playerid"
Ma dб erros...
Reply
#14

Que erros?
Reply
#15

pawn Code:
warning 203: symbol is never used: "botGetIP"
pawn Code:
error 021: symbol already defined: "playerip"
linha: playerip[24]
Reply
#16

Alguйm poderia me ajudar?
Reply
#17

Sгo avisos, nгo erros.
playerip ocorre porque vocк jб tem uma global chamada "playerip" e o botGetIP ocorre porque voce nao usou em nenhuma linha IsPLayerBot ..

PARA DE FAZER DOUBLE POST
Nгo й a primeira vez que vocк faz.
Reply
#18

Quote:
Originally Posted by [FeK]DraKiNs
View Post
Sгo avisos, nгo erros.
playerip ocorre porque vocк jб tem uma global chamada "playerip" e o botGetIP ocorre porque voce nao usou em nenhuma linha IsPLayerBot ..

PARA DE FAZER DOUBLE POST
Nгo й a primeira vez que vocк faz.
Mas sem o botGetIP, nгo funciona o cуdigo .-. eu tento colocar a linha onde hб "playerid" mas nгo funciona.
Reply
#19

Coloca em um filterscript
Reply
#20

Quote:
Originally Posted by [FeK]DraKiNs
View Post
Coloca em um filterscript
Ok

Quando coloco a linha:
pawn Code:
if(IsPlayerBOT(playerid)) return false;
Eu obtenho o seguinte erro:
pawn Code:
error 017: undefined symbol "IsPlayerBOT"
@EDIT

Eu estou utilizando o cуdigo em FS assim:

pawn Code:
#include a_samp

#if !defined varGet
#define varGet(%0)      getproperty(0,%0)
#endif

#if !defined varSet
#define varSet(%0,%1) setproperty(0, %0, %1)
#endif

#define IsPlayerBot(%0)\
            GetPlayerPing(%0) == 65535 && (gettime() - varGet((GetPlayerIp(%0, botGetIP, sizeof botGetIP), botGetIP)) > 5)


public OnPlayerConnect(playerid) {

    if(IsPlayerNPC(playerid)) return false;

    static
        playerip[24]
    ;

    GetPlayerIp(playerid, playerip, 24);

    if(gettime() - varGet(playerip) < 2) {


        strcat(playerip, "di_S");

        if(gettime() - varGet(playerip) < 3) {
            return false;
        }

        printf("%d Entrou em menos de 2 segundos", playerid);

        GetPlayerIp(playerid, playerip, 20);

        varSet(playerip, gettime());

        strcat(playerip, "x");

        static timers ;
        timers = varGet(playerip);

        varSet(playerip, 1+ timers);

        if(timers > 2) {

            playerip[strlen(playerip) - 2] = 0;

            printf("BOT: ID -> %d IP -> %s", playerid, playerip);
            BanEx(playerid, "Bot Connect");
        }
    }
    if(IsPlayerNPC(playerid)) return false;
    return varSet(playerip, gettime());
}


public OnPlayerDisconnect(playerid, reason) {
    if(reason == 2) {

        static
            playerip[20]
        ;


        GetPlayerIp(playerid, playerip, 20);
        strcat(playerip, "di_S");

        varSet(playerip, gettime());
    }
    if(IsPlayerNPC(playerid)) return false;
    return false;

}
E nгo estб funfando...
Alguйm pode me ajudar?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)