[Tutorial] How to make 2 rcon system. [Dual Security]
#1

Introduction
I am making this tutorial for those people who are getting attacked by rcon crackers.
So lets start....

Code:
public OnRconLoginAttempt(ip[], password[], success)
{
 if(success)
 {
here we will check that if player get success with 1st rcon then he will get dialog of 2nd rcon if he dont put second password then he will kicked.
if he try to cancel = kicked
if he try to enter wrong password = kicked.
full security.

Code:
	new pip[16], playername[25], string[270];
here we need this defines pip for playerip and playername for player's name and string which we gooing to send to admins or players.
Code:
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
if that player isconnected.
Code:
            GetPlayerName(i, playername, MAX_PLAYER_NAME);
			GetPlayerIp(i, pip, sizeof(pip));
get the player's name and player's ip.
Code:
			if(!strcmp(ip, pip, true))
			{
                new pname[24];
                GetPlayerName(i,pname,24);
                format(string, sizeof(string), "%s trying to login in rcon.",playername);
                SendClientMessageToAll(0xFFFF00FF, string);
here we will send player name to all players that he is trying to log in in rcon.
Code:
				ShowPlayerDialog(i, DIALOG_RCON, DIALOG_STYLE_PASSWORD, "Server Rcon Logging", "You have confirmed with first password.\nNow make your way to second password so you can completely log in it.", "Cancel", "Connect Rcon");
here we will show that player dialog of 2nd rcon to enter hsi 2nd password of rcon.
Code:
			}
		}
	}
	return 1;
 }
 return 1;
}
this will finish the rcon system
now
Code:
#define DIALOG_RCON 1
now lets complete our dialog.

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_RCON)
	{
check if the dialog is rcon one.
if (!response) Kick(playerid);
{
if player try to cancel or wrong pw he will be kicked.
Code:
			if(strcmp(inputtext, "MyPass", true)==0)
	        {
				SendClientMessage(playerid, COLOR_WHITE,"SERVER: You are logged in as admin.");
		    }
if player enters correct password in 2nd rcon then he will get this message.
otherwise else

Code:
			else
			{
			 format(string, 200, "%s has been kicked due to invalid attempt of rcon login.", RPN(playerid));
			 SendMessageToAdmins(COLOR_ADMIN, string);
			 Kick(playerid);
			}
else kick that player with the message.
Code:
			return 1;
		}
	}

return 1;
}
complete this } and return 1; at correct place.

i hope you will be able to learn how to make 2nd rcon wth simple tutorial.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)