SA-MP Forums Archive
Rcon attempts - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Rcon attempts (/showthread.php?tid=481960)



Rcon attempts - DeathFire - 18.12.2013

Some one is trying to hack my rcon!!! -.- ffs a spam of this is in the logs:
How can I prevent this? :/
Code:
[16:27:49] BAD RCON ATTEMPT BY: 95.85.1.93
EDIT: The guy is from Russia... :c


Re: Rcon attempts - DJ_Shocker - 18.12.2013

Go to your server.cfg file
ADD THIS LINE:

Quote:

rcon 0

Restart Server

Problem Solved.


Re: Rcon attempts - Djole1337 - 18.12.2013

Congratulations! (Posts: 197 Reputation: 17) And you still don't know to use rcon.


Re: Rcon attempts - DeathFire - 18.12.2013

Quote:
Originally Posted by Djole1337
View Post
Congratulations! (Posts: 197 Reputation: 17) And you still don't know to use rcon ban.
I just didnt remember ._.


Re: Rcon attempts - Vince - 18.12.2013

Quote:
Originally Posted by Djole1337
View Post
Congratulations! (Posts: 197 Reputation: 17) And you still don't know to use rcon.
Or how to use the search function for that matter. This question gets asked at least once a week.


Re: Rcon attempts - DJ_Shocker - 18.12.2013

Quote:
Originally Posted by DeathFire
View Post
I just didnt remember ._.
Ignore.

This is what SA-MP has come to. A huge community of people constantly insulting one another, treating people like crap, etc.

Just follow the instructions i posted and you'll be fine. It will prevent people from logging into RCON remotely.


Re: Rcon attempts - DeathFire - 18.12.2013

Quote:
Originally Posted by DJ_Shocker
View Post
Ignore.

This is what SA-MP has come to. A huge community of people constantly insulting one another, treating people like crap, etc.

Just follow the instructions i posted and you'll be fine. It will prevent people from logging into RCON remotely.
Thanks man!


Re: Rcon attempts - Crystallize - 19.12.2013

Code:
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;
}



Re: Rcon attempts - Astralis - 19.12.2013

Quote:
Originally Posted by WizzardY
View Post
Code:
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;
}
Rcon 0 in server.cfg is still better.


Re: Rcon attempts - BedBokart - 19.12.2013

Quote:
Originally Posted by DJ_Shocker
View Post
Go to your server.cfg file
ADD THIS LINE:



Restart Server

Problem Solved.
Sorry for the stupid question, but if anyone can put 0 rcon login to rcon login if after using the command / rcon login 0?