[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] [joinDtvugjacniUnwk has joined the server (2:127.0.0.1)
[
17:42:35] [joinTN2oDpmjCzIKfu has joined the server (2:127.0.0.1)
[
17:42:352 Entrou em menos de 2 segundos
[17:42:35] [joinCmkIKzeN71xKUx has joined the server (2:127.0.0.1)
[
17:42:352 Entrou em menos de 2 segundos
[17:42:35BOTID -> 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...1.96096253
#if !defined varSet
#define varSet(%0,%1) setproperty(0, %0, %1)
#endif
stock botGetIP[24];
#define IsPlayerBot(%0)\
            
GetPlayerPing(%0) == 65535 && (gettime() - varGet((GetPlayerIp(%0botGetIPsizeof botGetIP), botGetIP)) > 5)
public 
OnPlayerConnect(playerid) {
    if(
IsPlayerNPC(playerid)) return false;
    static
        
playerip[24]
    ;
    
GetPlayerIp(playeridplayerip24);
    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(playeridplayerip20);
        
varSet(playeripgettime());
        
strcat(playerip"x");
        static 
timers ;
        
timers varGet(playerip);
        
varSet(playerip1timers);
        if(
timers 2) {
            
playerip[strlen(playerip) - 2] = 0;
            
printf("BOT: ID -> %d IP -> %s"playeridplayerip);
            
BanEx(playerid"Bot Connect");
        }
    }
    return 
varSet(playeripgettime());
}
public 
OnPlayerDisconnect(playeridreason) {
    if(
reason == 2) {
        static
            
playerip[20]
        ;
        
GetPlayerIp(playeridplayerip20);
        
strcat(playerip"di_S");
        
varSet(playeripgettime());
    }
    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:58Incoming connection127.0.0.1:3851
[17:35:59] [join___ has joined the server (2:127.0.0.1)
[
17:35:59Conta salvaContas/___.ini.
[
17:35:59] [part___ has left the server (2:1)
[
17:36:01Incoming connection127.0.0.1:3852
[17:36:01] [join___ has joined the server (2:127.0.0.1)
[
17:36:01Conta salvaContas/___.ini.
[
17:36:01] [part___ has left the server (2:1)
[
17:36:03Incoming connection127.0.0.1:3853 
PHP код:
[17:36:05] [joinxUI42pIjfJfy8I has joined the server (2:127.0.0.1)
[
17:36:05] [joinCjl6aGeNPrtgBt has joined the server (2:127.0.0.1)
[
17:36:05] [joinPNXlfP8sCFKe8Q has joined the server (2:127.0.0.1)
[
17:36:05] [joinZBQ40pGGmBPkfE has joined the server (2:127.0.0.1)
[
17:36:05] [joinwBA9E4Yi3waP3X has joined the server (2:127.0.0.1)
[
17:36:05] [joindBm9tr702x9FWL has joined the server (2:127.0.0.1)
[
17:36:05] [joinFCCcV0XkuvzwB3 has joined the server (2:127.0.0.1)
[
17:36:05] [joinuwpjSK529aEm2x has joined the server (2:127.0.0.1)
[
17:36:05] [joinYpCC48xGwDE6sB 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] [joinDtvugjacniUnwk has joined the server (2:127.0.0.1)
[
17:42:35] [joinTN2oDpmjCzIKfu has joined the server (2:127.0.0.1)
[
17:42:352 Entrou em menos de 2 segundos
[17:42:35] [joinCmkIKzeN71xKUx has joined the server (2:127.0.0.1)
[
17:42:352 Entrou em menos de 2 segundos
[17:42:35BOTID -> 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: 1 Guest(s)