Raised This Month: $51 Target: $400
 12% 

noflood.amxx


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
illusionalp
Member
Join Date: Aug 2012
Old 02-04-2013 , 15:17   noflood.amxx
Reply With Quote #1

noflood.amxx(hlds fake players anti flood) i found one online not on this site so i thought it might be another russian pugin that redirct to russian servers so i hope you take a look at the code and let me know if it redirct to another servers or no
Quote:
#include <amxmodx>
#include <orpheu>
#define PLUGIN "Anti flood"
#define VERSION "1.1"
#define AUTHOR "kanagava"
//native halflife_time ( )
// Ajustes menores al plug-in
new MAX_WARN=1 // El número de advertencias después de que la IP se prohibió recomendado [1-2]
new CONN_TIME=2 // Tiempo mínimo entre conexiones al servidor para permitir
// (Si las conexiones entre segundo conn_time más pequeños de la prueba) se recomienda [1-3]
new CONN_TIME_IP=3 // El tiempo mínimo entre las conexiones de una IP a emitir advertencias recomendadas [1-5]
new RST_WARN_TIME_IP=10 // Tiempo máximo entre las conexiones de una IP a restablecer advertencias
// Necesidad [RST_WARN_TIME_IP>CONN_TIME_IP]
new Msg[256]
new OrpheuHook:handlePrintf
new ip_list[5][16]
new time_list[5]
new warn_list[5]
new old_time
new registered
public 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_Conn ectClient"),"OnSV_ConnectClientPre", OrpheuHookPre)
OrpheuRegisterHook(OrpheuGetFunction("SV_Conn ectClient"),"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 ")
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)
}
}

Last edited by illusionalp; 02-04-2013 at 15:18.
illusionalp is offline
Cheezpuff
BANNED
Join Date: Oct 2012
Location: City of the Dead
Old 02-04-2013 , 18:31   Re: noflood.amxx
Reply With Quote #2

no, i guess...

PHP Code:
#include <amxmodx>
#include <orpheu>

#define PLUGIN "Anti flood"
#define VERSION "1.1"
#define AUTHOR "kanagava"

//native halflife_time ( )
// Ajustes menores al plug-in

new MAX_WARN=// El n?mero de advertencias despu?s de que la IP se prohibi? recomendado [1-2]
new CONN_TIME=// Tiempo m?nimo entre conexiones al servidor para permitir
// (Si las conexiones entre segundo conn_time m?s peque?os de la prueba) se recomienda [1-3]
new CONN_TIME_IP=// El tiempo m?nimo entre las conexiones de una IP a emitir advertencias recomendadas [1-5]
new RST_WARN_TIME_IP=10 // Tiempo m?ximo entre las conexiones de una IP a restablecer advertencias
// Necesidad [RST_WARN_TIME_IP>CONN_TIME_IP]

new Msg[256]
new 
OrpheuHook:handlePrintf
new ip_list[5][16]
new 
time_list[5]
new 
warn_list[5]
new 
old_time
new registered

public plugin_init()
{
register_plugin(PLUGINVERSIONAUTHOR)
set_task(5.0"regfunctions")
register_srvcmd("floodlist","floodlist")
}

public 
regfunctions()
{
//log_amx("try to reg_func")
OrpheuRegisterHook(OrpheuGetFunction("SV_Conn ectClient"),"OnSV_ConnectClientPre"OrpheuHookPre)
OrpheuRegisterHook(OrpheuGetFunction("SV_Conn ectClient"),"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 OrpheuRegisterHookOrpheuGetFunction"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,"^" connectedaddress ^"")!=-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 ")
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]

formatexMsg,charsmaxMsg ),"%s"message );
split(Msgtemp_leftlentemp_rightlen"^" connectedaddress ^"")
strtok(temp_rightconn_iplentemp_rightlen':')
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)
}

Cheezpuff is offline
Send a message via Skype™ to Cheezpuff
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 02-05-2013 , 03:56   Re: noflood.amxx
Reply With Quote #3

Delete dproto and update ur server with hldsupdatetool
No need for noflood.amxx
__________________
simanovich is offline
Old 02-05-2013, 16:00
illusionalp
This message has been deleted by illusionalp. Reason: l
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode