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, 05:04 PM   #11
Eoussama
Gangsta
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 760
Reputation: 101
Default Re: RCON Login protection

Increase the string's size,
(94 + 24) > 100
Eoussama is online now   Reply With Quote
Old 05/07/2017, 05:15 PM   #12
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,845
Reputation: 2567
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, 06:41 PM   #13
HoussemGaming
Big Clucker
 
HoussemGaming's Avatar
 
Join Date: Jun 2017
Location: France
Posts: 143
Reputation: 6
Default Re: RCON Login protection

Nice one, keep it up, Rep+
__________________
My works
Filterscripts
HoussemGaming is offline   Reply With Quote
Old 05/07/2017, 09:10 PM   #14
Meller
Huge Clucker
 
Join Date: Dec 2016
Posts: 238
Reputation: 39
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.
Meller is offline   Reply With Quote
Old 06/07/2017, 02:12 AM   #15
saffierr
High-roller
 
saffierr's Avatar
 
Join Date: Jul 2013
Location: GetPlayerGirlHouse(targetplayer);
Posts: 1,154
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, 12:22 PM   #16
coool
Huge Clucker
 
Join Date: Feb 2013
Location: Pakistan, Sindh
Posts: 396
Reputation: 22
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.
__________________
SCRIPTING ON LOW RATES

My Writing Works
Lost In Future


Code:
Every thing in the world either a potato or not a potato
coool is offline   Reply With Quote
Old 06/07/2017, 12:38 PM   #17
iLearner
Huge Clucker
 
iLearner's Avatar
 
Join Date: Apr 2017
Posts: 293
Reputation: 64
Default Re: RCON Login protection

True.
__________________
iLearner is online now   Reply With Quote
Old 06/07/2017, 12:40 PM   #18
TheRealMan
Little Clucker
 
TheRealMan's Avatar
 
Join Date: Sep 2016
Posts: 19
Reputation: 1
Default Re: RCON Login protection

Good.
__________________
#RESPECT_OTHER_MEMBERS
TheRealMan is offline   Reply With Quote
Old 06/07/2017, 01:10 PM   #19
saffierr
High-roller
 
saffierr's Avatar
 
Join Date: Jul 2013
Location: GetPlayerGirlHouse(targetplayer);
Posts: 1,154
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, 06:09 AM   #20
coool
Huge Clucker
 
Join Date: Feb 2013
Location: Pakistan, Sindh
Posts: 396
Reputation: 22
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.
__________________
SCRIPTING ON LOW RATES

My Writing Works
Lost In Future


Code:
Every thing in the world either a potato or not a potato
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 02:11 PM
need help with rcon protection HeLiOn_PrImE Scripting Help 22 08/02/2014 12:36 PM
[FilterScript] [R.P.S] Rcon Protection System (/rSenha) [/rcon login = kick] Diogo_Bras Lanšamentos/Releases 14 30/04/2011 03:57 PM
HELP:i cant login as rcon using remote console or /rcon login rconpass ingame greekboy Help Archive 3 21/10/2010 12:43 PM


All times are GMT. The time now is 11:05 AM.


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