SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 05/07/2017, 06:04 PM   #11
Eoussama
High-roller
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 1,121
Reputation: 153
Default Re: RCON Login protection

Increase the string's size,
(94 + 24) > 100
__________________
Eoussama is online now   Reply With Quote
Old 05/07/2017, 06:15 PM   #12
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 11,039
Reputation: 2647
Default Re: RCON Login protection

Who uses RCON anyway? I would just straight up block the IP of anyone who tries to login, no matter friend or foe. RCON is too crude a tool to be of any reasonable use so I prefer to disable it completely.
__________________
Vince is offline   Reply With Quote
Old 05/07/2017, 07:41 PM   #13
HoussemGaming
Banned
 
Join Date: Jun 2017
Location: France
Posts: 206
Reputation: 10
Default Re: RCON Login protection

Nice one, keep it up, Rep+
HoussemGaming is offline   Reply With Quote
Old 05/07/2017, 10:10 PM   #14
Meller
Gangsta
 
Meller's Avatar
 
Join Date: Dec 2016
Posts: 604
Reputation: 108
Default Re: RCON Login protection

Quote:
Originally Posted by Vince View Post
Who uses RCON anyway? I would just straight up block the IP of anyone who tries to login, no matter friend or foe. RCON is too crude a tool to be of any reasonable use so I prefer to disable it completely.
Server.cfg -> rcon 0, best configuration there is.
__________________
#me too
Meller is online now   Reply With Quote
Old 06/07/2017, 03:12 AM   #15
saffierr
High-roller
 
saffierr's Avatar
 
Join Date: Jul 2013
Location: GetPlayerGirlHouse(targetplayer);
Posts: 1,155
Reputation: 36
Default Re: RCON Login protection

Quote:
Originally Posted by Eoussama View Post
Increase the string's size,
(94 + 24) > 100
Done.

Quote:
Originally Posted by Vince View Post
Who uses RCON anyway? I would just straight up block the IP of anyone who tries to login, no matter friend or foe. RCON is too crude a tool to be of any reasonable use so I prefer to disable it completely.
True, I do understand your point, though it was just a tutorial on how to detect, if someone is using rcon.

Quote:
Originally Posted by HoussemGaming View Post
Nice one, keep it up, Rep+
Thank you sir.
saffierr is offline   Reply With Quote
Old 06/07/2017, 01:22 PM   #16
coool
Huge Clucker
 
Join Date: Feb 2013
Location: Pakistan, Sindh
Posts: 446
Reputation: 28
Default Re: RCON Login protection

PHP Code:
if(!success// this checks if the player didn't succeed to login 

    new 
string[128], pIP[32], pname[MAX_PLAYER_NAME]; // This will hold the message we are going to send to all players 
    // We will now have to loop through all the online players because 'playerid' isn't usable in this callback. 
    
for(new 0GetPlayerPoolSize(); <= ji++) // This is the loop, 'GetPlayerPoolSize' checks the highest ID IG, hence I'd rather use that loop instead of MAX_PLAYERS; 
    

        if(
IsPlayerConnected(i)) // Check if the player is even connected 
        

            
GetPlayerName(ipnameMAX_PLAYER_NAME); // Get the player's name 
            
GetPlayerIp(ipIP32); // Check the player's IP 
            
if(RconAttempt[i] < MAX_RCONATTEMPTS// Check if the player hasn't reached the MAX_RCONATTEMPTS 
            

               [
BRconAttempt[i]++; [/B// if it's not reached, we will increase this variable 
            

I think, It will increase every one's RconAttempts.
__________________
My Writing Works
Lost In Future

coool is offline   Reply With Quote
Old 06/07/2017, 01:38 PM   #17
iLearner
Banned
 
Join Date: Apr 2017
Posts: 430
Reputation: 89
Default Re: RCON Login protection

True.
iLearner is offline   Reply With Quote
Old 06/07/2017, 01:40 PM   #18
TheRealMan
Banned
 
Join Date: Sep 2016
Posts: 19
Reputation: 1
Default Re: RCON Login protection

Good.
TheRealMan is offline   Reply With Quote
Old 06/07/2017, 02:10 PM   #19
saffierr
High-roller
 
saffierr's Avatar
 
Join Date: Jul 2013
Location: GetPlayerGirlHouse(targetplayer);
Posts: 1,155
Reputation: 36
Default Re: RCON Login protection

Quote:
Originally Posted by coool View Post
PHP Code:
if(!success// this checks if the player didn't succeed to login 

    new 
string[128], pIP[32], pname[MAX_PLAYER_NAME]; // This will hold the message we are going to send to all players 
    // We will now have to loop through all the online players because 'playerid' isn't usable in this callback. 
    
for(new 0GetPlayerPoolSize(); <= ji++) // This is the loop, 'GetPlayerPoolSize' checks the highest ID IG, hence I'd rather use that loop instead of MAX_PLAYERS; 
    

        if(
IsPlayerConnected(i)) // Check if the player is even connected 
        

            
GetPlayerName(ipnameMAX_PLAYER_NAME); // Get the player's name 
            
GetPlayerIp(ipIP32); // Check the player's IP 
            
if(RconAttempt[i] < MAX_RCONATTEMPTS// Check if the player hasn't reached the MAX_RCONATTEMPTS 
            

               [
BRconAttempt[i]++; [/B// if it's not reached, we will increase this variable 
            

I think, It will increase every one's RconAttempts.
Thank you, editted!
saffierr is offline   Reply With Quote
Old 07/07/2017, 07:09 AM   #20
coool
Huge Clucker
 
Join Date: Feb 2013
Location: Pakistan, Sindh
Posts: 446
Reputation: 28
Default Re: RCON Login protection

You are checking for one thing two times:
PHP Code:
            if(RconAttempt[i] < MAX_RCONATTEMPTS && !strcmp(ippIP)) //Check if the player hasn't reached the MAX_RCONATTEMPTS 
            

                
RconAttempt[i]++; // if it's not reached, we will increase this variable 
            

            else if(
RconAttempt[i] >= MAX_RCONATTEMPTS && !strcmp(ippIP)) // Check if the player reached the maximum attempts (2) 
            

                
format(stringsizeof string"%s has been automatically banned from the server. Reason: Attempting to hack the RCON password."pname); 
                
SendClientMessageToAll(COLOR_REDstring); // Send the formatted message to everyone in red. 
                
Ban(i); // Ban the player who tried to login twice. 
            

The `!strcmp(ip, pIP)` It can be done like this:
PHP Code:
            if(strcmp(ippIP)) return 1;
if(
RconAttempt[i] < MAX_RCONATTEMPTS//Check if the player hasn't reached the MAX_RCONATTEMPTS 
            

                
RconAttempt[i]++; // if it's not reached, we will increase this variable 
            

            else if(
RconAttempt[i] >= MAX_RCONATTEMPTS// Check if the player reached the maximum attempts (2) 
            

And in addition to this you are getting every player's name while you only need one players name:
PHP Code:
    for(new 0GetPlayerPoolSize(); <= ji++) // This is the loop, 'GetPlayerPoolSize' checks the highest ID IG, hence I'd rather use that loop instead of MAX_PLAYERS; 
    

        if(
IsPlayerConnected(i)) // Check if the player is even connected 
        

            
GetPlayerName(ipnameMAX_PLAYER_NAME); // Get the player's name 
And also delay declaring global variables.
__________________
My Writing Works
Lost In Future

coool is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rcon protection NexySamp Scripting Help 11 04/07/2015 03:11 PM
need help with rcon protection HeLiOn_PrImE Scripting Help 22 08/02/2014 01:36 PM
[FilterScript] [R.P.S] Rcon Protection System (/rSenha) [/rcon login = kick] Diogo_Bras Lanšamentos/Releases 14 30/04/2011 04:57 PM
HELP:i cant login as rcon using remote console or /rcon login rconpass ingame greekboy Help Archive 3 21/10/2010 01:43 PM


All times are GMT. The time now is 08:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.