Page 1 of 2

Apsauga nuo HLDS Fake players Flood

Posted: 2012 May 10 15:34
by NZT
Aprašymas: duotas pluginas leidžia apsisaugoti nuo exploit`o "HLDS Fake players Flood 1.0 By: I-T-N-I".

Kaip dirba pluginas?
Pluginas tikrina console, ieško ir gaudo tuos, kurie per daug prisijunginėja, ir atsijunginėja, ir tuomet užblokuoja juos (tikri žaidėjai nuo to visai nenukentės).

noflood_.zip - 402.5 Kb

Code: Select all

#include <amxmodx>#include <orpheu>#define PLUGIN "Anti flood"#define VERSION "1.0"#define AUTHOR "kanagava" new time_last_connnew ip_old[256]new ip_warn[256]new Msg[256]new OrpheuHook:handlePrintfnew warnnew old_timenew registeredpublic plugin_init(){    register_plugin(PLUGIN, VERSION, AUTHOR)    set_task(5.0, "regfunctions") } public regfunctions(){    server_cmd("mp_logecho 1")    server_cmd("log on")    OrpheuRegisterHook(OrpheuGetFunction("SV_ConnectClient"),"OnSV_ConnectClientPre", OrpheuHookPre)    OrpheuRegisterHook(OrpheuGetFunction("SV_ConnectClient"),"OnSV_ConnectClientPost", OrpheuHookPost)} public OrpheuHookReturn:OnSV_ConnectClientPre(){    registered=0    if(get_systime()-old_time <= 2)    {        handlePrintf = OrpheuRegisterHook( OrpheuGetFunction( "Con_Printf" ), "Con_Printf" , OrpheuHookPre);        registered=1    }    old_time=get_systime()    return OrpheuIgnored;}  public OrpheuHookReturn:OnSV_ConnectClientPost(){    if(registered)    {        OrpheuUnregisterHook(handlePrintf)    }    return OrpheuIgnored;}   public OrpheuHookReturn:Con_Printf(const a[], const message[] ){    registered=1    if (containi(message,"^" connected, address ^"")!=-1)    {        new len=255        new temp_right[256],temp_left[256],conn_ip[256]        formatex( Msg,charsmax( Msg ),"%s", message );        split(Msg, temp_left, len, temp_right, len, "^" connected, address ^"")        strtok(temp_right, conn_ip, len, temp_right, len, ':')        if (equal(conn_ip,ip_old) && !equal(conn_ip,"") && ((get_systime()-time_last_conn)<2))        {            warn=warn+1            if(warn>1 && equal(conn_ip,ip_warn))            {                log_amx("[NOFLOOD] Connection flood detected from ip %s",ip_old)                server_cmd("addip 120.0 %s",ip_old)            }            ip_warn=conn_ip        }        else        {            warn=0        }        ip_old=conn_ip        time_last_conn=get_systime()    }    return OrpheuIgnored;}

Re: Apsauga nuo HLDS Fake players Flood

Posted: 2012 May 28 07:51
by Almantsas
Šiandien testavau, puikiai apsaugo, nes dproto su šituo nesusitvarko.

Re: Apsauga nuo HLDS Fake players Flood

Posted: 2012 May 28 09:03
by TETYYS
Gal galit exploitą duot?

Vartotojas galo įspėjimą.

Labai gaila, kad galau įspėjimą, o tik serverius pagadint norėjau. :(

Re: Apsauga nuo HLDS Fake players Flood

Posted: 2012 Jun 20 21:27
by pofke112
Šis pluginas pribindina žaidėjams nustatymų ir jungia į kažkokį rusišką servą.

Re: Apsauga nuo HLDS Fake players Flood

Posted: 2012 Aug 05 15:46
by xDede
Kaip padaryti kad nemestu i rusiska serveri?

Re: Apsauga nuo HLDS Fake players Flood

Posted: 2012 Aug 05 17:20
by TETYYS
Susicompilink pluginą iš čia...

Re: Apsauga nuo HLDS Fake players Flood

Posted: 2012 Aug 05 20:27
by nuodas159
O po kiek žaidėjų nusiuntimą, užblokuoja?

Re: Apsauga nuo HLDS Fake players Flood

Posted: 2012 Aug 05 21:36
by xDede
Truksta failu norint compilinti...

Re: Apsauga nuo HLDS Fake players Flood

Posted: 2012 Aug 06 10:09
by InvIs

Re: Apsauga nuo HLDS Fake players Flood

Posted: 2012 Sep 17 16:01
by Aivaras
New version v1.1

Code: Select all

#include <amxmodx>#include <orpheu>#define PLUGIN "Anti flood"#define VERSION "1.1"#define AUTHOR "kanagava"//native halflife_time ( )// небольшие настройки для плагинаnew MAX_WARN=1 //Число предупреждений после которого IP будет забанен рекомендуется [1-2]new CONN_TIME=2 //Минимальное время между соединениями с сервером для включения првоерок// (если между подключениями меньше CONN_TIME секунд включаются проверки) рекомендуется [1-3]new CONN_TIME_IP=3 //Минимальное время между соединениями с одного IP для выдачи предупреждения рекомендуется [1-5]new RST_WARN_TIME_IP=10 //Максимальное время между соединениями с одного IP для сброса предупреждений// НЕОБХОДИМО [RST_WARN_TIME_IP>CONN_TIME_IP]  new Msg[256]new OrpheuHook:handlePrintfnew ip_list[5][16]new time_list[5]new warn_list[5]new old_timenew registeredpublic plugin_init(){    register_plugin(PLUGIN, VERSION, AUTHOR)    set_task(5.0, "regfunctions")      register_srvcmd("floodlist","floodlist")  }  public regfunctions(){    //log_amx("try to reg_func")    OrpheuRegisterHook(OrpheuGetFunction("SV_ConnectClient"),"OnSV_ConnectClientPre", OrpheuHookPre)    OrpheuRegisterHook(OrpheuGetFunction("SV_ConnectClient"),"OnSV_ConnectClientPost", OrpheuHookPost)    server_cmd("mp_logecho 1")    server_cmd("log on")} public OrpheuHookReturn:OnSV_ConnectClientPre(){    registered=0    if(get_systime()-old_time <= CONN_TIME)    {        //log_amx("Reg %d %d ",halflife_time ( ), get_systime())        handlePrintf = OrpheuRegisterHook( OrpheuGetFunction( "Con_Printf" ), "Con_Printf" , OrpheuHookPre);        registered=1        //log_amx("Reg %d %d ",halflife_time ( ), get_systime())    }    old_time=get_systime()    return OrpheuIgnored;}  public OrpheuHookReturn:OnSV_ConnectClientPost(){    if(registered)    {        OrpheuUnregisterHook(handlePrintf)        //log_amx("Unreg %d %d ",halflife_time ( ), get_systime())    }    return OrpheuIgnored;} public OrpheuHookReturn:Con_Printf(const a[], const message[] ){    registered=1    if (containi(message,"^" connected, address ^"")!=-1)    {        new msg[256]        copy(msg,255,message)        checkip(msg)    }    return OrpheuIgnored;}  public floodlist(){    new h_time[32]    console_print(0,"Floodding IP list by Dan'ka :D")    for (new i=0;i<5;i++)        {    if(time_list[i]!=0)    {        format_time ( h_time,31, "%d.%m %H:%M:%S",time_list[i])         console_print(0,"[%d] [IP %s] [TIME %s]   [WARN's %d]",i,ip_list[i],h_time,warn_list[i])    }}} public checkip(message[]){    new len=255    new temp_right[256],temp_left[256],conn_ip[256]    formatex( Msg,charsmax( Msg ),"%s", message );    split(Msg, temp_left, len, temp_right, len, "^" connected, address ^"")    strtok(temp_right, conn_ip, len, temp_right, len, ':')    new mintime    new replace_index    mintime=get_systime()    for (new i=0;i<5;i++)    {        if (time_list[i]<mintime )        {            mintime=time_list[i]            replace_index=i        }            }    new ipwarn    ipwarn=false    for (new i=0;i<5;i++)    {            if (equal(conn_ip,ip_list[i]) && !equal(conn_ip,""))        {            if ((get_systime()-time_list[i])<CONN_TIME_IP)            {                warn_list[i]=warn_list[i]+1                if(warn_list[i]>MAX_WARN)                {                    //log_amx("Ban %d %d ",halflife_time ( ), get_systime())                    log_amx("[NOFLOOD] Connection flood detected from ip %s",conn_ip)                    server_cmd("addip 120.0 %s",conn_ip)                }            }            else            {                if ((get_systime()-time_list[i])>RST_WARN_TIME_IP)                     warn_list[i]=0            }                            time_list[i]=get_systime()            ipwarn=true            break        }    }            if (!ipwarn)    {        warn_list[replace_index]=0        time_list[replace_index]=get_systime()        copy(ip_list[replace_index],15,conn_ip)    }}