[Tutorial] Howto: Properly handle rcon login spam - 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)
+---- Forum: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Howto: Properly handle rcon login spam (
/showthread.php?tid=437753)
Howto: Properly handle rcon login spam -
JernejL - 17.05.2013
This contains:
- Automatic ban of external console logins that fail to login (most of this type of attacks).
- Warning system (will warn all players from same ip not to try to login if they are not admins)
- Flood control - too many false attempts -> ban
Код:
OnRconLoginAttempt(ip[], password[], success) {
#pragma unused password
if (!success) {
new hasplayers = 0;
new pip[16];
for (new PlayerID=0; PlayerID < MAX_PLAYERS; PlayerID++) {
if (!IsPlayerConnected(PlayerID))
continue;
GetPlayerIp(PlayerID, pip, sizeof(pip));
if (!strcmp(ip, pip, true)) {
hasplayers++;
// protect nubs against their stupidity.
new timex = TimeSincePvar(PlayerID, "last_rcon_attempt");
if (timex > 1000) {
SendPlayerMessage(PlayerID, COLOR_RED, "Do not abuse the rcon system, you will be banned if you fail to login again.");
}
SetPVarInt(PlayerID, "last_rcon_attempt", TickCount());
new rla;
rla = GetPVarInt(PlayerID, "rcon_login_attempts");
rla = rla + 1;
if (rla > 3) {
// ban the ip via rcon
makestrf(banipstr, 64, "banip %s", ip);
SendRconCommand(banipstr);
}
SetPVarInt(PlayerID, "rcon_login_attempts", rla);
}
} // loop
if (hasplayers == 0) {
// ban the ip via rcon
makestrf(banipstr, 64, "banip %s", ip);
SendRconCommand(banipstr);
}
}
return PCOR_CONTINUE;
}
For: TimeSincePvar - grab it here:
http://forum.sa-mp.com/showpost.php?...8&postcount=40
Re: Howto: Properly handle rcon login spam -
FunnyBear - 17.05.2013
Nice tutorial!
Re: Howto: Properly handle rcon login spam -
CriticalRP - 18.05.2013
Can't get the TimeSincePvar, can someone give it to me?
Re: Howto: Properly handle rcon login spam -
Kirollos - 18.05.2013
nice, but TimeSincePvar link gives error:
kirollos, you do not have permission to access this page. This could be due to one of several reasons:
Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.